Files
mango/syscall/dispatch.c

22 lines
529 B
C
Raw Normal View History

#include <mango/machine/cpu.h>
#include <mango/printk.h>
#include <mango/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];
}