mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 17:47:16 +00:00
ntdll: Move RtlUserThreadStart implementation to the CPU backends.
This commit is contained in:
parent
bf2b38a805
commit
943e16def6
|
@ -279,6 +279,27 @@ LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr )
|
|||
return unhandled_exception_filter( eptr );
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* call_unhandled_exception_handler
|
||||
*/
|
||||
EXCEPTION_DISPOSITION WINAPI call_unhandled_exception_handler( EXCEPTION_RECORD *rec, void *frame,
|
||||
CONTEXT *context, void *dispatch )
|
||||
{
|
||||
EXCEPTION_POINTERS ep = { rec, context };
|
||||
|
||||
switch (call_unhandled_exception_filter( &ep ))
|
||||
{
|
||||
case EXCEPTION_CONTINUE_SEARCH:
|
||||
return ExceptionContinueSearch;
|
||||
case EXCEPTION_CONTINUE_EXECUTION:
|
||||
return ExceptionContinueExecution;
|
||||
case EXCEPTION_EXECUTE_HANDLER:
|
||||
break;
|
||||
}
|
||||
NtTerminateProcess( GetCurrentProcess(), rec->ExceptionCode );
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
||||
|
||||
|
|
|
@ -1488,6 +1488,22 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RtlUserThreadStart (NTDLL.@)
|
||||
*/
|
||||
void WINAPI 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
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* LdrInitializeThunk (NTDLL.@)
|
||||
*/
|
||||
|
|
|
@ -1525,6 +1525,22 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RtlUserThreadStart (NTDLL.@)
|
||||
*/
|
||||
void WINAPI 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
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* LdrInitializeThunk (NTDLL.@)
|
||||
*/
|
||||
|
|
|
@ -535,6 +535,43 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RtlUserThreadStart (NTDLL.@)
|
||||
*/
|
||||
__ASM_STDCALL_FUNC( RtlUserThreadStart, 8,
|
||||
"movl %ebx,8(%esp)\n\t" /* arg */
|
||||
"movl %eax,4(%esp)\n\t" /* entry */
|
||||
"jmp " __ASM_NAME("call_thread_func") )
|
||||
|
||||
/* wrapper to call BaseThreadInitThunk */
|
||||
extern void DECLSPEC_NORETURN call_thread_func_wrapper( void *thunk, PRTL_THREAD_START_ROUTINE entry, void *arg );
|
||||
__ASM_GLOBAL_FUNC( call_thread_func_wrapper,
|
||||
"pushl %ebp\n\t"
|
||||
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
|
||||
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
|
||||
"movl %esp,%ebp\n\t"
|
||||
__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
|
||||
"subl $4,%esp\n\t"
|
||||
"andl $~0xf,%esp\n\t"
|
||||
"xorl %ecx,%ecx\n\t"
|
||||
"movl 12(%ebp),%edx\n\t"
|
||||
"movl 16(%ebp),%eax\n\t"
|
||||
"movl %eax,(%esp)\n\t"
|
||||
"call *8(%ebp)" )
|
||||
|
||||
void DECLSPEC_HIDDEN call_thread_func( PRTL_THREAD_START_ROUTINE entry, void *arg )
|
||||
{
|
||||
__TRY
|
||||
{
|
||||
call_thread_func_wrapper( pBaseThreadInitThunk, entry, arg );
|
||||
}
|
||||
__EXCEPT(call_unhandled_exception_filter)
|
||||
{
|
||||
NtTerminateProcess( GetCurrentProcess(), GetExceptionCode() );
|
||||
}
|
||||
__ENDTRY
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* signal_start_thread
|
||||
*/
|
||||
|
|
|
@ -1588,6 +1588,37 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RtlUserThreadStart (NTDLL.@)
|
||||
*/
|
||||
#ifdef __ASM_SEH_SUPPORTED
|
||||
__ASM_GLOBAL_FUNC( RtlUserThreadStart,
|
||||
"subq $0x28,%rsp\n\t"
|
||||
".seh_stackalloc 0x28\n\t"
|
||||
".seh_endprologue\n\t"
|
||||
"movq %rdx,%r8\n\t"
|
||||
"movq %rcx,%rdx\n\t"
|
||||
"xorq %rcx,%rcx\n\t"
|
||||
"movq " __ASM_NAME( "pBaseThreadInitThunk" ) "(%rip),%r9\n\t"
|
||||
"call *%r9\n\t"
|
||||
"int3\n\t"
|
||||
".seh_handler " __ASM_NAME("call_unhandled_exception_handler") ", @except" )
|
||||
#else
|
||||
void WINAPI 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
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* signal_start_thread
|
||||
*/
|
||||
|
|
|
@ -246,96 +246,6 @@ void WINAPI RtlExitUserThread( ULONG status )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RtlUserThreadStart (NTDLL.@)
|
||||
*/
|
||||
#ifdef __i386__
|
||||
__ASM_STDCALL_FUNC( RtlUserThreadStart, 8,
|
||||
"movl %ebx,8(%esp)\n\t" /* arg */
|
||||
"movl %eax,4(%esp)\n\t" /* entry */
|
||||
"jmp " __ASM_NAME("call_thread_func") )
|
||||
|
||||
/* wrapper to call BaseThreadInitThunk */
|
||||
extern void DECLSPEC_NORETURN call_thread_func_wrapper( void *thunk, PRTL_THREAD_START_ROUTINE entry, void *arg );
|
||||
__ASM_GLOBAL_FUNC( call_thread_func_wrapper,
|
||||
"pushl %ebp\n\t"
|
||||
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
|
||||
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
|
||||
"movl %esp,%ebp\n\t"
|
||||
__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
|
||||
"subl $4,%esp\n\t"
|
||||
"andl $~0xf,%esp\n\t"
|
||||
"xorl %ecx,%ecx\n\t"
|
||||
"movl 12(%ebp),%edx\n\t"
|
||||
"movl 16(%ebp),%eax\n\t"
|
||||
"movl %eax,(%esp)\n\t"
|
||||
"call *8(%ebp)" )
|
||||
|
||||
void DECLSPEC_HIDDEN call_thread_func( PRTL_THREAD_START_ROUTINE entry, void *arg )
|
||||
{
|
||||
__TRY
|
||||
{
|
||||
call_thread_func_wrapper( pBaseThreadInitThunk, entry, arg );
|
||||
}
|
||||
__EXCEPT(call_unhandled_exception_filter)
|
||||
{
|
||||
NtTerminateProcess( GetCurrentProcess(), GetExceptionCode() );
|
||||
}
|
||||
__ENDTRY
|
||||
}
|
||||
|
||||
#elif /* __i386__ */ defined(__x86_64__) && defined(__ASM_SEH_SUPPORTED)
|
||||
EXCEPTION_DISPOSITION WINAPI call_thread_func_handler( EXCEPTION_RECORD *rec, ULONG64 frame,
|
||||
CONTEXT *context, DISPATCHER_CONTEXT *dispatch )
|
||||
{
|
||||
EXCEPTION_POINTERS ep = { rec, context };
|
||||
|
||||
WARN( "Unhandled exception, calling filter.\n" );
|
||||
|
||||
switch (call_unhandled_exception_filter( &ep ))
|
||||
{
|
||||
case EXCEPTION_CONTINUE_SEARCH:
|
||||
return ExceptionContinueSearch;
|
||||
case EXCEPTION_CONTINUE_EXECUTION:
|
||||
return ExceptionContinueExecution;
|
||||
case EXCEPTION_EXECUTE_HANDLER:
|
||||
break;
|
||||
}
|
||||
NtTerminateProcess( GetCurrentProcess(), rec->ExceptionCode );
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
|
||||
extern void WINAPI RtlUserThreadStart( PRTL_THREAD_START_ROUTINE entry, void *arg );
|
||||
__ASM_GLOBAL_FUNC( RtlUserThreadStart,
|
||||
"subq $0x28,%rsp\n\t"
|
||||
".seh_stackalloc 0x28\n\t"
|
||||
".seh_endprologue\n\t"
|
||||
"movq %rdx,%r8\n\t"
|
||||
"movq %rcx,%rdx\n\t"
|
||||
"xorq %rcx,%rcx\n\t"
|
||||
"movq " __ASM_NAME( "pBaseThreadInitThunk" ) "(%rip),%r9\n\t"
|
||||
"call *%r9\n\t"
|
||||
"int3\n\t"
|
||||
".seh_handler call_thread_func_handler, @except\n\t" )
|
||||
|
||||
#else /* defined(__x86_64__) && defined(__ASM_SEH_SUPPORTED) */
|
||||
|
||||
void WINAPI 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
|
||||
}
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* RtlCreateUserThread (NTDLL.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue