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> |
||
|---|---|---|
| .. | ||
| init.zig | ||
| linker.ld | ||