[VCRUNTIME] Implement _seh_longjmp_unwind

This commit is contained in:
Timo Kreuzer
2025-07-05 14:00:54 +03:00
parent a5448b04c6
commit e8d190a29e
5 changed files with 43 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ list(APPEND SOURCE
add_library(msvcrt20 MODULE ${SOURCE}) add_library(msvcrt20 MODULE ${SOURCE})
set_module_type(msvcrt20 win32dll ENTRYPOINT DllMain 12) set_module_type(msvcrt20 win32dll ENTRYPOINT DllMain 12)
add_dependencies(msvcrt20 psdk) add_dependencies(msvcrt20 psdk)
target_link_libraries(msvcrt20 crt wine ${PSEH_LIB}) target_link_libraries(msvcrt20 crt vcruntime wine ${PSEH_LIB})
if(MSVC) if(MSVC)
# export of deleting destructor "name" # export of deleting destructor "name"

View File

@@ -21,7 +21,7 @@ list(APPEND SOURCE
add_library(msvcrt40 MODULE ${SOURCE}) add_library(msvcrt40 MODULE ${SOURCE})
set_module_type(msvcrt40 win32dll ENTRYPOINT DllMain 12) set_module_type(msvcrt40 win32dll ENTRYPOINT DllMain 12)
add_dependencies(msvcrt40 psdk) add_dependencies(msvcrt40 psdk)
target_link_libraries(msvcrt40 crt wine ${PSEH_LIB}) target_link_libraries(msvcrt40 crt vcruntime wine ${PSEH_LIB})
if(MSVC) if(MSVC)
# export of deleting destructor "name" # export of deleting destructor "name"

View File

@@ -1133,6 +1133,7 @@ void CDECL MSVCRT_longjmp(_JUMP_BUFFER *jmp, int retval)
__wine_longjmp( (__wine_jmp_buf *)jmp, retval ); __wine_longjmp( (__wine_jmp_buf *)jmp, retval );
} }
#ifndef __REACTOS__
/********************************************************************* /*********************************************************************
* _seh_longjmp_unwind (MSVCRT.@) * _seh_longjmp_unwind (MSVCRT.@)
*/ */
@@ -1140,6 +1141,7 @@ void __stdcall _seh_longjmp_unwind(_JUMP_BUFFER *jmp)
{ {
msvcrt_local_unwind2( (MSVCRT_EXCEPTION_FRAME *)jmp->Registration, jmp->TryLevel, (void *)jmp->Ebp ); msvcrt_local_unwind2( (MSVCRT_EXCEPTION_FRAME *)jmp->Registration, jmp->TryLevel, (void *)jmp->Ebp );
} }
#endif
/********************************************************************* /*********************************************************************
* _seh_longjmp_unwind4 (MSVCRT.@) * _seh_longjmp_unwind4 (MSVCRT.@)

View File

@@ -55,6 +55,7 @@ if(${ARCH} STREQUAL "i386")
) )
list(APPEND VCRT_SETJMP_ASM_SOURCES list(APPEND VCRT_SETJMP_ASM_SOURCES
i386/__longjmp_nounwind.s i386/__longjmp_nounwind.s
i386/_seh_longjmp_unwind.s
i386/_setjmp.s i386/_setjmp.s
i386/_setjmp3.s i386/_setjmp3.s
) )

View File

@@ -0,0 +1,38 @@
/*
* PROJECT: ReactOS vcruntime library
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Implementation of _seh_longjmp_unwind sor x86
* COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <asm.inc>
#include <ks386.inc>
EXTERN __local_unwind2:PROC
.code
//
// void __stdcall _seh_longjmp_unwind(_JUMP_BUFFER* _Buf);
//
PUBLIC __seh_longjmp_unwind@4
__seh_longjmp_unwind@4:
// Save ebp
push ebp
// Load the jump buffer address into eax
mov eax, [esp + 8]
// Call _local_unwind2 to run the termination handlers
push dword ptr [eax + JbTryLevel] // _Buf->TryLevel
push dword ptr [eax + JbRegistration] // _Buf->Registration
mov ebp, [eax + JbEbp] // _Buf->Ebp
call __local_unwind2
// Clean up the stack and restore ebp
add esp, 8
pop ebp
ret 4
END