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 (positive for success, negative for error). The dispatch function is an alias for __strat9_syscall_dispatch used by the assembly entry point. The syscall handlers are defined in this module and in submodules (e.g. mmap, process, signal, etc.) and cover a wide range of functionality including process management, memory management, IPC, file I/O, networking, and more. The dispatcher also includes diagnostic logging with rate-limiting to avoid log spam under high syscall rates. For example, it logs the first 20 syscalls unconditionally, then every 10,000 syscalls thereafter. It also has budgeted logging for network send/recv errors and DHCP frame tracing.

Functionsยง

__strat9_syscall_dispatch
Main dispatch function called from syscall_entry assembly.
dispatch
Alias used by the call {dispatch} in syscall_entry. Re-exports __strat9_syscall_dispatch under the symbol the assembly expects.
sys_net_info
Performs the sys net info operation.
sys_net_recv
Performs the sys net recv operation.
sys_net_send
Performs the sys net send operation.