summaryrefslogblamecommitdiffstats
path: root/usr/syscall.c
blob: 0ea57001fb0ef046e617e0a83d899559369b469a (plain) (tree)






















                                                                  
#include "syscall.h"
#include "mem/memory.h"
#include "io/log.h"

int _syscall_handler_log(struct syscall_log *req)
{
    klogf("Message ptr %#016X\n", req->message);
    if(!mem_check_ptr(req->message)) return -1;
    klogf("%s", req->message);
    return 0;
}

void *_syscall_handlers[SYSCALL_COUNT] = {
    _syscall_handler_log
};

int
syscall_handler(syscall_t *req)
{
    if(!mem_check_ptr(req)) return -1;
    if(req->id >= SYSCALL_COUNT) return -1;
    return ((syscall_handler_t)(_syscall_handlers[req->id]))(req);
}