Commit 7f088b0b authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use x18 for the TEB on ARM64.

parent 62173699
......@@ -196,7 +196,7 @@
@ stdcall -syscall NtCreateTransaction(ptr long ptr ptr long long long long ptr ptr)
@ stdcall -syscall NtCreateUserProcess(ptr ptr long long ptr ptr long long ptr ptr ptr)
# @ stub NtCreateWaitablePort
@ stdcall -arch=i386,arm64 NtCurrentTeb()
@ stdcall -arch=i386 NtCurrentTeb()
@ stdcall -syscall NtDebugActiveProcess(long long)
@ stdcall -syscall NtDebugContinue(long ptr long)
@ stdcall -syscall NtDelayExecution(long ptr)
......@@ -1704,7 +1704,6 @@
@ extern -private __wine_syscall_dispatcher
@ extern -private __wine_unix_call_dispatcher
@ extern -private __wine_unixlib_handle
@ extern -arch=arm64 __wine_current_teb
# Debugging
@ stdcall -norelay __wine_dbg_write(ptr long)
......
......@@ -38,8 +38,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(seh);
WINE_DECLARE_DEBUG_CHANNEL(threadname);
TEB * (* WINAPI __wine_current_teb)(void) = NULL;
typedef struct _SCOPE_TABLE
{
ULONG Count;
......@@ -1548,12 +1546,4 @@ __ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "brk #0xf000; ret"
"\n\tnop; nop; nop; nop; nop; nop; nop; nop"
"\n\tnop; nop; nop; nop; nop; nop" );
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
TEB * WINAPI NtCurrentTeb(void)
{
return __wine_current_teb();
}
#endif /* __aarch64__ */
......@@ -1834,13 +1834,6 @@ static void load_ntdll_functions( HMODULE module )
GET_FUNC( __wine_unixlib_handle );
*p__wine_unix_call_dispatcher = __wine_unix_call_dispatcher;
*p__wine_unixlib_handle = (UINT_PTR)unix_call_funcs;
#ifdef __aarch64__
{
void **p__wine_current_teb;
GET_FUNC( __wine_current_teb );
*p__wine_current_teb = NtCurrentTeb;
}
#endif
#undef GET_FUNC
}
......
......@@ -1694,22 +1694,6 @@ __ASM_GLOBAL_FUNC( signal_exit_thread,
* __wine_syscall_dispatcher
*/
__ASM_GLOBAL_FUNC( __wine_syscall_dispatcher,
/* FIXME: use x18 directly instead */
"stp x0, x1, [sp, #-96]!\n\t"
"stp x2, x3, [sp, #16]\n\t"
"stp x4, x5, [sp, #32]\n\t"
"stp x6, x7, [sp, #48]\n\t"
"stp x8, x9, [sp, #64]\n\t"
"str x30, [sp, #80]\n\t"
"bl " __ASM_NAME("NtCurrentTeb") "\n\t"
"mov x18, x0\n\t"
"ldp x2, x3, [sp, #16]\n\t"
"ldp x4, x5, [sp, #32]\n\t"
"ldp x6, x7, [sp, #48]\n\t"
"ldp x8, x9, [sp, #64]\n\t"
"ldr x30, [sp, #80]\n\t"
"ldp x0, x1, [sp], #96\n\t"
"ldr x10, [x18, #0x2f8]\n\t" /* arm64_thread_data()->syscall_frame */
"stp x18, x19, [x10, #0x90]\n\t"
"stp x20, x21, [x10, #0xa0]\n\t"
......@@ -1822,14 +1806,6 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher,
* __wine_unix_call_dispatcher
*/
__ASM_GLOBAL_FUNC( __wine_unix_call_dispatcher,
/* FIXME: use x18 directly instead */
"stp x0, x1, [sp, #-32]!\n\t"
"stp x2, x30,[sp, #16]\n\t"
"bl " __ASM_NAME("NtCurrentTeb") "\n\t"
"mov x18, x0\n\t"
"ldp x2, x30,[sp, #16]\n\t"
"ldp x0, x1, [sp], #32\n\t"
"ldr x10, [x18, #0x2f8]\n\t" /* arm64_thread_data()->syscall_frame */
"stp x18, x19, [x10, #0x90]\n\t"
"stp x20, x21, [x10, #0xa0]\n\t"
......
......@@ -2398,6 +2398,18 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{
return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(15, 0, 13, 0, 2);
}
#elif defined(__aarch64__) && defined(__MINGW32__)
register struct _TEB *__wine_current_teb __asm__("x18");
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{
return __wine_current_teb;
}
#elif defined(__aarch64__) && defined(_MSC_VER)
#pragma intrinsic(__getReg)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{
return (struct _TEB *)__getReg(18);
}
#elif defined(__GNUC__)
extern struct _TEB * WINAPI NtCurrentTeb(void) __attribute__((pure));
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment