diff --git a/bin/shade.bin b/bin/shade.bin index 3d2c531..1178865 100755 Binary files a/bin/shade.bin and b/bin/shade.bin differ diff --git a/bin/shade.iso b/bin/shade.iso index c0efe35..90b3520 100644 Binary files a/bin/shade.iso and b/bin/shade.iso differ diff --git a/include/shade/platform/interrupts/isr.h b/include/shade/platform/interrupts/isr.h index 1f341d8..b8309fb 100644 --- a/include/shade/platform/interrupts/isr.h +++ b/include/shade/platform/interrupts/isr.h @@ -9,33 +9,53 @@ static int err_count = 0; typedef struct { struct { - uint64_t cr4; - uint64_t cr3; - uint64_t cr2; - uint64_t cr0; - } control_registers; + uint64_t resv0; + uint64_t resv1; + uint64_t resv2; + uint64_t resv3; + } broken; struct { - uint64_t rdi; - uint64_t rsi; - uint64_t rdx; - uint64_t rcx; - uint64_t rbx; - uint64_t rax; - } general_registers; + uint64_t resv0; + uint64_t resv1; + uint64_t resv2; + uint64_t resv3; + uint64_t resv4; + uint64_t resv5; + } broken_2; struct { - uint64_t rbp; - uint64_t vector; + uint64_t resv0; uint64_t error_code; - uint64_t rip; - uint64_t cs; - uint64_t rflags; - uint64_t rsp; - uint64_t dss; + uint64_t resv1; + uint64_t vector; + uint64_t resv2; + uint64_t resv3; + uint64_t resv4; + uint64_t resv5; } base_frame; } isr_xframe_t; +/* +List of pushed things in order: +error_code +vector +rbp +rax +rbx +rcx +rdx +rsi +rdi +cr0 +cr2 +cr3 +cr4 +ds +0 + +*/ + __attribute__((noreturn)) void exception_handler(isr_xframe_t frame); diff --git a/src/kernel/platform/interrupts/int.asm b/src/kernel/platform/interrupts/int.asm index e7485c8..624dc1e 100644 --- a/src/kernel/platform/interrupts/int.asm +++ b/src/kernel/platform/interrupts/int.asm @@ -74,6 +74,7 @@ isr_xframe_assembler: mov ss, ax lea rdi, [rsp + 0x10] + call exception_handler pop rax diff --git a/src/kernel/platform/interrupts/isr.c b/src/kernel/platform/interrupts/isr.c index 0b26405..c6517ce 100644 --- a/src/kernel/platform/interrupts/isr.c +++ b/src/kernel/platform/interrupts/isr.c @@ -2,7 +2,6 @@ #include void exception_handler(isr_xframe_t frame) { - err_count++; char s[256]; itoa(err_count, s); print_str(" "); @@ -10,13 +9,11 @@ void exception_handler(isr_xframe_t frame) { print_str(": cpu: check_exception "); itoa(frame.base_frame.vector, s); print_str(s); - print_str(" @ "); - itoa(frame.base_frame.rip, s); - print_str(s); print_str(" err_code => "); itoa(frame.base_frame.error_code, s); print_str(s); print_str("\n"); + err_count++; if (err_count > ERR_MAX) { print_str("cpu: ierr hit err_max, halt"); __asm__ __volatile__("cli; hlt"); diff --git a/src/kernel/platform/ports.c b/src/kernel/platform/ports.c index 9e061fe..92bc592 100644 --- a/src/kernel/platform/ports.c +++ b/src/kernel/platform/ports.c @@ -1,3 +1,5 @@ +#include + /* * Read 1 byte from specified port */