Skip to main content

Module syscall

Module syscall 

Source
Expand description

SYSCALL/SYSRET interface for Strat9-OS

Configures the x86_64 SYSCALL/SYSRET MSRs and provides the naked assembly entry point that bridges Ring 3 → Ring 0 → Rust dispatcher.

§Per-CPU design (SWAPGS + GS-base)

SYSCALL entry uses SWAPGS to switch GS base to a per-CPU block that stores the kernel RSP and temporary user RSP. This enables SMP-safe SYSCALL entry without a global KERNEL_RSP.

§Register convention on SYSCALL entry

CPU sets: RCX = user RIP, R11 = user RFLAGS, IF cleared via FMASK. Userspace passes: RAX = syscall number, RDI/RSI/RDX/R10/R8/R9 = args 1-6.

Functions§

init
Initialize the SYSCALL/SYSRET MSRs.
set_kernel_rsp
Update the kernel RSP used by the SYSCALL entry point.