ntdll: Use a .seh handler in RtlUserThreadStart on ARM64EC.

This commit is contained in:
Alexandre Julliard 2024-02-27 16:49:42 +01:00
parent 8e26b7e007
commit 631a43c577

View file

@ -1740,17 +1740,25 @@ void WINAPI RtlRaiseException( struct _EXCEPTION_RECORD * rec)
/***********************************************************************
* RtlUserThreadStart (NTDLL.@)
*/
void WINAPI RtlUserThreadStart( PRTL_THREAD_START_ROUTINE entry, void *arg )
void __attribute__((naked)) RtlUserThreadStart( PRTL_THREAD_START_ROUTINE entry, void *arg )
{
__TRY
{
pBaseThreadInitThunk( 0, (LPTHREAD_START_ROUTINE)entry, arg );
}
__EXCEPT(call_unhandled_exception_filter)
{
NtTerminateProcess( GetCurrentProcess(), GetExceptionCode() );
}
__ENDTRY
asm( ".seh_proc RtlUserThreadStart\n\t"
"stp x29, x30, [sp, #-16]!\n\t"
".seh_save_fplr_x 16\n\t"
".seh_endprologue\n\t"
"adrp x11, pBaseThreadInitThunk\n\t"
"ldr x11, [x11, #:lo12:pBaseThreadInitThunk]\n\t"
"adr x10, $iexit_thunk$cdecl$v$i8i8i8\n\t"
"mov x2, x1\n\t"
"mov x1, x0\n\t"
"mov x0, #0\n\t"
"adrp x16, __os_arm64x_dispatch_icall\n\t"
"ldr x16, [x16, #:lo12:__os_arm64x_dispatch_icall]\n\t"
"blr x16\n\t"
"blr x11\n\t"
"brk #1\n\t"
".seh_handler call_unhandled_exception_handler, @except\n\t"
".seh_endproc" );
}