diff options
Diffstat (limited to 'vendor/rustix/src/backend/linux_raw/arch/mod.rs')
-rw-r--r-- | vendor/rustix/src/backend/linux_raw/arch/mod.rs | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/vendor/rustix/src/backend/linux_raw/arch/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/mod.rs index e13f675fd..cc93fc2c4 100644 --- a/vendor/rustix/src/backend/linux_raw/arch/mod.rs +++ b/vendor/rustix/src/backend/linux_raw/arch/mod.rs @@ -1,8 +1,8 @@ //! Architecture-specific syscall code. //! //! `rustix` has inline assembly sequences using `asm!`, but that requires -//! nightly Rust, so it also has out-of-line ("outline") assembly sequences -//! in .s files. And 32-bit x86 is special (see comments below). +//! Rust 1.59, so it also has out-of-line ("outline") assembly sequences in .s +//! files. And 32-bit x86 is special (see comments below). //! //! This module also has a `choose` submodule which chooses a scheme and is //! what most of the `rustix` syscalls use. @@ -133,6 +133,87 @@ macro_rules! syscall { }; } +// Macro to invoke a syscall that always uses direct assembly, rather than the +// vDSO. Useful when still finding the vDSO. +#[allow(unused_macros)] +macro_rules! syscall_always_asm { + ($nr:ident) => { + $crate::backend::arch::asm::syscall0($crate::backend::reg::nr(linux_raw_sys::general::$nr)) + }; + + ($nr:ident, $a0:expr) => { + $crate::backend::arch::asm::syscall1( + $crate::backend::reg::nr(linux_raw_sys::general::$nr), + $a0.into(), + ) + }; + + ($nr:ident, $a0:expr, $a1:expr) => { + $crate::backend::arch::asm::syscall2( + $crate::backend::reg::nr(linux_raw_sys::general::$nr), + $a0.into(), + $a1.into(), + ) + }; + + ($nr:ident, $a0:expr, $a1:expr, $a2:expr) => { + $crate::backend::arch::asm::syscall3( + $crate::backend::reg::nr(linux_raw_sys::general::$nr), + $a0.into(), + $a1.into(), + $a2.into(), + ) + }; + + ($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr) => { + $crate::backend::arch::asm::syscall4( + $crate::backend::reg::nr(linux_raw_sys::general::$nr), + $a0.into(), + $a1.into(), + $a2.into(), + $a3.into(), + ) + }; + + ($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => { + $crate::backend::arch::asm::syscall5( + $crate::backend::reg::nr(linux_raw_sys::general::$nr), + $a0.into(), + $a1.into(), + $a2.into(), + $a3.into(), + $a4.into(), + ) + }; + + ($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr) => { + $crate::backend::arch::asm::syscall6( + $crate::backend::reg::nr(linux_raw_sys::general::$nr), + $a0.into(), + $a1.into(), + $a2.into(), + $a3.into(), + $a4.into(), + $a5.into(), + ) + }; + + ($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr) => { + $crate::backend::arch::asm::syscall7( + $crate::backend::reg::nr(linux_raw_sys::general::$nr), + $a0.into(), + $a1.into(), + $a2.into(), + $a3.into(), + $a4.into(), + $a5.into(), + $a6.into(), + ) + }; +} + +/// Like `syscall`, but adds the `readonly` attribute to the inline asm, which +/// indicates that the syscall does not mutate any memory. macro_rules! syscall_readonly { ($nr:ident) => { $crate::backend::arch::choose::syscall0_readonly($crate::backend::reg::nr( @@ -211,6 +292,7 @@ macro_rules! syscall_readonly { }; } +/// Like `syscall`, but indicates that the syscall does not return. #[cfg(feature = "runtime")] macro_rules! syscall_noreturn { ($nr:ident, $a0:expr) => { |