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 | |
parent | e9407b091b34d93014b89660601da62f13df37aa (diff) |
More-working syscall logic (parameters work!)
Diffstat (limited to 'src/kernel/syscall')
-rw-r--r-- | src/kernel/syscall/actions/sys_write.c | 9 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.c | 23 | ||||
-rw-r--r-- | src/kernel/syscall/syscall.h | 4 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/kernel/syscall/actions/sys_write.c b/src/kernel/syscall/actions/sys_write.c index fceaaab..19c35fa 100644 --- a/src/kernel/syscall/actions/sys_write.c +++ b/src/kernel/syscall/actions/sys_write.c @@ -2,10 +2,11 @@ #include <mlibc/stdio.h> #include <kernel/io/io.h> -uint32_t sys_write(char *buf, uint32_t count) +uint32_t sys_write(unsigned int buf, unsigned int count) { - serial_write("WRITE"); - for (uint32_t i = 0; i < count; i++) - writec(*(buf++)); + serial_write("\n"); + serial_write_dec(count); + serial_write("WRITE: \n"); + serial_write((const char *) buf); return count; }
\ No newline at end of file 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 diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h index 304008d..8730dbf 100644 --- a/src/kernel/syscall/syscall.h +++ b/src/kernel/syscall/syscall.h @@ -5,6 +5,6 @@ extern void idt_syscall(); void syscalls_install(); -uint32_t sys_write(char *buf, uint32_t count); +uint32_t sys_write(unsigned int buf, unsigned int count); -#endif +#endif
\ No newline at end of file |