From 3e097c260dd52b8c0842df769d93d09e093bbc8f Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Mon, 15 Sep 2025 20:52:40 +0200 Subject: [PATCH] Add stubs for C++ exception and purecall handlers --- xtoskrnl/rtl/amd64/exsup.cc | 31 +++++++++++++++++++++++++++++++ xtoskrnl/rtl/i686/exsup.cc | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/xtoskrnl/rtl/amd64/exsup.cc b/xtoskrnl/rtl/amd64/exsup.cc index ecf9f79..ec10900 100644 --- a/xtoskrnl/rtl/amd64/exsup.cc +++ b/xtoskrnl/rtl/amd64/exsup.cc @@ -4,6 +4,7 @@ * FILE: xtoskrnl/rtl/amd64/exsup.cc * DESCRIPTION: Exception handling for AMD64 architecture * DEVELOPERS: Rafal Kupiec + * Aiken Harris */ #include @@ -23,6 +24,24 @@ __C_specific_handler(IN PEXCEPTION_RECORD ExceptionRecord, return ExceptionContinueExecution; } +XTCLINK +XTCDECL +EXCEPTION_DISPOSITION + __CxxFrameHandler3(IN PEXCEPTION_RECORD ExceptionRecord, + IN PVOID EstablisherFrame, + IN OUT PCONTEXT ContextRecord, + IN OUT PVOID DispatcherContext) +{ + UNIMPLEMENTED; + + /* Disable interrupts and hang */ + AR::CpuFunc::ClearInterruptFlag(); + KE::Crash::Panic(0); // CXX_FRAME_HANDLER_CALLED + + /* Continue search */ + return ExceptionContinueSearch; +} + XTCLINK XTCDECL INT @@ -36,3 +55,15 @@ _except_handler3(PEXCEPTION_RECORD ExceptionRecord, /* Handler not found */ return 0; } + +XTCLINK +XTCDECL +VOID +_purecall(VOID) +{ + UNIMPLEMENTED; + + /* Disable interrupts and hang */ + AR::CpuFunc::ClearInterruptFlag(); + KE::Crash::Panic(0); // PURE_VIRTUAL_FUNCTION_CALL +} diff --git a/xtoskrnl/rtl/i686/exsup.cc b/xtoskrnl/rtl/i686/exsup.cc index b9a3b3a..d7827d8 100644 --- a/xtoskrnl/rtl/i686/exsup.cc +++ b/xtoskrnl/rtl/i686/exsup.cc @@ -4,6 +4,7 @@ * FILE: xtoskrnl/rtl/i686/exsup.cc * DESCRIPTION: Exception handling for i686 architecture * DEVELOPERS: Rafal Kupiec + * Aiken Harris */ #include @@ -23,6 +24,24 @@ __C_specific_handler(IN PEXCEPTION_RECORD ExceptionRecord, return ExceptionContinueExecution; } +XTCLINK +XTCDECL +EXCEPTION_DISPOSITION + __CxxFrameHandler3(IN PEXCEPTION_RECORD ExceptionRecord, + IN PVOID EstablisherFrame, + IN OUT PCONTEXT ContextRecord, + IN OUT PVOID DispatcherContext) +{ + UNIMPLEMENTED; + + /* Disable interrupts and hang */ + AR::CpuFunc::ClearInterruptFlag(); + KE::Crash::Panic(0); // CXX_FRAME_HANDLER_CALLED + + /* Continue search */ + return ExceptionContinueSearch; +} + XTCLINK XTCDECL INT @@ -36,3 +55,15 @@ _except_handler3(PEXCEPTION_RECORD ExceptionRecord, /* Handler not found */ return 0; } + +XTCLINK +XTCDECL +VOID +_purecall(VOID) +{ + UNIMPLEMENTED; + + /* Disable interrupts and hang */ + AR::CpuFunc::ClearInterruptFlag(); + KE::Crash::Panic(0); // PURE_VIRTUAL_FUNCTION_CALL +}