From ed534340ae68d2defdcf4df68062cd3344b33d37 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 26 Apr 2019 10:36:40 +0200 Subject: [PATCH] enhancing IDT --- ProjectTree | 4 +--- kaleid/kernel/cpu/idt.c | 6 +++--- kaleid/kernel/cpu/isr.asm | 1 + kaleid/kernel/init/init.c | 12 ++++++++++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ProjectTree b/ProjectTree index 0b70494..34b504c 100644 --- a/ProjectTree +++ b/ProjectTree @@ -98,8 +98,6 @@ │   │   ├── string.o │   │   └── strtol.o │   ├── grub.log -│   ├── kaleid32_disasm.asm -│   ├── kaleid64_disasm.asm │   └── kernel.ld ├── include │   ├── base @@ -190,4 +188,4 @@ ├── ProjectTree └── README.md -37 directories, 128 files +37 directories, 126 files diff --git a/kaleid/kernel/cpu/idt.c b/kaleid/kernel/cpu/idt.c index b3f01b3..6f083dd 100644 --- a/kaleid/kernel/cpu/idt.c +++ b/kaleid/kernel/cpu/idt.c @@ -189,14 +189,14 @@ void IoDisableNMI(void) // void IdtHandler(ulong intNo) { - int irrecoverable = 0; + int recoverable = 0; char *exceptionMsg = "Unhandled ISR exception"; - if (intNo == 0 || intNo == 6 || intNo == 8 || intNo == 13) irrecoverable++; + if (intNo >= 32) recoverable++; if (intNo < 32) exceptionMsg = IsrExceptions[intNo]; - if (irrecoverable) { + if (!recoverable) { KeStartPanic("[ISR 0x%x] Irrecoverable %s\n", intNo, exceptionMsg); } else { bprintf(BStdOut, "[ISR 0x%x] %s\n", intNo, exceptionMsg); diff --git a/kaleid/kernel/cpu/isr.asm b/kaleid/kernel/cpu/isr.asm index 3633b44..ba4028f 100644 --- a/kaleid/kernel/cpu/isr.asm +++ b/kaleid/kernel/cpu/isr.asm @@ -28,6 +28,7 @@ global IdtInit global divideByZero extern idtPtr extern IdtHandler +extern label0 ;; ;; Loads the IDT diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index c92dc06..b35bb5b 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -100,11 +100,19 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg) /* } */ /* IoPrintRtcTime(); */ /* } */ - long var = -1; - KernLog("salut : %s", var); + int* var = 7*GB; + *var = 2; KernLog("Goodbye after %d ticks\n", IoGetRtcTicks()); // End this machine's suffering BFlushBuf(BStdOut); KeCrashSystem(); } + +void label0(void) +{ + KernLog("Goodbye after %d ticks\n", IoGetRtcTicks()); + // End this machine's suffering + BFlushBuf(BStdOut); + KeCrashSystem(); +}