diff options
author | Marvin Borner | 2019-12-04 20:38:10 +0100 |
---|---|---|
committer | Marvin Borner | 2019-12-04 20:38:10 +0100 |
commit | ed3da12bb378d82878fff1d50e5e9e7af3d7265d (patch) | |
tree | 53200ca859511e5464bfd50923a3229590997607 /src/kernel/syscall/syscall.c | |
parent | e9407b091b34d93014b89660601da62f13df37aa (diff) |
More-working syscall logic (parameters work!)
Diffstat (limited to 'src/kernel/syscall/syscall.c')
-rw-r--r-- | src/kernel/syscall/syscall.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c index bb32965..08b4d49 100644 --- a/src/kernel/syscall/syscall.c +++ b/src/kernel/syscall/syscall.c @@ -3,20 +3,19 @@ #include <kernel/interrupts/interrupts.h> #include <kernel/io/io.h> -void syscalls_install() -{ - // 11100111 - idt_set_gate(0x80, (unsigned) idt_syscall, 0x08, 0xEE); -} +typedef uint32_t (*syscall_func)(unsigned int, ...); -uint32_t syscall_handler(uint32_t id, uint32_t arg0, uint32_t arg1, uint32_t arg2) +void syscall_handler(struct regs *r) { serial_write("Received syscall!\n"); + serial_write_dec(r->eax); + serial_write("\n"); + serial_write_dec(r->ecx); + syscall_func location = (syscall_func) sys_write; + location(r->ebx, r->ecx, r->edx, r->esi, r->edi); +} - switch (id) { - case 1: - return sys_write((char *) arg0, arg1); - } - - return -1; +void syscalls_install() +{ + isr_install_handler(0x80, syscall_handler); }
\ No newline at end of file |