x86::syscall [] [src]

macro_rules! syscall {
    ($arg0:expr) => { ... };
    ($arg0:expr, $arg1:expr) => { ... };
    ($arg0:expr, $arg1:expr, $arg2:expr) => { ... };
    ($arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr) => { ... };
    ($arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr) => { ... };
    ($arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr, $arg5:expr) => { ... };
    ($arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr, $arg5:expr, $arg6:expr) => { ... };
    ($arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr, $arg5:expr, $arg6:expr, $arg7:expr) => { ... };
}

It does so by loading RIP from the IA32_LSTAR MSR (after saving the address of the instruction following SYSCALL into RCX).

"A.2 AMD64 Linux Kernel Conventions" of System V Application Binary Interface AMD64 Architecture Processor Supplement:

This code is inspired by the syscall.rs (https://github.com/kmcallister/syscall.rs/) project.