summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-26 12:16:25 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-26 12:16:25 +0100
commitbdcc3d84e08a509a766a469a605a97419ec14c35 (patch)
tree1b3a365581b37a7f0246629be6256f521daeae4e /Private/HALKit/AMD64/HalCoreInterruptHandler.cpp
parent91c88797f7fa9dbb6cce12c14928a6fbd97d51b6 (diff)
Kernel/Bootloader: add CompilerKit/Version.hxx
- Rework BTextWriter class. - Add BVersionString class. - Worked on interrupts almost working! Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit/AMD64/HalCoreInterruptHandler.cpp')
-rw-r--r--Private/HALKit/AMD64/HalCoreInterruptHandler.cpp46
1 files changed, 43 insertions, 3 deletions
diff --git a/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp b/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp
index 1e46e5af..b161f1db 100644
--- a/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp
+++ b/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp
@@ -11,7 +11,42 @@
#include <KernelKit/ProcessManager.hpp>
#include <NewKit/String.hpp>
-extern "C" HCore::UIntPtr rt_handle_interrupts(HCore::UIntPtr &rsp) {
+static const char* kExceptionMessage[32] = {
+ "Division by zero",
+ "Debug Breakpoint",
+ "Non-maskable interrupt",
+ "Breakpoint",
+ "Detected overflow",
+ "Out-of-bounds",
+ "Invalid opcode",
+ "No coprocessor",
+ "Double fault",
+ "Coprocessor segment overrun",
+ "Bad TSS",
+ "Segment not found",
+ "Stack error.",
+ "General Protection Fault",
+ "Page Fault",
+ "Invalid interrupt",
+ "Coprocessor fault",
+ "Alignment check",
+ "Machine check",
+ "Reserved",
+ "Reserved",
+ "System Process Switch Issued",
+ "System was interrupted by kernel",
+ "System hang by kernel",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+};
+
+extern "C" HCore::UIntPtr rt_handle_interrupts(HCore::UIntPtr& rsp) {
HCore::HAL::rt_cli();
HCore::HAL::StackFramePtr sf = (HCore::HAL::StackFramePtr)rsp;
@@ -20,8 +55,13 @@ extern "C" HCore::UIntPtr rt_handle_interrupts(HCore::UIntPtr &rsp) {
rt_syscall_handle(sf);
}
- HCore::HAL::Out8(0x20, 0x20);
- HCore::HAL::Out8(0xa0, 0x20);
+ if (sf->IntNum < 32) {
+ HCore::kcout << "Exception:" << kExceptionMessage[sf->IntNum] << "\n";
+ }
+
+ if (sf->IntNum >= 40) HCore::HAL::Out8(0x20, 0x20); // ACK MASTER
+
+ HCore::HAL::Out8(0xA0, 0x20); // ACK SLAVE
HCore::HAL::rt_sti();