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
e30f091f
Commit
e30f091f
authored
Aug 04, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64cpu: Restore the full 32-bit context when changed externally.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f60fd0e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
3 deletions
+46
-3
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+3
-0
cpu.c
dlls/wow64cpu/cpu.c
+39
-1
wow64cpu.spec
dlls/wow64cpu/wow64cpu.spec
+2
-2
winternl.h
include/winternl.h
+2
-0
No files found.
dlls/ntdll/unix/signal_x86_64.c
View file @
e30f091f
...
@@ -1957,12 +1957,15 @@ NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG size )
...
@@ -1957,12 +1957,15 @@ NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG size )
}
}
if
(
flags
&
CONTEXT_I386_CONTROL
)
if
(
flags
&
CONTEXT_I386_CONTROL
)
{
{
WOW64_CPURESERVED
*
cpu
=
NtCurrentTeb
()
->
TlsSlots
[
WOW64_TLS_CPURESERVED
];
wow_frame
->
Esp
=
context
->
Esp
;
wow_frame
->
Esp
=
context
->
Esp
;
wow_frame
->
Ebp
=
context
->
Ebp
;
wow_frame
->
Ebp
=
context
->
Ebp
;
wow_frame
->
Eip
=
context
->
Eip
;
wow_frame
->
Eip
=
context
->
Eip
;
wow_frame
->
EFlags
=
context
->
EFlags
;
wow_frame
->
EFlags
=
context
->
EFlags
;
wow_frame
->
SegCs
=
cs32_sel
;
wow_frame
->
SegCs
=
cs32_sel
;
wow_frame
->
SegSs
=
ds64_sel
;
wow_frame
->
SegSs
=
ds64_sel
;
cpu
->
Flags
|=
WOW64_CPURESERVED_FLAG_RESET_STATE
;
}
}
if
(
flags
&
CONTEXT_I386_SEGMENTS
)
if
(
flags
&
CONTEXT_I386_SEGMENTS
)
{
{
...
...
dlls/wow64cpu/cpu.c
View file @
e30f091f
...
@@ -82,13 +82,33 @@ __ASM_GLOBAL_FUNC( syscall_32to64,
...
@@ -82,13 +82,33 @@ __ASM_GLOBAL_FUNC( syscall_32to64,
"movl 0xa0(%r13),%esi
\n\t
"
/* context->Esi */
"movl 0xa0(%r13),%esi
\n\t
"
/* context->Esi */
"movl 0xa4(%r13),%ebx
\n\t
"
/* context->Ebx */
"movl 0xa4(%r13),%ebx
\n\t
"
/* context->Ebx */
"movl 0xb4(%r13),%ebp
\n\t
"
/* context->Ebp */
"movl 0xb4(%r13),%ebp
\n\t
"
/* context->Ebp */
"btrl $0,-4(%r13)
\n\t
"
/* cpu->Flags & WOW64_CPURESERVED_FLAG_RESET_STATE */
"jc 1f
\n\t
"
"movl 0xb8(%r13),%edx
\n\t
"
/* context->Eip */
"movl 0xb8(%r13),%edx
\n\t
"
/* context->Eip */
"movl %edx,(%rsp)
\n\t
"
"movl %edx,(%rsp)
\n\t
"
"movl 0xbc(%r13),%edx
\n\t
"
/* context->SegCs */
"movl 0xbc(%r13),%edx
\n\t
"
/* context->SegCs */
"movl %edx,4(%rsp)
\n\t
"
"movl %edx,4(%rsp)
\n\t
"
"movl 0xc4(%r13),%r14d
\n\t
"
/* context->Esp */
"movl 0xc4(%r13),%r14d
\n\t
"
/* context->Esp */
"xchgq %r14,%rsp
\n\t
"
"xchgq %r14,%rsp
\n\t
"
"ljmp *(%r14)"
)
"ljmp *(%r14)
\n
"
"1:
\t
movq %rsp,%r14
\n\t
"
"movl 0xa8(%r13),%edx
\n\t
"
/* context->Edx */
"movl 0xac(%r13),%ecx
\n\t
"
/* context->Ecx */
"movl 0xc8(%r13),%eax
\n\t
"
/* context->SegSs */
"movq %rax,0x20(%rsp)
\n\t
"
"mov %ax,%ds
\n\t
"
"mov %ax,%es
\n\t
"
"mov 0x90(%r13),%fs
\n\t
"
/* context->SegFs */
"movl 0xc4(%r13),%eax
\n\t
"
/* context->Esp */
"movq %rax,0x18(%rsp)
\n\t
"
"movl 0xc0(%r13),%eax
\n\t
"
/* context->EFlags */
"movq %rax,0x10(%rsp)
\n\t
"
"movl 0xbc(%r13),%eax
\n\t
"
/* context->SegCs */
"movq %rax,0x8(%rsp)
\n\t
"
"movl 0xb8(%r13),%eax
\n\t
"
/* context->Eip */
"movq %rax,(%rsp)
\n\t
"
"movl 0xb0(%r13),%eax
\n\t
"
/* context->Eax */
"iretq"
)
/**********************************************************************
/**********************************************************************
...
@@ -137,3 +157,21 @@ void * WINAPI BTCpuGetBopCode(void)
...
@@ -137,3 +157,21 @@ void * WINAPI BTCpuGetBopCode(void)
{
{
return
code_buffer
;
return
code_buffer
;
}
}
/**********************************************************************
* BTCpuGetContext (wow64cpu.@)
*/
NTSTATUS
WINAPI
BTCpuGetContext
(
HANDLE
thread
,
HANDLE
process
,
void
*
unknown
,
I386_CONTEXT
*
ctx
)
{
return
NtQueryInformationThread
(
thread
,
ThreadWow64Context
,
ctx
,
sizeof
(
*
ctx
),
NULL
);
}
/**********************************************************************
* BTCpuSetContext (wow64cpu.@)
*/
NTSTATUS
WINAPI
BTCpuSetContext
(
HANDLE
thread
,
HANDLE
process
,
void
*
unknown
,
I386_CONTEXT
*
ctx
)
{
return
NtSetInformationThread
(
thread
,
ThreadWow64Context
,
ctx
,
sizeof
(
*
ctx
)
);
}
dlls/wow64cpu/wow64cpu.spec
View file @
e30f091f
@ stdcall BTCpuGetBopCode()
@ stdcall BTCpuGetBopCode()
#@ stub BTCpuGetContext
@ stdcall BTCpuGetContext(long long ptr ptr)
@ stdcall BTCpuProcessInit()
@ stdcall BTCpuProcessInit()
#@ stub BTCpuResetToConsistentState
#@ stub BTCpuResetToConsistentState
#@ stub BTCpuSetContext
@ stdcall BTCpuSetContext(long long ptr ptr)
@ stdcall BTCpuSimulate()
@ stdcall BTCpuSimulate()
#@ stub BTCpuTurboThunkControl
#@ stub BTCpuTurboThunkControl
#@ stub TurboDispatchJumpAddressEnd
#@ stub TurboDispatchJumpAddressEnd
...
...
include/winternl.h
View file @
e30f091f
...
@@ -3727,6 +3727,8 @@ typedef struct _WOW64_CPURESERVED
...
@@ -3727,6 +3727,8 @@ typedef struct _WOW64_CPURESERVED
/* CONTEXT_EX *context_ex */
/* CONTEXT_EX *context_ex */
}
WOW64_CPURESERVED
,
*
PWOW64_CPURESERVED
;
}
WOW64_CPURESERVED
,
*
PWOW64_CPURESERVED
;
#define WOW64_CPURESERVED_FLAG_RESET_STATE 1
typedef
struct
_WOW64_CPU_AREA_INFO
typedef
struct
_WOW64_CPU_AREA_INFO
{
{
void
*
Context
;
void
*
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