diff --git a/.gitignore b/.gitignore index dadc007..554e514 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .build* /build* /tools/qemu.mk +/tools/remote.mk diff --git a/arch/core_interrupt.h b/arch/core_interrupt.h index c71c662..5ab26ab 100644 --- a/arch/core_interrupt.h +++ b/arch/core_interrupt.h @@ -28,7 +28,7 @@ constexpr uintptr_t FLAG_ENABLE = 1 << 9; * * \see [ISDMv3, 6.15 Exception and Interrupt * Reference](intel_manual_vol3.pdf#page=203) - * \todo(12) Add Keyboard and Panic vector numbers + * \todo */ enum Vector { // Predefined Exceptions @@ -67,6 +67,8 @@ enum Vector { SECURITY_EXCEPTION = 31, // Interrupts + Keyboard=32, + PANIC=33 }; constexpr size_t VECTORS = 256; diff --git a/interrupt/handlers.asm b/interrupt/handlers.asm index 1a2f059..3207c0c 100644 --- a/interrupt/handlers.asm +++ b/interrupt/handlers.asm @@ -11,4 +11,27 @@ handle_keyboard_asm: ; continue. The C++ compiler will only generates code to preserve ; non-scratch registers in the high-level interrupt handler -- the scratch ; registers have to be saved (and restored later) manually! - ; TODO(12): Implement the context save and restore for the keyboard interrupt + ; TODO: Implement the context save and restore for the keyboard interrupt + ; + ; + push rax; + push rdi; + push rsi; + push rdx; + push rcx; + push r8; + push r9; + push r10; + push r11; + call handle_keyboard; + pop r11; + pop r10; + pop r9; + pop r8; + pop rcx; + pop rdx; + pop rsi; + pop rdi; + pop rax; + + iret ; diff --git a/interrupt/handlers.cc b/interrupt/handlers.cc index 2e33f81..46f47b5 100644 --- a/interrupt/handlers.cc +++ b/interrupt/handlers.cc @@ -68,7 +68,9 @@ enum PAGE_FAULT_ERROR { void handle_keyboard() {} [[gnu::interrupt]] void handle_panic(InterruptContext *context) { - (void)context; + DBG << "Generic KernelPanic triggered"<< endl; + printContext(context); + kernelpanic("Generic Panic Triggerd"); } [[gnu::interrupt]] void handle_timer(InterruptContext *context) { diff --git a/interrupt/handlers.h b/interrupt/handlers.h index 01cb9af..caa5e93 100644 --- a/interrupt/handlers.h +++ b/interrupt/handlers.h @@ -82,7 +82,7 @@ void handle_keyboard(); /*! \brief handle_panic * - * \todo(12) Trigger a kernel panic + * \todo Trigger a kernel panic */ [[gnu::interrupt]] void handle_panic(InterruptContext *context);