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
a5cec4f5
Commit
a5cec4f5
authored
Jun 14, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Always use the TEB that was passed to signal_start_thread().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9a430dc6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
+24
-22
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+13
-11
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+11
-11
No files found.
dlls/ntdll/unix/signal_i386.c
View file @
a5cec4f5
...
...
@@ -2342,7 +2342,7 @@ void signal_init_process(void)
/***********************************************************************
* init_thread_context
*/
static
void
init_thread_context
(
CONTEXT
*
context
,
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
static
void
init_thread_context
(
CONTEXT
*
context
,
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
TEB
*
teb
)
{
context
->
SegCs
=
get_cs
();
context
->
SegDs
=
get_ds
();
...
...
@@ -2353,7 +2353,7 @@ static void init_thread_context( CONTEXT *context, LPTHREAD_START_ROUTINE entry,
context
->
EFlags
=
0x202
;
context
->
Eax
=
(
DWORD
)
entry
;
context
->
Ebx
=
(
DWORD
)
arg
;
context
->
Esp
=
(
DWORD
)
NtCurrentTeb
()
->
Tib
.
StackBase
-
16
;
context
->
Esp
=
(
DWORD
)
teb
->
Tib
.
StackBase
-
16
;
context
->
Eip
=
(
DWORD
)
pRtlUserThreadStart
;
context
->
FloatSave
.
ControlWord
=
0x27f
;
((
XSAVE_FORMAT
*
)
context
->
ExtendedRegisters
)
->
ControlWord
=
0x27f
;
...
...
@@ -2369,7 +2369,7 @@ static void init_thread_context( CONTEXT *context, LPTHREAD_START_ROUTINE entry,
/***********************************************************************
* get_initial_context
*/
PCONTEXT
DECLSPEC_HIDDEN
get_initial_context
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
BOOL
suspend
)
PCONTEXT
DECLSPEC_HIDDEN
get_initial_context
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
BOOL
suspend
,
TEB
*
teb
)
{
CONTEXT
*
ctx
;
...
...
@@ -2377,15 +2377,15 @@ PCONTEXT DECLSPEC_HIDDEN get_initial_context( LPTHREAD_START_ROUTINE entry, void
{
CONTEXT
context
=
{
CONTEXT_ALL
};
init_thread_context
(
&
context
,
entry
,
arg
);
init_thread_context
(
&
context
,
entry
,
arg
,
teb
);
wait_suspend
(
&
context
);
ctx
=
(
CONTEXT
*
)((
ULONG_PTR
)
context
.
Esp
&
~
15
)
-
1
;
*
ctx
=
context
;
}
else
{
ctx
=
(
CONTEXT
*
)((
char
*
)
NtCurrentTeb
()
->
Tib
.
StackBase
-
16
)
-
1
;
init_thread_context
(
ctx
,
entry
,
arg
);
ctx
=
(
CONTEXT
*
)((
char
*
)
teb
->
Tib
.
StackBase
-
16
)
-
1
;
init_thread_context
(
ctx
,
entry
,
arg
,
teb
);
}
pthread_sigmask
(
SIG_UNBLOCK
,
&
server_block_set
,
NULL
);
ctx
->
ContextFlags
=
CONTEXT_FULL
|
CONTEXT_FLOATING_POINT
|
CONTEXT_EXTENDED_REGISTERS
;
...
...
@@ -2409,17 +2409,19 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
"pushl %edi
\n\t
"
__ASM_CFI
(
".cfi_rel_offset %edi,-12
\n\t
"
)
/* store exit frame */
"movl %ebp,%fs:0x1f4
\n\t
"
/* x86_thread_data()->exit_frame */
"movl 24(%ebp),%ecx
\n\t
"
/* teb */
"movl %ebp,0x1f4(%ecx)
\n\t
"
/* x86_thread_data()->exit_frame */
/* set syscall frame */
"cmpl $0,
%fs:0x1f8
\n\t
"
/* x86_thread_data()->syscall_frame */
"cmpl $0,
0x1f8(%ecx)
\n\t
"
/* x86_thread_data()->syscall_frame */
"jnz 1f
\n\t
"
"leal -0x380(%esp),%eax
\n\t
"
/* sizeof(struct syscall_frame) */
"andl $~63,%eax
\n\t
"
"movl %eax,
%fs:0x1f8
\n
"
/* x86_thread_data()->syscall_frame */
"movl %eax,
0x1f8(%ecx)
\n
"
/* x86_thread_data()->syscall_frame */
/* switch to thread stack */
"1:
\t
movl
%fs:4,%eax
\n\t
"
/* NtCurrentTeb()
->StackBase */
"leal -0x100
4
(%eax),%esp
\n\t
"
"1:
\t
movl
4(%ecx),%eax
\n\t
"
/* teb
->StackBase */
"leal -0x100
0
(%eax),%esp
\n\t
"
/* attach dlls */
"pushl %ecx
\n\t
"
/* teb */
"pushl 16(%ebp)
\n\t
"
/* suspend */
"pushl 12(%ebp)
\n\t
"
/* arg */
"pushl 8(%ebp)
\n\t
"
/* entry */
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
a5cec4f5
...
...
@@ -2603,13 +2603,13 @@ void signal_init_process(void)
/***********************************************************************
* init_thread_context
*/
static
void
init_thread_context
(
CONTEXT
*
context
,
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
static
void
init_thread_context
(
CONTEXT
*
context
,
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
TEB
*
teb
)
{
__asm__
(
"movw %%cs,%0"
:
"=m"
(
context
->
SegCs
)
);
__asm__
(
"movw %%ss,%0"
:
"=m"
(
context
->
SegSs
)
);
context
->
Rcx
=
(
ULONG_PTR
)
entry
;
context
->
Rdx
=
(
ULONG_PTR
)
arg
;
context
->
Rsp
=
(
ULONG_PTR
)
NtCurrentTeb
()
->
Tib
.
StackBase
-
0x28
;
context
->
Rsp
=
(
ULONG_PTR
)
teb
->
Tib
.
StackBase
-
0x28
;
context
->
Rip
=
(
ULONG_PTR
)
pRtlUserThreadStart
;
context
->
EFlags
=
0x200
;
context
->
u
.
FltSave
.
ControlWord
=
0x27f
;
...
...
@@ -2620,7 +2620,7 @@ static void init_thread_context( CONTEXT *context, LPTHREAD_START_ROUTINE entry,
/***********************************************************************
* get_initial_context
*/
PCONTEXT
DECLSPEC_HIDDEN
get_initial_context
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
BOOL
suspend
)
PCONTEXT
DECLSPEC_HIDDEN
get_initial_context
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
BOOL
suspend
,
TEB
*
teb
)
{
CONTEXT
*
ctx
;
...
...
@@ -2629,15 +2629,15 @@ PCONTEXT DECLSPEC_HIDDEN get_initial_context( LPTHREAD_START_ROUTINE entry, void
CONTEXT
context
=
{
0
};
context
.
ContextFlags
=
CONTEXT_ALL
;
init_thread_context
(
&
context
,
entry
,
arg
);
init_thread_context
(
&
context
,
entry
,
arg
,
teb
);
wait_suspend
(
&
context
);
ctx
=
(
CONTEXT
*
)((
ULONG_PTR
)
context
.
Rsp
&
~
15
)
-
1
;
*
ctx
=
context
;
}
else
{
ctx
=
(
CONTEXT
*
)((
char
*
)
NtCurrentTeb
()
->
Tib
.
StackBase
-
0x30
)
-
1
;
init_thread_context
(
ctx
,
entry
,
arg
);
ctx
=
(
CONTEXT
*
)((
char
*
)
teb
->
Tib
.
StackBase
-
0x30
)
-
1
;
init_thread_context
(
ctx
,
entry
,
arg
,
teb
);
}
pthread_sigmask
(
SIG_UNBLOCK
,
&
server_block_set
,
NULL
);
ctx
->
ContextFlags
=
CONTEXT_FULL
;
...
...
@@ -2666,17 +2666,17 @@ __ASM_GLOBAL_FUNC( signal_start_thread,
"movq %r15,8(%rsp)
\n\t
"
__ASM_CFI
(
".cfi_rel_offset %r15,8
\n\t
"
)
/* store exit frame */
"movq %gs:0x30,%rax
\n\t
"
"movq %rsp,0x320(%rax)
\n\t
"
/* amd64_thread_data()->exit_frame */
"movq %rsp,0x320(%r8)
\n\t
"
/* amd64_thread_data()->exit_frame */
/* set syscall frame */
"cmpq $0,0x328(%r
ax)
\n\t
"
/* amd64_thread_data()->syscall_frame */
"cmpq $0,0x328(%r
8)
\n\t
"
/* amd64_thread_data()->syscall_frame */
"jnz 1f
\n\t
"
"leaq -0x400(%rsp),%r10
\n\t
"
/* sizeof(struct syscall_frame) */
"andq $~63,%r10
\n\t
"
"movq %r10,0x328(%r
ax)
\n
"
/* amd64_thread_data()->syscall_frame */
"movq %r10,0x328(%r
8)
\n
"
/* amd64_thread_data()->syscall_frame */
/* switch to thread stack */
"1:
\t
movq 8(%r
ax),%rax
\n\t
"
/* NtCurrentTeb()
->Tib.StackBase */
"1:
\t
movq 8(%r
8),%rax
\n\t
"
/* teb
->Tib.StackBase */
"movq %rcx,%rbx
\n\t
"
/* thunk */
"movq %r8,%rcx
\n\t
"
/* teb */
"leaq -0x1000(%rax),%rsp
\n\t
"
/* attach dlls */
"call "
__ASM_NAME
(
"get_initial_context"
)
"
\n\t
"
...
...
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