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