Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1939f7c2
Commit
1939f7c2
authored
Mar 23, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use get_wow_teb() and wow_peb in more places.
parent
dd7b4431
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
19 deletions
+15
-19
env.c
dlls/ntdll/unix/env.c
+2
-5
loader.c
dlls/ntdll/unix/loader.c
+1
-1
signal_arm64.c
dlls/ntdll/unix/signal_arm64.c
+2
-2
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+10
-11
No files found.
dlls/ntdll/unix/env.c
View file @
1939f7c2
...
...
@@ -2410,11 +2410,8 @@ void WINAPI RtlSetLastWin32Error( DWORD err )
{
TEB
*
teb
=
NtCurrentTeb
();
#ifdef _WIN64
if
(
teb
->
WowTebOffset
)
{
TEB32
*
teb32
=
(
TEB32
*
)((
char
*
)
teb
+
teb
->
WowTebOffset
);
teb32
->
LastErrorValue
=
err
;
}
WOW_TEB
*
wow_teb
=
get_wow_teb
(
teb
);
if
(
wow_teb
)
wow_teb
->
LastErrorValue
=
err
;
#endif
teb
->
LastErrorValue
=
err
;
}
dlls/ntdll/unix/loader.c
View file @
1939f7c2
...
...
@@ -1914,7 +1914,7 @@ static void load_apiset_dll(void)
map
->
Version
==
6
&&
map
->
Size
<=
sec
->
Misc
.
VirtualSize
)
{
NtCurrentTeb
()
->
P
eb
->
ApiSetMap
=
map
;
p
eb
->
ApiSetMap
=
map
;
if
(
wow_peb
)
wow_peb
->
ApiSetMap
=
PtrToUlong
(
map
);
TRACE
(
"loaded %s apiset at %p
\n
"
,
debugstr_w
(
path
),
map
);
return
;
...
...
dlls/ntdll/unix/signal_arm64.c
View file @
1939f7c2
...
...
@@ -1617,7 +1617,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
{
i386_context
->
ContextFlags
=
CONTEXT_I386_ALL
;
i386_context
->
Eax
=
(
ULONG_PTR
)
entry
;
i386_context
->
Ebx
=
(
arg
==
peb
?
get_wow_teb
(
teb
)
->
P
eb
:
(
ULONG_PTR
)
arg
);
i386_context
->
Ebx
=
(
arg
==
peb
?
(
ULONG_PTR
)
wow_p
eb
:
(
ULONG_PTR
)
arg
);
i386_context
->
Esp
=
get_wow_teb
(
teb
)
->
Tib
.
StackBase
-
16
;
i386_context
->
Eip
=
pLdrSystemDllInitBlock
->
pRtlUserThreadStart
;
i386_context
->
SegCs
=
0x23
;
...
...
@@ -1634,7 +1634,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
{
arm_context
->
ContextFlags
=
CONTEXT_ARM_ALL
;
arm_context
->
R0
=
(
ULONG_PTR
)
entry
;
arm_context
->
R1
=
(
arg
==
peb
?
get_wow_teb
(
teb
)
->
P
eb
:
(
ULONG_PTR
)
arg
);
arm_context
->
R1
=
(
arg
==
peb
?
(
ULONG_PTR
)
wow_p
eb
:
(
ULONG_PTR
)
arg
);
arm_context
->
Sp
=
get_wow_teb
(
teb
)
->
Tib
.
StackBase
;
arm_context
->
Pc
=
pLdrSystemDllInitBlock
->
pRtlUserThreadStart
;
if
(
arm_context
->
Pc
&
1
)
arm_context
->
Cpsr
|=
0x20
;
/* thumb mode */
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
1939f7c2
...
...
@@ -2317,15 +2317,15 @@ void signal_init_threading(void)
NTSTATUS
signal_alloc_thread
(
TEB
*
teb
)
{
struct
amd64_thread_data
*
thread_data
=
(
struct
amd64_thread_data
*
)
&
teb
->
GdiTebBatch
;
WOW_TEB
*
wow_teb
=
get_wow_teb
(
teb
);
if
(
teb
->
WowTebOffset
)
if
(
wow_teb
)
{
if
(
!
fs32_sel
)
{
void
*
teb32
=
(
char
*
)
teb
+
teb
->
WowTebOffset
;
sigset_t
sigset
;
int
idx
;
LDT_ENTRY
entry
=
ldt_make_entry
(
teb32
,
page_size
-
1
,
LDT_FLAGS_DATA
|
LDT_FLAGS_32BIT
);
LDT_ENTRY
entry
=
ldt_make_entry
(
wow_teb
,
page_size
-
1
,
LDT_FLAGS_DATA
|
LDT_FLAGS_32BIT
);
server_enter_uninterrupted_section
(
&
ldt_mutex
,
&
sigset
);
for
(
idx
=
first_ldt_entry
;
idx
<
LDT_SIZE
;
idx
++
)
...
...
@@ -2423,6 +2423,7 @@ static void *mac_thread_gsbase(void)
void
signal_init_process
(
void
)
{
struct
sigaction
sig_act
;
WOW_TEB
*
wow_teb
=
get_wow_teb
(
NtCurrentTeb
()
);
void
*
ptr
,
*
kernel_stack
=
(
char
*
)
ntdll_get_thread_data
()
->
kernel_stack
+
kernel_stack_size
;
amd64_thread_data
()
->
syscall_frame
=
(
struct
syscall_frame
*
)
kernel_stack
-
1
;
...
...
@@ -2436,13 +2437,12 @@ void signal_init_process(void)
if
(
xstate_compaction_enabled
)
syscall_flags
|=
SYSCALL_HAVE_XSAVEC
;
#ifdef __linux__
if
(
NtCurrentTeb
()
->
WowTebOffset
)
if
(
wow_teb
)
{
void
*
teb32
=
(
char
*
)
NtCurrentTeb
()
+
NtCurrentTeb
()
->
WowTebOffset
;
int
sel
;
cs32_sel
=
0x23
;
if
((
sel
=
alloc_fs_sel
(
-
1
,
teb32
))
!=
-
1
)
if
((
sel
=
alloc_fs_sel
(
-
1
,
wow_teb
))
!=
-
1
)
{
amd64_thread_data
()
->
fs
=
fs32_sel
=
(
sel
<<
3
)
|
3
;
syscall_flags
|=
SYSCALL_HAVE_PTHREAD_TEB
;
...
...
@@ -2453,14 +2453,13 @@ void signal_init_process(void)
else
ERR_
(
seh
)(
"failed to allocate %%fs selector
\n
"
);
}
#elif defined(__APPLE__)
if
(
NtCurrentTeb
()
->
WowTebOffset
)
if
(
wow_teb
)
{
void
*
teb32
=
(
char
*
)
NtCurrentTeb
()
+
NtCurrentTeb
()
->
WowTebOffset
;
LDT_ENTRY
cs32_entry
,
fs32_entry
;
int
idx
;
cs32_entry
=
ldt_make_entry
(
NULL
,
-
1
,
LDT_FLAGS_CODE
|
LDT_FLAGS_32BIT
);
fs32_entry
=
ldt_make_entry
(
teb32
,
page_size
-
1
,
LDT_FLAGS_DATA
|
LDT_FLAGS_32BIT
);
fs32_entry
=
ldt_make_entry
(
wow_teb
,
page_size
-
1
,
LDT_FLAGS_DATA
|
LDT_FLAGS_32BIT
);
for
(
idx
=
first_ldt_entry
;
idx
<
LDT_SIZE
;
idx
++
)
{
...
...
@@ -2520,7 +2519,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
#if defined __linux__
arch_prctl
(
ARCH_SET_GS
,
teb
);
arch_prctl
(
ARCH_GET_FS
,
&
amd64_thread_data
()
->
pthread_teb
);
if
(
fs32_sel
)
alloc_fs_sel
(
fs32_sel
>>
3
,
(
char
*
)
teb
+
teb
->
WowTebOffset
);
if
(
fs32_sel
)
alloc_fs_sel
(
fs32_sel
>>
3
,
get_wow_teb
(
teb
)
);
#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
amd64_set_gsbase
(
teb
);
#elif defined(__NetBSD__)
...
...
@@ -2556,7 +2555,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
{
wow_context
->
ContextFlags
=
CONTEXT_I386_ALL
;
wow_context
->
Eax
=
(
ULONG_PTR
)
entry
;
wow_context
->
Ebx
=
(
arg
==
peb
?
get_wow_teb
(
teb
)
->
P
eb
:
(
ULONG_PTR
)
arg
);
wow_context
->
Ebx
=
(
arg
==
peb
?
(
ULONG_PTR
)
wow_p
eb
:
(
ULONG_PTR
)
arg
);
wow_context
->
Esp
=
get_wow_teb
(
teb
)
->
Tib
.
StackBase
-
16
;
wow_context
->
Eip
=
pLdrSystemDllInitBlock
->
pRtlUserThreadStart
;
wow_context
->
SegCs
=
cs32_sel
;
...
...
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