ntdll: Also pass the TEB to signal_exit_thread().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-06-14 12:56:38 +02:00
parent 2849ca9db4
commit 9a430dc6db
6 changed files with 19 additions and 33 deletions

View File

@ -973,8 +973,10 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
"bx r5" )
extern void DECLSPEC_NORETURN call_thread_exit_func( int status, void (*func)(int), TEB *teb );
__ASM_GLOBAL_FUNC( call_thread_exit_func,
/***********************************************************************
* signal_exit_thread
*/
__ASM_GLOBAL_FUNC( signal_exit_thread,
"ldr r3, [r2, #0x1d4]\n\t" /* arm_thread_data()->exit_frame */
"mov ip, #0\n\t"
"str ip, [r2, #0x1d4]\n\t"
@ -983,12 +985,4 @@ __ASM_GLOBAL_FUNC( call_thread_exit_func,
"movne sp, r3\n\t"
"blx r1" )
/***********************************************************************
* signal_exit_thread
*/
void signal_exit_thread( int status, void (*func)(int) )
{
call_thread_exit_func( status, func, NtCurrentTeb() );
}
#endif /* __arm__ */

View File

@ -1146,9 +1146,10 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
"mov lr, #0\n\t"
"br x19" )
extern void DECLSPEC_NORETURN call_thread_exit_func( int status, void (*func)(int), TEB *teb );
__ASM_GLOBAL_FUNC( call_thread_exit_func,
/***********************************************************************
* signal_exit_thread
*/
__ASM_GLOBAL_FUNC( signal_exit_thread,
"stp x29, x30, [sp,#-16]!\n\t"
"ldr x3, [x2, #0x2f0]\n\t" /* arm64_thread_data()->exit_frame */
"str xzr, [x2, #0x2f0]\n\t"
@ -1157,15 +1158,6 @@ __ASM_GLOBAL_FUNC( call_thread_exit_func,
"1:\tldp x29, x30, [sp], #16\n\t"
"br x1" )
/***********************************************************************
* signal_exit_thread
*/
void signal_exit_thread( int status, void (*func)(int) )
{
call_thread_exit_func( status, func, NtCurrentTeb() );
}
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/

View File

@ -2436,14 +2436,15 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
*/
__ASM_GLOBAL_FUNC( signal_exit_thread,
"movl 8(%esp),%ecx\n\t"
"movl 12(%esp),%esi\n\t"
"xorl %edx,%edx\n\t"
/* fetch exit frame */
"movl %fs:0x1f4,%edx\n\t" /* x86_thread_data()->exit_frame */
"xchgl %edx,0x1f4(%esi)\n\t" /* x86_thread_data()->exit_frame */
"testl %edx,%edx\n\t"
"jnz 1f\n\t"
"jmp *%ecx\n\t"
/* switch to exit frame stack */
"1:\tmovl 4(%esp),%eax\n\t"
"movl $0,%fs:0x1f4\n\t"
"movl %edx,%ebp\n\t"
__ASM_CFI(".cfi_def_cfa %ebp,4\n\t")
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")

View File

@ -2691,14 +2691,13 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
*/
__ASM_GLOBAL_FUNC( signal_exit_thread,
/* fetch exit frame */
"movq %gs:0x30,%rax\n\t"
"movq 0x320(%rax),%rdx\n\t" /* amd64_thread_data()->exit_frame */
"testq %rdx,%rdx\n\t"
"xorl %ecx,%ecx\n\t"
"xchgq %rcx,0x320(%rdx)\n\t" /* amd64_thread_data()->exit_frame */
"testq %rcx,%rcx\n\t"
"jnz 1f\n\t"
"jmp *%rsi\n"
/* switch to exit frame stack */
"1:\tmovq $0,0x320(%rax)\n\t"
"movq %rdx,%rsp\n\t"
"1:\tmovq %rcx,%rsp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 56\n\t")
__ASM_CFI(".cfi_rel_offset %rbp,48\n\t")
__ASM_CFI(".cfi_rel_offset %rbx,40\n\t")

View File

@ -1017,7 +1017,7 @@ void abort_thread( int status )
{
pthread_sigmask( SIG_BLOCK, &server_block_set, NULL );
if (InterlockedDecrement( &nb_threads ) <= 0) abort_process( status );
signal_exit_thread( status, pthread_exit_wrapper );
signal_exit_thread( status, pthread_exit_wrapper, NtCurrentTeb() );
}
@ -1050,7 +1050,7 @@ static DECLSPEC_NORETURN void exit_thread( int status )
virtual_free_teb( teb );
}
}
signal_exit_thread( status, pthread_exit_wrapper );
signal_exit_thread( status, pthread_exit_wrapper, NtCurrentTeb() );
}
@ -1060,7 +1060,7 @@ static DECLSPEC_NORETURN void exit_thread( int status )
void exit_process( int status )
{
pthread_sigmask( SIG_BLOCK, &server_block_set, NULL );
signal_exit_thread( get_unix_exit_code( status ), process_exit_wrapper );
signal_exit_thread( get_unix_exit_code( status ), process_exit_wrapper, NtCurrentTeb() );
}

View File

@ -246,7 +246,7 @@ extern void signal_init_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern void signal_init_process(void) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE entry, void *arg,
BOOL suspend, void *thunk, TEB *teb ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int), TEB *teb ) DECLSPEC_HIDDEN;
extern void __wine_syscall_dispatcher(void) DECLSPEC_HIDDEN;
extern unsigned int __wine_syscall_flags DECLSPEC_HIDDEN;
extern NTSTATUS signal_set_full_context( CONTEXT *context ) DECLSPEC_HIDDEN;