]> git.corax.cc Git - corax/commitdiff
Add stub code to handle POSIX interrupts in _sys_handle()
authorMatthias Kruk <m@m10k.eu>
Fri, 6 Sep 2019 08:48:54 +0000 (17:48 +0900)
committerMatthias Kruk <m@m10k.eu>
Fri, 6 Sep 2019 08:48:54 +0000 (17:48 +0900)
kernel/arch/interrupt.c

index 05023fdb8895f3b8dfc40e6003d3de7e5118b6f1..ecd0402c4e2dc3ce242c57bb2b3be15c159f3fa5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of the Corax operating system.
- * Copyright (C) 2016 Matthias Kruk
+ * Copyright (C) 2016-2019 Matthias Kruk
  *
  * Corax is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
 
 #include <config.h>
 #include <corax/types.h>
+#include <corax/errno.h>
 #include <debug.h>
 #include "cpu.h"
 #include "defs.h"
@@ -65,17 +66,18 @@ int _int_handle(stack_frame_t ctx)
         extern struct cpu _cpu[CONFIG_SMP_CPUS];
 
         dbg_printf("Keyboard interrupt\n");
+
 #if 0
-        /* hacky reboot: clear IDT entries for
-         * #DF and #GP, then cause a #GP */
-        _cpu[CPU_ID].cpu_idt[EXC_DOUBLEFAULT].sd_low = 0;
-        _cpu[CPU_ID].cpu_idt[EXC_DOUBLEFAULT].sd_high = 0;
-        _cpu[CPU_ID].cpu_idt[EXC_PROTECTION].sd_low = 0;
-        _cpu[CPU_ID].cpu_idt[EXC_PROTECTION].sd_high = 0;
-
-        /* this is such a retarded thing to do, I don't see how this
-         * could not cause a triple fault */
-        asm volatile("ljmp $0x30, $0xfee00020"); /* LEEROY JENKINS!!! */
+               /* hacky reboot: clear IDT entries for
+                * #DF and #GP, then cause a #GP */
+               _cpu[CPU_ID].cpu_idt[EXC_DOUBLEFAULT].sd_low = 0;
+               _cpu[CPU_ID].cpu_idt[EXC_DOUBLEFAULT].sd_high = 0;
+               _cpu[CPU_ID].cpu_idt[EXC_PROTECTION].sd_low = 0;
+               _cpu[CPU_ID].cpu_idt[EXC_PROTECTION].sd_high = 0;
+
+               /* this is such a retarded thing to do, I don't see how this
+                * could not cause a triple fault */
+               asm volatile("ljmp $0x30, $0xfee00020"); /* LEEROY JENKINS!!! */
 #endif
     } else if(ctx.intn != INT_TIMER) {
                dbg_printf("Interrupt %u occurred\n", ctx.intn);
@@ -110,11 +112,21 @@ int _exc_handle(stack_frame_t ctx)
 }
 
 int _sys_handle(stack_frame_t ctx) {
-/*  dbg_printf("Syscall 0x%X occurred.\n", ctx.intn);   */
-/*  dbg_printf("CS = 0x%02x; EIP = 0x%08x; EFLAGS = 0x%08x\n", ctx.cs, ctx.eip, ctx.eflags); */
-/*  PANIC("Unhandled syscall");   */
+       switch(ctx.intn) {
+       case SYS_VECTOR_CORAX:
+               dbg_printf("_corax_call(0x%x, 0x%x, 0x%x);\n", ctx.eax, ctx.ebx, ctx.ecx);
+               break;
+
+#if FEATURE(POSIX)
+       case SYS_VECTOR_POSIX:
+               dbg_printf("_posix_call(0x%x, 0x%x, 0x%x);\n", ctx.eax, ctx.ebx, ctx.ecx);
+               break;
+#endif /* FEATURE(POSIX) */
 
-       dbg_printf("_corax_call(0x%x, 0x%x, 0x%x);\n", ctx.eax, ctx.ebx, ctx.ecx);
+       default:
+               dbg_printf("Unhandled syscall (vec=%u)\n", ctx.intn);
+               break;
+       }
 
     return(0);
 }