feature: kpanic on interrupts (merdella cmd to test it)
This commit is contained in:
parent
83e513c32f
commit
14758ff4ea
@ -1,5 +1,5 @@
|
||||
#include "interrupts.h"
|
||||
#include "kprintf.h"
|
||||
#include "kpanic.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -8,70 +8,69 @@ void exception_handler(void)
|
||||
int8_t index = -1;
|
||||
__asm__ volatile("movb %%bl, %0" ::"m"(index));
|
||||
|
||||
kprintf(KERN_CRIT "interrupt: ");
|
||||
switch (index) {
|
||||
case 0:
|
||||
kprintf(KERN_CRIT "division by zero");
|
||||
kpanic("interrupt: division by zero\n");
|
||||
break;
|
||||
case 1:
|
||||
kprintf(KERN_CRIT "debugger");
|
||||
kpanic("interrupt: debugger\n");
|
||||
break;
|
||||
case 2:
|
||||
kprintf(KERN_CRIT "NMI");
|
||||
kpanic("interrupt: NMI\n");
|
||||
break;
|
||||
case 3:
|
||||
kprintf(KERN_CRIT "breakpoint");
|
||||
kpanic("interrupt: breakpoint\n");
|
||||
break;
|
||||
case 4:
|
||||
kprintf(KERN_CRIT "overflow");
|
||||
kpanic("interrupt: overflow\n");
|
||||
break;
|
||||
case 5:
|
||||
kprintf(KERN_CRIT "bounds");
|
||||
kpanic("interrupt: bounds\n");
|
||||
break;
|
||||
case 6:
|
||||
kprintf(KERN_CRIT "invalid opcode");
|
||||
kpanic("interrupt: invalid opcode\n");
|
||||
break;
|
||||
case 7:
|
||||
kprintf(KERN_CRIT "coprocessor not available");
|
||||
kpanic("interrupt: coprocessor not available\n");
|
||||
break;
|
||||
case 8:
|
||||
kprintf(KERN_CRIT "double fault");
|
||||
kpanic("interrupt: double fault\n");
|
||||
break;
|
||||
case 9:
|
||||
kprintf(KERN_CRIT "coprocessor segement overrun");
|
||||
kpanic("interrupt: coprocessor segement overrun\n");
|
||||
break;
|
||||
case 10:
|
||||
kprintf(KERN_CRIT "invalid task state segment");
|
||||
kpanic("interrupt: invalid task state segment\n");
|
||||
break;
|
||||
case 11:
|
||||
kprintf(KERN_CRIT "segment not present");
|
||||
kpanic("interrupt: segment not present\n");
|
||||
break;
|
||||
case 12:
|
||||
kprintf(KERN_CRIT "stack fault");
|
||||
kpanic("interrupt: stack fault\n");
|
||||
break;
|
||||
case 13:
|
||||
kprintf(KERN_CRIT "general protection fault");
|
||||
kpanic("interrupt: general protection fault\n");
|
||||
break;
|
||||
case 14:
|
||||
kprintf(KERN_CRIT "page fault");
|
||||
kpanic("interrupt: page fault\n");
|
||||
break;
|
||||
case 15:
|
||||
kprintf(KERN_CRIT "reserved");
|
||||
kpanic("interrupt: reserved\n");
|
||||
break;
|
||||
case 16:
|
||||
kprintf(KERN_CRIT "math fault");
|
||||
kpanic("interrupt: math fault\n");
|
||||
break;
|
||||
case 17:
|
||||
kprintf(KERN_CRIT "alignment check");
|
||||
kpanic("interrupt: alignment check\n");
|
||||
break;
|
||||
case 18:
|
||||
kprintf(KERN_CRIT "machine check");
|
||||
kpanic("interrupt: machine check\n");
|
||||
break;
|
||||
case 19:
|
||||
kprintf(KERN_CRIT "SIMD floating point exception");
|
||||
kpanic("interrupt: SIMD floating point exception\n");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
kprintf(KERN_CRIT "\n");
|
||||
}
|
||||
|
@ -46,4 +46,5 @@ void merdella_cmd(char *arg)
|
||||
{
|
||||
(void)arg;
|
||||
kprintf(POOP);
|
||||
int i = 1 / 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user