Skip to content

Commit

Permalink
Exceptions now cause panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Kfeavel committed Nov 16, 2019
1 parent fcb1296 commit db8febb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/arch/i386/isr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ void px_isr_install() {
}

extern "C" void px_isr_handler(registers_t r) {
/*
kprint("Interrupt: ");
char s[4];
itoa(r.int_num, s);
kprint(s);
kprint("\n");
kprint(px_exception_descriptions[r.int_num]);
kprint("\n");
*/
panic(r.int_num);
}

extern "C" void px_register_interrupt_handler(uint8_t n, isr_t handler) {
Expand Down
3 changes: 3 additions & 0 deletions kernel/sys/panic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ void panic(int exception) {
panicCode[22] = hex[(exception >> 4) & 0xF];
panicCode[23] = hex[exception & 0xF];
// Print the code and associated error name
kprintSetColor(Red, White);
kprint("\nEXCEPTION CAUGHT IN KERNEL MODE!\n");
kprintSetColor(Black, White);
kprint(panicCode);
kprint(px_exception_descriptions[exception]);
// Halt the CPU
Expand Down

0 comments on commit db8febb

Please sign in to comment.