Add squiid x86_64 as platform
Signed-off-by: Christoph Heiss <contact@christoph-heiss.at>
This commit is contained in:
parent
053dc07c4e
commit
a9a90850b3
|
@ -105,3 +105,8 @@ pub mod platform;
|
|||
target_arch = "aarch64"))]
|
||||
#[path="platform/macos-aarch64/mod.rs"]
|
||||
pub mod platform;
|
||||
|
||||
#[cfg(all(target_os = "squiid",
|
||||
target_arch = "x86_64"))]
|
||||
#[path="platform/squiid-x86_64/mod.rs"]
|
||||
pub mod platform;
|
||||
|
|
137
src/platform/squiid-x86_64/mod.rs
Normal file
137
src/platform/squiid-x86_64/mod.rs
Normal file
|
@ -0,0 +1,137 @@
|
|||
// Copyright 2022 The syscall.rs Project Developers. See the
|
||||
// COPYRIGHT file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! This library was built for x86-64 squiid.
|
||||
|
||||
use core::arch::asm;
|
||||
|
||||
pub mod nr;
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn syscall0(mut n: usize) -> usize {
|
||||
asm!(
|
||||
"syscall",
|
||||
inout("rax") n,
|
||||
out("rcx") _,
|
||||
out("r11") _,
|
||||
options(nostack),
|
||||
);
|
||||
n
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn syscall1(mut n: usize, a1: usize) -> usize {
|
||||
asm!(
|
||||
"syscall",
|
||||
inout("rax") n,
|
||||
in("rdi") a1,
|
||||
out("rcx") _,
|
||||
out("r11") _,
|
||||
options(nostack),
|
||||
);
|
||||
n
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn syscall2(mut n: usize, a1: usize, a2: usize) -> usize {
|
||||
asm!(
|
||||
"syscall",
|
||||
inout("rax") n,
|
||||
in("rdi") a1,
|
||||
in("rsi") a2,
|
||||
out("rcx") _,
|
||||
out("r11") _,
|
||||
options(nostack),
|
||||
);
|
||||
n
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn syscall3(mut n: usize, a1: usize, a2: usize, a3: usize) -> usize {
|
||||
asm!(
|
||||
"syscall",
|
||||
inout("rax") n,
|
||||
in("rdi") a1,
|
||||
in("rsi") a2,
|
||||
in("rdx") a3,
|
||||
out("rcx") _,
|
||||
out("r11") _,
|
||||
options(nostack),
|
||||
);
|
||||
n
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn syscall4(mut n: usize,
|
||||
a1: usize,
|
||||
a2: usize,
|
||||
a3: usize,
|
||||
a4: usize)
|
||||
-> usize {
|
||||
asm!(
|
||||
"syscall",
|
||||
inout("rax") n,
|
||||
in("rdi") a1,
|
||||
in("rsi") a2,
|
||||
in("rdx") a3,
|
||||
in("r10") a4,
|
||||
out("rcx") _,
|
||||
out("r11") _,
|
||||
options(nostack),
|
||||
);
|
||||
n
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn syscall5(mut n: usize,
|
||||
a1: usize,
|
||||
a2: usize,
|
||||
a3: usize,
|
||||
a4: usize,
|
||||
a5: usize)
|
||||
-> usize {
|
||||
asm!(
|
||||
"syscall",
|
||||
inout("rax") n,
|
||||
in("rdi") a1,
|
||||
in("rsi") a2,
|
||||
in("rdx") a3,
|
||||
in("r10") a4,
|
||||
in("r8") a5,
|
||||
out("rcx") _,
|
||||
out("r11") _,
|
||||
options(nostack),
|
||||
);
|
||||
n
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn syscall6(mut n: usize,
|
||||
a1: usize,
|
||||
a2: usize,
|
||||
a3: usize,
|
||||
a4: usize,
|
||||
a5: usize,
|
||||
a6: usize)
|
||||
-> usize {
|
||||
asm!(
|
||||
"syscall",
|
||||
inout("rax") n,
|
||||
in("rdi") a1,
|
||||
in("rsi") a2,
|
||||
in("rdx") a3,
|
||||
in("r10") a4,
|
||||
in("r8") a5,
|
||||
in("r9") a6,
|
||||
out("rcx") _,
|
||||
out("r11") _,
|
||||
options(nostack),
|
||||
);
|
||||
n
|
||||
}
|
27
src/platform/squiid-x86_64/nr.rs
Normal file
27
src/platform/squiid-x86_64/nr.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2022 The syscall.rs Project Developers. See the
|
||||
// COPYRIGHT file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! System call numbers for x86_64 squiid.
|
||||
|
||||
pub const OPEN: usize = 0;
|
||||
pub const CLOSE: usize = 1;
|
||||
pub const READ: usize = 2;
|
||||
pub const WRITE: usize = 3;
|
||||
pub const SEEK: usize = 4;
|
||||
pub const EXIT: usize = 5;
|
||||
pub const EXECVE: usize = 6;
|
||||
pub const CLONE: usize = 7;
|
||||
pub const GETID: usize = 8;
|
||||
pub const MMAP: usize = 9;
|
||||
pub const PRCTL: usize = 10;
|
||||
pub const STAT: usize = 11;
|
||||
pub const FUTEX: usize = 12;
|
||||
pub const GETCWD: usize = 13;
|
||||
pub const WAIT: usize = 14;
|
||||
pub const READDIR: usize = 15;
|
Loading…
Reference in a new issue