From 6534b4660c0b2675ac3447fa2c0892fbb410b75f Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 May 2025 16:32:32 +0200 Subject: [PATCH 1/4] mini changes --- .gitignore | 1 + device/ps2controller.cc | 2 +- tools/remote.mk | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) 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/device/ps2controller.cc b/device/ps2controller.cc index f29638f..36a543b 100644 --- a/device/ps2controller.cc +++ b/device/ps2controller.cc @@ -119,7 +119,7 @@ bool fetch(Key &pressed) { pressed = key_decoder.decode(out_buffer); - if (pressed.alt() || pressed.ctrl() || pressed.shift || !pressed.valid()) + if (pressed.alt() || pressed.ctrl() || !pressed.valid()) return false; else return true; diff --git a/tools/remote.mk b/tools/remote.mk index 0733bd1..7945dcf 100644 --- a/tools/remote.mk +++ b/tools/remote.mk @@ -1,7 +1,7 @@ # Test your system on real hardware NETBOOT_LOCAL="/ibr/adm/user-boot/" -NETBOOT_HOST="x1.ibr.cs.tu-bs.de" +NETBOOT_HOST="y0080589@x1.ibr.cs.tu-bs.de" # The boot menu shows pairs of `vmlinuz-*` + `initrd-*.img` with owning user and timestamp. # We just need to choose a name that doesn't overlap with another user's. From 55c23fb293e5b149a63999ba075f5d644721a543 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 May 2025 17:04:11 +0200 Subject: [PATCH 2/4] added the user defined interrupt --- arch/core_interrupt.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; From 6d5f48e1549c2f0d83810f7859fd01bbc2d968f3 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 May 2025 17:27:51 +0200 Subject: [PATCH 3/4] handle panic now triggers a panic --- interrupt/handlers.cc | 4 +++- interrupt/handlers.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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); From 35765897c4e15a6d5154389a12e801264cfe605e Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 May 2025 17:53:45 +0200 Subject: [PATCH 4/4] handler asm code for saving the volatile registers created --- interrupt/handlers.asm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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 ;