From: Brendan Shanks bshanks@codeweavers.com
--- dlls/ntdll/signal_i386.c | 14 +++++--------- dlls/ntdll/unix/signal_x86_64.c | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 8f11d19024b..dd7c33933ba 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -617,7 +617,7 @@ __ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "int $3; ret" /********************************************************************** * NtCurrentTeb (NTDLL.@) */ -__ASM_STDCALL_FUNC( NtCurrentTeb, 0, ".byte 0x64\n\tmovl 0x18,%eax\n\tret" ) +__ASM_STDCALL_FUNC( NtCurrentTeb, 0, "movl %fs:0x18,%eax\n\tret" )
/************************************************************************** @@ -683,20 +683,16 @@ __ASM_GLOBAL_FUNC(call_exception_handler, "subl $12,%esp\n\t" "pushl 12(%ebp)\n\t" /* make any exceptions in this... */ "pushl %edx\n\t" /* handler be handled by... */ - ".byte 0x64\n\t" - "pushl (0)\n\t" /* nested_handler (passed in edx). */ - ".byte 0x64\n\t" - "movl %esp,(0)\n\t" /* push the new exception frame onto the exception stack. */ + "pushl %fs:0\n\t" /* nested_handler (passed in edx). */ + "movl %esp,%fs:0\n\t" /* push the new exception frame onto the exception stack. */ "pushl 20(%ebp)\n\t" "pushl 16(%ebp)\n\t" "pushl 12(%ebp)\n\t" "pushl 8(%ebp)\n\t" "movl 24(%ebp), %ecx\n\t" /* (*1) */ "call *%ecx\n\t" /* call handler. (*2) */ - ".byte 0x64\n\t" - "movl (0), %esp\n\t" /* restore previous... (*3) */ - ".byte 0x64\n\t" - "popl (0)\n\t" /* exception frame. */ + "movl %fs:0, %esp\n\t" /* restore previous... (*3) */ + "popl %fs:0\n\t" /* exception frame. */ "movl %ebp, %esp\n\t" /* restore saved stack, in case it was corrupted */ "popl %ebp\n\t" __ASM_CFI(".cfi_def_cfa %esp,4\n\t") diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 537e4e1f60e..caa85249896 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2597,8 +2597,8 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB #elif defined(__NetBSD__) sysarch( X86_64_SET_GSBASE, &teb ); #elif defined (__APPLE__) - __asm__ volatile (".byte 0x65\n\tmovq %0,%c1" :: "r" (teb->Tib.Self), "n" (FIELD_OFFSET(TEB, Tib.Self))); - __asm__ volatile (".byte 0x65\n\tmovq %0,%c1" :: "r" (teb->ThreadLocalStoragePointer), "n" (FIELD_OFFSET(TEB, ThreadLocalStoragePointer))); + __asm__ volatile ("movq %0,%%gs:%c1" :: "r" (teb->Tib.Self), "n" (FIELD_OFFSET(TEB, Tib.Self))); + __asm__ volatile ("movq %0,%%gs:%c1" :: "r" (teb->ThreadLocalStoragePointer), "n" (FIELD_OFFSET(TEB, ThreadLocalStoragePointer))); thread_data->pthread_teb = mac_thread_gsbase(); /* alloc_tls_slot() needs to poke a value to an address relative to each thread's gsbase. Have each thread record its gsbase pointer into its