From 606774e6b0e0a2d36139983b85c8675b2228a9ff Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 13 Mar 2021 00:38:36 +0100 Subject: Fixed test suite --- kernel/features/syscall.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'kernel') diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 486da6c..31cdf5f 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -86,9 +86,32 @@ static void syscall_handler(struct regs *r) break; } case SYS_EXIT: { + print("EXIT!\n"); proc_exit(proc_current(), (int)r->ebx); break; } + case SYS_BOOT: { // TODO: Move + if (r->ebx != SYS_BOOT_MAGIC || !proc_super()) { + r->eax = -1; + break; + } + switch (r->ecx) { + case SYS_BOOT_REBOOT: + print("Rebooting...\n"); + __asm__ volatile("ud2"); + break; + case SYS_BOOT_SHUTDOWN: + print("Shutting down...\n"); + outw(0xB004, 0x2000); + outw(0x604, 0x2000); + outw(0x4004, 0x3400); + __asm__ volatile("ud2"); + break; + default: + r->eax = -1; + } + break; + } case SYS_YIELD: { proc_yield(r); break; @@ -130,7 +153,7 @@ static void syscall_handler(struct regs *r) break; } default: { - print("Unknown syscall!\n"); + printf("Unknown syscall %d!\n", num); break; } } -- cgit v1.2.3