Skip to main content

Module dispatcher

Module dispatcher 

Source
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_entry assembly.
cap_perm_bits πŸ”’
Performs the cap perm bits operation.
dispatch
Alias used by the call {dispatch} in syscall_entry. Re-exports __strat9_syscall_dispatch under 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.