Expand description
Strat9-OS syscall dispatcher
Routes syscall numbers to handler functions and converts results to RAX values.
Called from the naked syscall_entry assembly with a pointer to SyscallFrame.
The main dispatch function is __strat9_syscall_dispatch, which matches on
the syscall number and calls the appropriate handler. Each handler returns a
Result<u64, SyscallError>, which is converted to a raw value in RAX.
Handler implementations live in sibling modules (net, volume, ipc_port,
ipc_ring, semaphore, pci, chan, debug, etc.). Only the routing
logic and a handful of capability / process / file-io helpers remain here.
ConstantsΒ§
- HANDLE_
EVENT_ πREADABLE - HANDLE_
EVENT_ πWRITABLE
StaticsΒ§
- SYSCALL_
DIAG_ πDONE - One-shot diagnostic flag to confirm syscalls reach the dispatcher.
- SYSCALL_
TRACE_ πCOUNT - Rate-limit counter for the per-syscall ENTER trace (avoid flooding FORCE_LOCK under SMP). Prints first 20 dispatches unconditionally, then every 10 000.
FunctionsΒ§
- __
strat9_ syscall_ dispatch - Main dispatch function called from
syscall_entryassembly. - cap_
perm_ πbits - Performs the cap perm bits operation.
- dispatch
- Alias used by the
call {dispatch}in syscall_entry. Re-exports__strat9_syscall_dispatchunder the symbol the assembly expects. - insert_
capability_ πwith_ retention - poll_
handle_ πevents - Performs the poll handle events operation.
- resource_
type_ πcode - Performs the resource type code operation.
- sys_
close π - SYS_CLOSE (406): Close a handle (fd).
- sys_dup π
- SYS_DUP (432): Duplicate a file descriptor.
- sys_
dup2 π - SYS_DUP2 (433): Duplicate fd to a specific number.
- sys_
fstat π - SYS_FSTAT (408): Get metadata of an open file.
- sys_
getdents π - SYS_GETDENTS (430): Read directory entries.
- sys_
handle_ πclose - SYS_HANDLE_CLOSE (2): Close a handle. Stub : always succeeds.
- sys_
handle_ πduplicate - SYS_HANDLE_DUPLICATE (1): duplicate a handle (grant required).
- sys_
handle_ πgrant - Performs the sys handle grant operation.
- sys_
handle_ πinfo - Performs the sys handle info operation.
- sys_
handle_ πrevoke - Performs the sys handle revoke operation.
- sys_
handle_ πwait - Performs the sys handle wait operation.
- sys_
lseek π - SYS_LSEEK (407): Seek in a file.
- sys_
null π - SYS_NULL (0): Ping/test syscall. Returns magic value 0x57A79 (βSTRAT9β).
- sys_
open π - SYS_OPEN (403): Open a path from the minimal in-kernel namespace.
- sys_
pipe π - SYS_PIPE (431): Create a pipe pair.
- sys_
proc_ πexit - SYS_PROC_EXIT (300): Exit the current task.
- sys_
proc_ πyield - SYS_PROC_YIELD (301): Yield the current time slice.
- sys_
read π - SYS_READ (405): Read bytes from a handle.
- sys_
sigprocmask π - SYS_SIGPROCMASK (321): Examine and change blocked signals.
- sys_
stat π - SYS_STAT (409): Get metadata by path.
- sys_
uname π - Performs the sys uname operation.
- sys_
write π - SYS_WRITE (404): Write bytes to a file descriptor.