Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fc7c3b51
Commit
fc7c3b51
authored
Jan 21, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Always inline NtCurrentTeb() on ARM.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6a971e84
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
48 deletions
+17
-48
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-1
signal_arm.c
dlls/ntdll/signal_arm.c
+0
-8
loader.c
dlls/ntdll/unix/loader.c
+2
-0
signal_arm.c
dlls/ntdll/unix/signal_arm.c
+8
-33
unixlib.h
dlls/ntdll/unixlib.h
+3
-1
winnt.h
include/winnt.h
+1
-1
import.c
tools/winebuild/import.c
+2
-4
No files found.
dlls/ntdll/ntdll.spec
View file @
fc7c3b51
...
...
@@ -189,7 +189,7 @@
@ stub NtCreateToken
@ stdcall -syscall NtCreateUserProcess(ptr ptr long long ptr ptr long long ptr ptr ptr)
# @ stub NtCreateWaitablePort
@ stdcall -arch=
win32
,arm64 NtCurrentTeb()
@ stdcall -arch=
i386
,arm64 NtCurrentTeb()
@ stdcall -syscall NtDebugActiveProcess(long long)
# @ stub NtDebugContinue
@ stdcall -syscall NtDelayExecution(long ptr)
...
...
dlls/ntdll/signal_arm.c
View file @
fc7c3b51
...
...
@@ -304,12 +304,4 @@ __ASM_STDCALL_FUNC( DbgBreakPoint, 0, "bkpt #0; bx lr; nop; nop; nop; nop" );
*/
__ASM_STDCALL_FUNC
(
DbgUserBreakPoint
,
0
,
"bkpt #0; bx lr; nop; nop; nop; nop"
);
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
TEB
*
WINAPI
NtCurrentTeb
(
void
)
{
return
unix_funcs
->
NtCurrentTeb
();
}
#endif
/* __arm__ */
dlls/ntdll/unix/loader.c
View file @
fc7c3b51
...
...
@@ -1508,7 +1508,9 @@ static double CDECL ntdll_tan( double d ) { return tan( d ); }
*/
static
struct
unix_funcs
unix_funcs
=
{
#ifdef __aarch64__
NtCurrentTeb
,
#endif
DbgUiIssueRemoteBreakin
,
RtlGetSystemTimePrecise
,
RtlWaitOnAddress
,
...
...
dlls/ntdll/unix/signal_arm.c
View file @
fc7c3b51
...
...
@@ -68,8 +68,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
seh
);
static
pthread_key_t
teb_key
;
/***********************************************************************
* signal context platform-specific definitions
...
...
@@ -584,23 +582,21 @@ static void setup_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec )
* call_user_apc_dispatcher
*/
__ASM_GLOBAL_FUNC
(
call_user_apc_dispatcher
,
"mov r4, r0
\n\t
"
/* context_ptr */
"mov r5, r1
\n\t
"
/* ctx */
"mov r6, r2
\n\t
"
/* arg1 */
"mov r7, r3
\n\t
"
/* arg2 */
"ldr r8, [sp]
\n\t
"
/* func */
"ldr r9, [sp, #4]
\n\t
"
/* dispatcher */
"bl "
__ASM_NAME
(
"NtCurrentTeb"
)
"
\n\t
"
"add r10, r0, #0x1d8
\n\t
"
/* arm_thread_data()->syscall_frame */
"movs r0, r4
\n\t
"
"mrc p15, 0, r10, c13, c0, 2
\n\t
"
/* NtCurrentTeb() */
"cmp r0, #0
\n\t
"
/* context_ptr */
"beq 1f
\n\t
"
"ldr r0, [r0, #0x38]
\n\t
"
/* context_ptr->Sp */
"sub r0, r0, #0x1c8
\n\t
"
/* sizeof(CONTEXT) + offsetof(frame,r4) */
"mov ip, #0
\n\t
"
"str ip, [r10
]
\n\t
"
"str ip, [r10
, #0x1d8]
\n\t
"
/* arm_thread_data()->syscall_frame */
"mov sp, r0
\n\t
"
"b 2f
\n
"
"1:
\t
ldr r0, [r10]
\n\t
"
"1:
\t
ldr r0, [r10
, #0x1d8
]
\n\t
"
"sub r0, #0x1a0
\n\t
"
"mov sp, r0
\n\t
"
"mov r0, #3
\n\t
"
...
...
@@ -613,7 +609,7 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher,
"str r0, [sp, #4]
\n\t
"
/* context.R0 = STATUS_USER_APC */
"mov r0, sp
\n\t
"
"mov ip, #0
\n\t
"
"str ip, [r10]
\n\t
"
"str ip, [r10
, #0x1d8
]
\n\t
"
"2:
\t
mov r1, r5
\n\t
"
/* ctx */
"mov r2, r6
\n\t
"
/* arg1 */
"mov r3, r7
\n\t
"
/* arg2 */
...
...
@@ -634,17 +630,10 @@ __ASM_GLOBAL_FUNC( call_raise_user_exception_dispatcher,
* call_user_exception_dispatcher
*/
__ASM_GLOBAL_FUNC
(
call_user_exception_dispatcher
,
"mov r4, r0
\n\t
"
"mov r5, r1
\n\t
"
"mov r6, r2
\n\t
"
"bl "
__ASM_NAME
(
"NtCurrentTeb"
)
"
\n\t
"
"add r7, r0, #0x1d8
\n\t
"
/* arm_thread_data()->syscall_frame */
"mov r0, r4
\n\t
"
"mov r1, r5
\n\t
"
"mov r2, r6
\n\t
"
"ldr r3, [r7]
\n\t
"
"mrc p15, 0, r7, c13, c0, 2
\n\t
"
/* NtCurrentTeb() */
"ldr r3, [r7, #0x1d8]
\n\t
"
/* arm_thread_data()->syscall_frame */
"mov ip, #0
\n\t
"
"str ip, [r7]
\n\t
"
"str ip, [r7
, #0x1d8
]
\n\t
"
"add r3, r3, #8
\n\t
"
"ldm r3, {r5-r11}
\n\t
"
"ldr r4, [r3, #32]
\n\t
"
...
...
@@ -911,7 +900,6 @@ NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_E
*/
void
signal_init_threading
(
void
)
{
pthread_key_create
(
&
teb_key
,
NULL
);
}
...
...
@@ -937,11 +925,7 @@ void signal_free_thread( TEB *teb )
*/
void
signal_init_thread
(
TEB
*
teb
)
{
#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_8A__)
/* Win32/ARM applications expect the TEB pointer to be in the TPIDRURW register. */
__asm__
__volatile__
(
"mcr p15, 0, %0, c13, c0, 2"
:
:
"r"
(
teb
)
);
#endif
pthread_setspecific
(
teb_key
,
teb
);
}
...
...
@@ -1057,13 +1041,4 @@ void signal_exit_thread( int status, void (*func)(int) )
call_thread_exit_func
(
status
,
func
,
NtCurrentTeb
()
);
}
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
TEB
*
WINAPI
NtCurrentTeb
(
void
)
{
return
pthread_getspecific
(
teb_key
);
}
#endif
/* __arm__ */
dlls/ntdll/unixlib.h
View file @
fc7c3b51
...
...
@@ -27,12 +27,14 @@
struct
_DISPATCHER_CONTEXT
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 10
6
#define NTDLL_UNIXLIB_VERSION 10
7
struct
unix_funcs
{
/* Nt* functions */
#ifdef __aarch64__
TEB
*
(
WINAPI
*
NtCurrentTeb
)(
void
);
#endif
/* other Win32 API functions */
NTSTATUS
(
WINAPI
*
DbgUiIssueRemoteBreakin
)(
HANDLE
process
);
...
...
include/winnt.h
View file @
fc7c3b51
...
...
@@ -2801,7 +2801,7 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{
return
(
struct
_TEB
*
)
__readgsqword
(
FIELD_OFFSET
(
NT_TIB
,
Self
));
}
#elif defined(__arm__) && defined(__
MINGW32
__)
#elif defined(__arm__) && defined(__
GNUC
__)
static
FORCEINLINE
struct
_TEB
*
WINAPI
NtCurrentTeb
(
void
)
{
struct
_TEB
*
teb
;
...
...
tools/winebuild/import.c
View file @
fc7c3b51
...
...
@@ -1577,10 +1577,8 @@ void output_syscalls( DLLSPEC *spec )
output
(
"
\t
cmp r4, r5
\n
"
);
output
(
"
\t
bcs 5f
\n
"
);
output
(
"
\t
sub sp, sp, #8
\n
"
);
output
(
"
\t
push {r0-r3}
\n
"
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"NtCurrentTeb"
)
);
output
(
"
\t
add r7, r0, #0x1d8
\n
"
);
/* arm_thread_data()->syscall_frame */
output
(
"
\t
pop {r0-r3}
\n
"
);
output
(
"
\t
mrc p15, 0, r7, c13, c0, 2
\n
"
);
/* NtCurrentTeb() */
output
(
"
\t
add r7, #0x1d8
\n
"
);
/* arm_thread_data()->syscall_frame */
output
(
"
\t
mrs ip, CPSR
\n
"
);
output
(
"
\t
str ip, [sp, #4]
\n
"
);
output
(
"
\t
str sp, [r7]
\n
"
);
/* syscall frame */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment