Files
mango/syscall/dispatch.c
Max Wash 6019c9307d kernel: separate headers into kernel and user headers
all kernel headers have been moved from include/mango to include/kernel
and include definitions that are only relevant to kernel-space.

any definitions that are relevant to both kernel- and user-space
(i.e. type definitions, syscall IDs) have been moved to
include/mango within libmango.
2026-02-19 18:54:48 +00:00

22 lines
532 B
C

#include <kernel/machine/cpu.h>
#include <kernel/printk.h>
#include <kernel/syscall.h>
#define SYSCALL_TABLE_ENTRY(id, p) [SYS_##id] = (virt_addr_t)(sys_##p)
static const virt_addr_t syscall_table[] = {
SYSCALL_TABLE_ENTRY(EXIT, exit),
SYSCALL_TABLE_ENTRY(VM_OBJECT_CREATE, vm_object_create),
};
static const size_t syscall_table_count
= sizeof syscall_table / sizeof syscall_table[0];
virt_addr_t syscall_get_function(unsigned int sysid)
{
if (sysid >= syscall_table_count) {
return 0;
}
return syscall_table[sysid];
}