From d3c8dd45c7ee78e047d229e8c36e78b757065e4f Mon Sep 17 00:00:00 2001 From: Curle Date: Tue, 20 Aug 2019 16:41:50 +0100 Subject: [PATCH] Enable all serial debugging outputs in the interrupt handlers. Serial should be working now, but i can never trust things to work first time. --- kernel/interrupts.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/kernel/interrupts.c b/kernel/interrupts.c index 7ba2541..c40a873 100644 --- a/kernel/interrupts.c +++ b/kernel/interrupts.c @@ -34,11 +34,13 @@ #include -#ifdef __x86_64__ typedef unsigned long long int uword_t; -#else -typedef unsigned int uword_t; -#endif + + +static void* IRQ_Handlers[16] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; /* All of the ISR routines call this function for now. @@ -48,11 +50,10 @@ typedef unsigned int uword_t; void ISR_Common(INTERRUPT_FRAME* Frame, size_t Exception) { /* Only the first 32 ISR/IRQs are reserved for exceptions by the CPU. We can handle up to 512 interrupts total, though. */ if(Exception < 32) { - /* exception_messages is an array of c-strings defined in kernel.h */ - // TODO: Serial! + /* ExceptionStrings is an array of c-strings defined in kernel.h */ - //serial_print(0x3F8, exception_messages[Exception]); - //serial_print(0x3F8, " Exception.\r\n"); + serial_print(ExceptionStrings[Exception]); + serial_print(" Exception.\r\n"); printf("%s exception!", ExceptionStrings[Exception]); panic(); } @@ -62,8 +63,8 @@ void ISR_Common(INTERRUPT_FRAME* Frame, size_t Exception) { into what went wrong. In pure Curle style, though, we just ignore the error code. */ void ISR_Error_Common(EXCEPTION_FRAME* Frame, size_t Exception) { if(Exception < 32) { - //serial_print(0x3F8, ExceptionStrings[Exception]); - //serial_printf(0x3F8, " Exception. Context given: %d\r\n", Frame->ErrorCode); + serial_print(ExceptionStrings[Exception]); + serial_printf(" Exception. Context given: %d\r\n", Frame->ErrorCode); printf("%s exception. Context: %x", ExceptionStrings[Exception], Frame->ErrorCode); panic(); }