aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/syscall/syscall.c
blob: bb32965b137c26a47a38d538564eae7721484aa5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdint.h>
#include <kernel/syscall/syscall.h>
#include <kernel/interrupts/interrupts.h>
#include <kernel/io/io.h>

void syscalls_install()
{
    // 11100111
    idt_set_gate(0x80, (unsigned) idt_syscall, 0x08, 0xEE);
}

uint32_t syscall_handler(uint32_t id, uint32_t arg0, uint32_t arg1, uint32_t arg2)
{
    serial_write("Received syscall!\n");

    switch (id) {
        case 1:
            return sys_write((char *) arg0, arg1);
    }

    return -1;
}