feature: start to implements isrs

This commit is contained in:
2024-10-01 20:24:33 +02:00
parent 5fe4d12c12
commit 64a3f6ee0d
6 changed files with 167 additions and 5 deletions

77
src/interrupt/handler.c Normal file
View File

@ -0,0 +1,77 @@
#include "interrupts.h"
#include "kprintf.h"
#include <stdint.h>
void exception_handler(void)
{
int8_t index = -1;
__asm__ volatile("movb %%al, %0" ::"m"(index));
kprintf(KERN_CRIT "interrupt: ");
switch (index) {
case 0:
kprintf(KERN_CRIT "division by zero");
break;
case 1:
kprintf(KERN_CRIT "debugger");
break;
case 2:
kprintf(KERN_CRIT "NMI");
break;
case 3:
kprintf(KERN_CRIT "breakpoint");
break;
case 4:
kprintf(KERN_CRIT "overflow");
break;
case 5:
kprintf(KERN_CRIT "bounds");
break;
case 6:
kprintf(KERN_CRIT "invalid opcode");
break;
case 7:
kprintf(KERN_CRIT "coprocessor not available");
break;
case 8:
kprintf(KERN_CRIT "double fault");
break;
case 9:
kprintf(KERN_CRIT "coprocessor segement overrun");
break;
case 10:
kprintf(KERN_CRIT "invalid task state segment");
break;
case 11:
kprintf(KERN_CRIT "segment not present");
break;
case 12:
kprintf(KERN_CRIT "stack fault");
break;
case 13:
kprintf(KERN_CRIT "general protection fault");
break;
case 14:
kprintf(KERN_CRIT "page fault");
break;
case 15:
kprintf(KERN_CRIT "reserved");
break;
case 16:
kprintf(KERN_CRIT "math fault");
break;
case 17:
kprintf(KERN_CRIT "alignment check");
break;
case 18:
kprintf(KERN_CRIT "machine check");
break;
case 19:
kprintf(KERN_CRIT "SIMD floating point exception");
break;
default:
break;
}
kprintf(KERN_CRIT "\n");
}