#include #include #include #include namespace hilbert::kernel::syscall { syscall_handler handlers[256]; void init_syscalls() { for (int i = 0; i < 256; ++i) handlers[i] = 0; } void add_syscall(uint64_t rax, syscall_handler handler) { handlers[rax] = handler; } } using namespace hilbert::kernel::syscall; extern "C" void do_syscall( uint64_t &rax, uint64_t &rdi, uint64_t &rsi, uint64_t &rdx ) { if (rax < 256 && handlers[rax] != 0) handlers[rax](rax, rdi, rsi, rdx); else { rax = 0; rdi = 0; rsi = 0; rdx = 0; } }