Untitled_Kernel/src/interrupt_handlers.c
lordtet 53198515c8 Temporary "default output" global, makefile changes.
Default output variable holds a generic writer, and any output that
isn't really sure where to output to can just output there. Set by the
system early in boot.

Also made some changes to the makefile to support arguments in the "make
run" or "make debug" subset of calls. For now, it's just VGA=1/0 or
SERIAL=1/0 to enable/disable VGA/serial. Defaults are VGA=1, SERIAL=0.
2025-07-04 02:20:31 -04:00

26 lines
1.2 KiB
C

#include "interrupt_handlers.h"
#include "vga.h"
#include "io.h"
#include "serial.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:
if(default_output){
printf(default_output, "INTERRUPT TRIGGERED! Info below.\n");
printf(default_output, "Int_ID|ERR: %X|%X\n", cpu_state->interrupt_id, cpu_state->error_code);
printf(default_output, "EFLAGS|CS|EIP: %X|%X|%X\n", cpu_state->eflags, cpu_state->cs,cpu_state->eip);
printf(default_output, "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(default_output, "HALT!");
while(1);
}
}
}