41 lines
844 B
C
41 lines
844 B
C
#include <mango/machine/cpu.h>
|
|
#include <mango/printk.h>
|
|
#include <mango/syscall.h>
|
|
|
|
kern_status_t sys_exit(int status)
|
|
{
|
|
printk("sys_exit(%d)", status);
|
|
while (1) {
|
|
ml_cpu_pause();
|
|
}
|
|
return KERN_UNIMPLEMENTED;
|
|
}
|
|
|
|
kern_status_t sys_vm_object_create(
|
|
const char *name,
|
|
size_t len,
|
|
enum vm_prot prot,
|
|
kern_handle_t *out_handle)
|
|
{
|
|
printk("sys_vm_object_create()");
|
|
return KERN_UNIMPLEMENTED;
|
|
}
|
|
|
|
#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_func(unsigned int sysid)
|
|
{
|
|
if (sysid >= syscall_table_count) {
|
|
return 0;
|
|
}
|
|
|
|
return syscall_table[sysid];
|
|
}
|