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/HalCoreSyscallHandlerAMD64.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp') diff --git a/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp b/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp index 3a3b49b3..24eee910 100644 --- a/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreSyscallHandlerAMD64.cpp @@ -16,8 +16,10 @@ typedef HCore::Void (*rt_syscall_proc)(HCore::Int32 id, HCore::HAL::StackFramePt HCore::Array kSyscalls; /// @brief Interrupt system call handler. -extern "C" void rt_syscall_handle(HCore::HAL::StackFramePtr stack) { - if (stack->R15 < kKernelMaxSystemCalls && kSyscalls[stack->R15] != 0) { - (kSyscalls[stack->R15].Leak().Leak())(stack->R15, stack); +EXTERN_C void rt_syscall_handle(HCore::HAL::StackFramePtr stack) { + if (!stack) return; + + if (stack->Rcx < kKernelMaxSystemCalls && kSyscalls[stack->Rcx] != 0) { + (kSyscalls[stack->Rcx].Leak().Leak())(stack->Rcx, stack); } } -- cgit v1.2.3