From 1ab61e6bb20dd39f85fca30c1d0a83db12fea9d6 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 28 Feb 2024 17:48:25 +0100 Subject: HCoreKrnl: Fix IDT, will get the rt_handle_interrupts right, and not corrupt the registers, see below. - New register layout in Stackframe. - Thinking about a way to wrap this handler into a valid win64 call. Signed-off-by: Amlal El Mahrouss --- Private/HALKit/AMD64/HalCoreInterruptHandler.cpp | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'Private/HALKit/AMD64/HalCoreInterruptHandler.cpp') diff --git a/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp b/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp index 2acfc454..9f2e37d8 100644 --- a/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp +++ b/Private/HALKit/AMD64/HalCoreInterruptHandler.cpp @@ -50,22 +50,24 @@ static const char* kExceptionMessages[32] = { #define kKernelSyscallInterrupt (0x21) EXTERN_C { + HCore::Void rt_handle_interrupts( + HCore::HAL::StackFramePtr stack) { + switch (stack->IntNum) { + case kKernelSyscallInterrupt: { + HCore::kcout << "HCoreKrnl: System call raised, checking.." + << HCore::end_line(); + rt_syscall_handle(nullptr); + break; + } -HCore::UIntPtr rt_handle_interrupts(HCore::HAL::StackFramePtr sf) { - MUST_PASS(sf); + default: + break; + } - if (sf->IntNum < 32) { - } else if (sf->IntNum == 0x21) { - rt_syscall_handle(sf); - } + if ((stack->IntNum - 32) >= 12) { + HCore::HAL::Out8(0xA0, 0x20); + } - if ((sf->IntNum - 32) >= 12) { - HCore::HAL::Out8(0xA0, 0x20); + HCore::HAL::Out8(0x20, 0x20); } - - HCore::HAL::Out8(0x20, 0x20); - - return (HCore::UIntPtr)sf; -} - } \ No newline at end of file -- cgit v1.2.3