From bdcc3d84e08a509a766a469a605a97419ec14c35 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 26 Feb 2024 12:16:25 +0100 Subject: Kernel/Bootloader: add CompilerKit/Version.hxx - Rework BTextWriter class. - Add BVersionString class. - Worked on interrupts almost working! Signed-off-by: Amlal El Mahrouss --- Private/HALKit/AMD64/HalCoreInterruptHandler.cpp | 46 ++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'Private/HALKit/AMD64/HalCoreInterruptHandler.cpp') 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 #include -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(); -- cgit v1.2.3