-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
316 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,265 @@ | ||
//! s390x Linux system calls. | ||
use crate::backend::reg::{ | ||
ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, | ||
}; | ||
use core::arch::asm; | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
lateout("r2") r0, | ||
options(nostack, preserves_flags, readonly) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
options(nostack, preserves_flags) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall1_readonly( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
options(nostack, preserves_flags, readonly) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
in("r2") a0.to_asm(), | ||
options(nostack, preserves_flags, noreturn) | ||
) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall2( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
options(nostack, preserves_flags) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall2_readonly( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
options(nostack, preserves_flags, readonly) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall3( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
options(nostack, preserves_flags) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall3_readonly( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
options(nostack, preserves_flags, readonly) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall4( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
a3: ArgReg<'_, A3>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
in("r5") a3.to_asm(), | ||
options(nostack, preserves_flags) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall4_readonly( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
a3: ArgReg<'_, A3>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
in("r5") a3.to_asm(), | ||
options(nostack, preserves_flags, readonly) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall5( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
a3: ArgReg<'_, A3>, | ||
a4: ArgReg<'_, A4>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
in("r5") a3.to_asm(), | ||
in("r6") a4.to_asm(), | ||
options(nostack, preserves_flags) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall5_readonly( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
a3: ArgReg<'_, A3>, | ||
a4: ArgReg<'_, A4>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
in("r5") a3.to_asm(), | ||
in("r6") a4.to_asm(), | ||
options(nostack, preserves_flags, readonly) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall6( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
a3: ArgReg<'_, A3>, | ||
a4: ArgReg<'_, A4>, | ||
a5: ArgReg<'_, A5>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
in("r5") a3.to_asm(), | ||
in("r6") a4.to_asm(), | ||
in("r7") a5.to_asm(), | ||
options(nostack, preserves_flags) | ||
); | ||
FromAsm::from_asm(r0) | ||
} | ||
|
||
#[inline] | ||
pub(in crate::backend) unsafe fn syscall6_readonly( | ||
nr: SyscallNumber<'_>, | ||
a0: ArgReg<'_, A0>, | ||
a1: ArgReg<'_, A1>, | ||
a2: ArgReg<'_, A2>, | ||
a3: ArgReg<'_, A3>, | ||
a4: ArgReg<'_, A4>, | ||
a5: ArgReg<'_, A5>, | ||
) -> RetReg<R0> { | ||
let r0; | ||
asm!( | ||
"svc 0", | ||
in("r1") nr.to_asm(), | ||
inlateout("r2") a0.to_asm() => r0, | ||
in("r3") a1.to_asm(), | ||
in("r4") a2.to_asm(), | ||
in("r5") a3.to_asm(), | ||
in("r6") a4.to_asm(), | ||
in("r7") a5.to_asm(), | ||
options(nostack, preserves_flags, readonly) | ||
); | ||
FromAsm::from_asm(r0) | ||
} |
Oops, something went wrong.