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
4acecd86
Commit
4acecd86
authored
Jul 01, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Initialize the Wow64 context on x86-64.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bedfb31d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+36
-2
No files found.
dlls/ntdll/unix/signal_x86_64.c
View file @
4acecd86
...
@@ -362,6 +362,9 @@ static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer )
...
@@ -362,6 +362,9 @@ static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer )
context
->
ContextFlags
|=
CONTEXT_XSTATE
;
context
->
ContextFlags
|=
CONTEXT_XSTATE
;
}
}
static
USHORT
cs32_sel
;
/* selector for %cs in 32-bit mode */
static
USHORT
cs64_sel
;
/* selector for %cs in 64-bit mode */
static
USHORT
ds64_sel
;
/* selector for %ds/%es/%ss in 64-bit mode */
/***********************************************************************
/***********************************************************************
* Definitions for Dwarf unwind tables
* Definitions for Dwarf unwind tables
...
@@ -2479,6 +2482,8 @@ NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_E
...
@@ -2479,6 +2482,8 @@ NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_E
*/
*/
void
signal_init_threading
(
void
)
void
signal_init_threading
(
void
)
{
{
__asm__
(
"movw %%cs,%0"
:
"=m"
(
cs64_sel
)
);
__asm__
(
"movw %%ss,%0"
:
"=m"
(
ds64_sel
)
);
}
}
...
@@ -2607,6 +2612,13 @@ void signal_init_process(void)
...
@@ -2607,6 +2612,13 @@ void signal_init_process(void)
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_XSAVE
)
__wine_syscall_flags
|=
SYSCALL_HAVE_XSAVE
;
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_XSAVE
)
__wine_syscall_flags
|=
SYSCALL_HAVE_XSAVE
;
if
(
xstate_compaction_enabled
)
__wine_syscall_flags
|=
SYSCALL_HAVE_XSAVEC
;
if
(
xstate_compaction_enabled
)
__wine_syscall_flags
|=
SYSCALL_HAVE_XSAVEC
;
#ifdef __linux__
if
(
NtCurrentTeb
()
->
WowTebOffset
)
{
cs32_sel
=
0x23
;
}
#endif
sig_act
.
sa_mask
=
server_block_set
;
sig_act
.
sa_mask
=
server_block_set
;
sig_act
.
sa_flags
=
SA_SIGINFO
|
SA_RESTART
|
SA_ONSTACK
;
sig_act
.
sa_flags
=
SA_SIGINFO
|
SA_RESTART
|
SA_ONSTACK
;
...
@@ -2642,17 +2654,39 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
...
@@ -2642,17 +2654,39 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
struct
amd64_thread_data
*
thread_data
=
(
struct
amd64_thread_data
*
)
&
teb
->
GdiTebBatch
;
struct
amd64_thread_data
*
thread_data
=
(
struct
amd64_thread_data
*
)
&
teb
->
GdiTebBatch
;
struct
syscall_frame
*
frame
=
thread_data
->
syscall_frame
;
struct
syscall_frame
*
frame
=
thread_data
->
syscall_frame
;
CONTEXT
*
ctx
,
context
=
{
0
};
CONTEXT
*
ctx
,
context
=
{
0
};
I386_CONTEXT
*
wow_context
;
context
.
ContextFlags
=
CONTEXT_ALL
;
context
.
ContextFlags
=
CONTEXT_ALL
;
context
.
Rcx
=
(
ULONG_PTR
)
entry
;
context
.
Rcx
=
(
ULONG_PTR
)
entry
;
context
.
Rdx
=
(
ULONG_PTR
)
arg
;
context
.
Rdx
=
(
ULONG_PTR
)
arg
;
context
.
Rsp
=
(
ULONG_PTR
)
teb
->
Tib
.
StackBase
-
0x28
;
context
.
Rsp
=
(
ULONG_PTR
)
teb
->
Tib
.
StackBase
-
0x28
;
context
.
Rip
=
(
ULONG_PTR
)
pRtlUserThreadStart
;
context
.
Rip
=
(
ULONG_PTR
)
pRtlUserThreadStart
;
context
.
SegCs
=
cs64_sel
;
context
.
SegDs
=
ds64_sel
;
context
.
SegEs
=
ds64_sel
;
context
.
SegGs
=
ds64_sel
;
context
.
SegSs
=
ds64_sel
;
context
.
EFlags
=
0x200
;
context
.
EFlags
=
0x200
;
context
.
u
.
FltSave
.
ControlWord
=
0x27f
;
context
.
u
.
FltSave
.
ControlWord
=
0x27f
;
context
.
u
.
FltSave
.
MxCsr
=
context
.
MxCsr
=
0x1f80
;
context
.
u
.
FltSave
.
MxCsr
=
context
.
MxCsr
=
0x1f80
;
__asm__
(
"movw %%cs,%0"
:
"=m"
(
context
.
SegCs
)
);
__asm__
(
"movw %%ss,%0"
:
"=m"
(
context
.
SegSs
)
);
if
((
wow_context
=
get_cpu_area
(
IMAGE_FILE_MACHINE_I386
)))
{
wow_context
->
ContextFlags
=
CONTEXT_I386_ALL
;
wow_context
->
Eax
=
(
ULONG_PTR
)
entry
;
wow_context
->
Ebx
=
(
ULONG_PTR
)
arg
;
wow_context
->
Esp
=
get_wow_teb
(
teb
)
->
Tib
.
StackBase
-
16
;
wow_context
->
Eip
=
(
ULONG_PTR
)
pRtlUserThreadStart
;
wow_context
->
SegCs
=
cs32_sel
;
wow_context
->
SegDs
=
context
.
SegDs
;
wow_context
->
SegEs
=
context
.
SegEs
;
wow_context
->
SegFs
=
context
.
SegFs
;
wow_context
->
SegGs
=
context
.
SegGs
;
wow_context
->
SegSs
=
context
.
SegSs
;
wow_context
->
EFlags
=
0x202
;
wow_context
->
FloatSave
.
ControlWord
=
context
.
u
.
FltSave
.
ControlWord
;
*
(
XSAVE_FORMAT
*
)
wow_context
->
ExtendedRegisters
=
context
.
u
.
FltSave
;
}
if
(
suspend
)
wait_suspend
(
&
context
);
if
(
suspend
)
wait_suspend
(
&
context
);
...
...
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