danos/sbin
Daniel Samson 5d57e7b01c
M3 step 3: syscall/sysret fast path
Per-core MSR setup (EFER.SCE, STAR, LSTAR, SFMASK) enables syscall; the
GDT layout was already chosen so sysret lands on CS 0x23 / SS 0x1B. A new
syscall_entry stub swaps in the kernel GS, switches to the task's kernel
stack via the per-CPU block, builds a CpuState frame identical to the
interrupt path's, and reuses interruptDispatch (vector 128) — then
sysretq back. enter_user now also publishes kernel_rsp so the borrowed
path's syscalls land on a good stack. /sbin/init uses the `syscall`
instruction. int 0x80 stays for the test blobs. Suite 27/27.

(Noted in the stub: sysretq #GPs in ring 0 on a non-canonical return
RIP — a hardening item once untrusted user code exists.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 23:17:31 +01:00
..
init.zig M3 step 3: syscall/sysret fast path 2026-07-08 23:17:31 +01:00
linker.ld isolation M1: ring 3 + a real /sbin/init, end to end 2026-07-08 22:15:07 +01:00