/*
* 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
#include <config.h>
#include <corax/types.h>
+#include <corax/errno.h>
#include <debug.h>
#include "cpu.h"
#include "defs.h"
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);
}
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);
}