Untitled_Kernel/src/interrupt_handlers.c

27 lines
1 KiB
C
Raw Normal View History

#include "interrupt_handlers.h"
#include "vga.h"
#include "io.h"
void generic_isr_handler(StateSnapshot_t* cpu_state) {
//We made it to C for our interrupt! For now, let's just print our interrupt to the screen.
switch(cpu_state->interrupt_id) {
default:
vga_clear();
printf(vga_out, "INTERRUPT TRIGGERED! Info below.\n");
printf(vga_out, "Int_ID|ERR: %X|%X\n", cpu_state->interrupt_id, cpu_state->error_code);
printf(vga_out, "EFLAGS|CS|EIP: %X|%X|%X\n", cpu_state->eflags, cpu_state->cs,cpu_state->eip);
printf(vga_out, "GP Registers:\neax:%X\nebx:%X\necx:%X\nedx:%X\nesp:%X\nebp:%X\nesi:%X\nedi:%X\n",
cpu_state->eax,
cpu_state->ebx,
cpu_state->ecx,
cpu_state->edx,
cpu_state->esp,
cpu_state->ebp,
cpu_state->esi,
cpu_state->edi);
printf(vga_out, "HALT!");
while(1);
}
}