Skip to main content

do_syscall

Function do_syscall 

Source
pub unsafe extern "C" fn do_syscall(
    ssn: u16,
    syscall_addr: usize,
    n_args: u32,
    ...
) -> *mut c_void
Available on x86-64 only.
Expand description

Hell’s Hall variadic syscall dispatcher.

Returns the raw NTSTATUS that landed in rax after the kernel transition, encoded as a pointer-width value so callers can route it through the uniform *mut c_void flow that the syscall!, do_syscall!, spoof!, and spoof_syscall! macros share. .unwrap() as i32 or (... as usize) as i32 recovers the 32-bit NTSTATUS.

§Safety

syscall_addr must point at a valid syscall instruction inside ntdll (use crate::resolve_syscall). n_args must match the number of variadic args that follow. The macros cast every arg as usize and then transmute to *mut c_void, so each slot is a uniform 64-bit pointer-width value at the call site. Calling this function directly bypasses those casts; passing a 32-bit literal without widening it first lands garbage in the upper bits.