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
6ecc8039
Commit
6ecc8039
authored
Nov 10, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use a pthread key for the TEB on all platforms.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c212987d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
31 deletions
+18
-31
signal_arm.c
dlls/ntdll/unix/signal_arm.c
+0
-5
signal_arm64.c
dlls/ntdll/unix/signal_arm64.c
+0
-14
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+0
-6
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+0
-5
thread.c
dlls/ntdll/unix/thread.c
+12
-0
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-0
virtual.c
dlls/ntdll/unix/virtual.c
+5
-1
No files found.
dlls/ntdll/unix/signal_arm.c
View file @
6ecc8039
...
...
@@ -1770,9 +1770,4 @@ __ASM_GLOBAL_FUNC( __wine_longjmp,
"mov r0, r1
\n\t
"
/* retval */
"bx r2"
)
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
__ASM_GLOBAL_FUNC
(
NtCurrentTeb
,
"mrc p15, 0, r0, c13, c0, 2; bx lr"
)
#endif
/* __arm__ */
dlls/ntdll/unix/signal_arm64.c
View file @
6ecc8039
...
...
@@ -129,8 +129,6 @@ static DWORD64 get_fault_esr( ucontext_t *sigcontext )
#endif
/* linux */
static
pthread_key_t
teb_key
;
struct
syscall_frame
{
ULONG64
x
[
29
];
/* 000 */
...
...
@@ -1320,7 +1318,6 @@ NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_E
*/
void
signal_init_threading
(
void
)
{
pthread_key_create
(
&
teb_key
,
NULL
);
}
...
...
@@ -1348,8 +1345,6 @@ void signal_init_thread( TEB *teb )
{
/* Win64/ARM applications expect the TEB pointer to be in the x18 platform register. */
__asm__
__volatile__
(
"mov x18, %0"
:
:
"r"
(
teb
)
);
pthread_setspecific
(
teb_key
,
teb
);
}
...
...
@@ -1634,13 +1629,4 @@ __ASM_GLOBAL_FUNC( __wine_longjmp,
"mov x0, x1
\n\t
"
/* retval */
"ret"
)
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
TEB
*
WINAPI
NtCurrentTeb
(
void
)
{
return
pthread_getspecific
(
teb_key
);
}
#endif
/* __aarch64__ */
dlls/ntdll/unix/signal_i386.c
View file @
6ecc8039
...
...
@@ -2752,10 +2752,4 @@ __ASM_GLOBAL_FUNC( __wine_longjmp,
"addl $4,%esp
\n\t
"
/* get rid of return address */
"jmp *20(%ecx)
\n\t
"
/* jmp_buf.Eip */
)
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
__ASM_STDCALL_FUNC
(
NtCurrentTeb
,
0
,
".byte 0x64
\n\t
movl 0x18,%eax
\n\t
ret"
)
#endif
/* __i386__ */
dlls/ntdll/unix/signal_x86_64.c
View file @
6ecc8039
...
...
@@ -2896,9 +2896,4 @@ __ASM_GLOBAL_FUNC( __wine_longjmp,
"movq 0x10(%rcx),%rsp
\n\t
"
/* jmp_buf->Rsp */
"jmp *%rdx"
)
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
__ASM_GLOBAL_FUNC
(
NtCurrentTeb
,
"movq %gs:0x30,%rax; ret"
)
#endif
/* __x86_64__ */
dlls/ntdll/unix/thread.c
View file @
6ecc8039
...
...
@@ -73,6 +73,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread);
WINE_DECLARE_DEBUG_CHANNEL
(
seh
);
WINE_DECLARE_DEBUG_CHANNEL
(
threadname
);
pthread_key_t
teb_key
=
0
;
static
int
nb_threads
=
1
;
static
inline
int
get_unix_exit_code
(
NTSTATUS
status
)
...
...
@@ -1066,6 +1068,7 @@ static void start_thread( TEB *teb )
BOOL
suspend
;
thread_data
->
pthread_id
=
pthread_self
();
pthread_setspecific
(
teb_key
,
teb
);
signal_init_thread
(
teb
);
server_init_thread
(
thread_data
->
start
,
&
suspend
);
signal_start_thread
(
thread_data
->
start
,
thread_data
->
param
,
suspend
,
teb
);
...
...
@@ -1523,6 +1526,15 @@ NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL
}
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
TEB
*
WINAPI
NtCurrentTeb
(
void
)
{
return
pthread_getspecific
(
teb_key
);
}
/***********************************************************************
* NtOpenThread (NTDLL.@)
*/
...
...
dlls/ntdll/unix/unix_private.h
View file @
6ecc8039
...
...
@@ -117,6 +117,7 @@ extern const char *config_dir DECLSPEC_HIDDEN;
extern
const
char
*
user_name
DECLSPEC_HIDDEN
;
extern
const
char
**
dll_paths
DECLSPEC_HIDDEN
;
extern
const
char
**
system_dll_paths
DECLSPEC_HIDDEN
;
extern
pthread_key_t
teb_key
DECLSPEC_HIDDEN
;
extern
PEB
*
peb
DECLSPEC_HIDDEN
;
extern
USHORT
*
uctable
DECLSPEC_HIDDEN
;
extern
USHORT
*
lctable
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unix/virtual.c
View file @
6ecc8039
...
...
@@ -2929,6 +2929,7 @@ static TEB *init_teb( void *ptr, BOOL is_wow )
TEB
*
virtual_alloc_first_teb
(
void
)
{
void
*
ptr
;
TEB
*
teb
;
NTSTATUS
status
;
SIZE_T
data_size
=
page_size
;
SIZE_T
block_size
=
signal_stack_mask
+
1
;
...
...
@@ -2950,7 +2951,10 @@ TEB *virtual_alloc_first_teb(void)
data_size
=
2
*
block_size
;
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
ptr
,
0
,
&
data_size
,
MEM_COMMIT
,
PAGE_READWRITE
);
peb
=
(
PEB
*
)((
char
*
)
teb_block
+
31
*
block_size
+
(
is_win64
?
0
:
page_size
));
return
init_teb
(
ptr
,
FALSE
);
teb
=
init_teb
(
ptr
,
FALSE
);
pthread_key_create
(
&
teb_key
,
NULL
);
pthread_setspecific
(
teb_key
,
teb
);
return
teb
;
}
...
...
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