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
e5e857c2
Commit
e5e857c2
authored
Dec 01, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add support for dispatching exception from 32-bit code in Wow64 mode.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
971480aa
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletion
+29
-1
loader.c
dlls/ntdll/loader.c
+3
-0
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-0
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+24
-1
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+1
-0
No files found.
dlls/ntdll/loader.c
View file @
e5e857c2
...
...
@@ -3855,6 +3855,8 @@ static void load_global_options(void)
static
void
(
WINAPI
*
pWow64LdrpInitialize
)(
CONTEXT
*
ctx
);
void
(
WINAPI
*
pWow64PrepareForException
)(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
)
=
NULL
;
static
void
init_wow64
(
CONTEXT
*
context
)
{
if
(
!
imports_fixup_done
)
...
...
@@ -3874,6 +3876,7 @@ static void init_wow64( CONTEXT *context )
if (!(p ## name = RtlFindExportedRoutineByName( wow64, #name ))) ERR( "failed to load %s\n", #name )
GET_PTR
(
Wow64LdrpInitialize
);
GET_PTR
(
Wow64PrepareForException
);
#undef GET_PTR
imports_fixup_done
=
TRUE
;
}
...
...
dlls/ntdll/ntdll_misc.h
View file @
e5e857c2
...
...
@@ -52,6 +52,7 @@ extern void WINAPI LdrInitializeThunk(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR) DE
extern
NTSTATUS
WINAPI
KiUserExceptionDispatcher
(
EXCEPTION_RECORD
*
,
CONTEXT
*
)
DECLSPEC_HIDDEN
;
extern
void
WINAPI
KiUserApcDispatcher
(
CONTEXT
*
,
ULONG_PTR
,
ULONG_PTR
,
ULONG_PTR
,
PNTAPCFUNC
)
DECLSPEC_HIDDEN
;
extern
void
WINAPI
KiUserCallbackDispatcher
(
ULONG
,
void
*
,
ULONG
)
DECLSPEC_HIDDEN
;
extern
void
(
WINAPI
*
pWow64PrepareForException
)(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
extern
RUNTIME_FUNCTION
*
lookup_function_info
(
ULONG_PTR
pc
,
ULONG_PTR
*
base
,
LDR_DATA_TABLE_ENTRY
**
module
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/signal_x86_64.c
View file @
e5e857c2
...
...
@@ -566,12 +566,35 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
}
NTSTATUS
WINAPI
dispatch_wow_exception
(
EXCEPTION_RECORD
*
rec_ptr
,
CONTEXT
*
context_ptr
)
{
char
buffer
[
sizeof
(
CONTEXT
)
+
sizeof
(
CONTEXT_EX
)
+
sizeof
(
XSTATE
)
+
128
];
CONTEXT
*
context
;
CONTEXT_EX
*
context_ex
;
EXCEPTION_RECORD
rec
=
*
rec_ptr
;
RtlInitializeExtendedContext
(
buffer
,
context_ptr
->
ContextFlags
,
&
context_ex
);
context
=
RtlLocateLegacyContext
(
context_ex
,
NULL
);
RtlCopyContext
(
context
,
context_ptr
->
ContextFlags
,
context_ptr
);
pWow64PrepareForException
(
&
rec
,
context
);
return
dispatch_exception
(
&
rec
,
context
);
}
/*******************************************************************
* KiUserExceptionDispatcher (NTDLL.@)
*/
__ASM_GLOBAL_FUNC
(
KiUserExceptionDispatcher
,
"mov 0x98(%rsp),%rcx
\n\t
"
/* context->Rsp */
"mov 0xf8(%rsp),%rdx
\n\t
"
/* context->Rip */
"movw %cs,%ax
\n\t
"
"cmpw %ax,0x38(%rsp)
\n\t
"
/* context->SegCs */
"je 1f
\n\t
"
"mov %rsp,%rdx
\n\t
"
/* context */
"lea 0x4f0(%rsp),%rcx
\n\t
"
/* rec */
"movq %r14,%rsp
\n\t
"
/* switch to 64-bit stack */
"call "
__ASM_NAME
(
"dispatch_wow_exception"
)
"
\n\t
"
"int3
\n
"
"1:
\t
mov 0xf8(%rsp),%rdx
\n\t
"
/* context->Rip */
"mov %rdx,-0x8(%rcx)
\n\t
"
"mov %rbp,-0x10(%rcx)
\n\t
"
"mov %rdi,-0x18(%rcx)
\n\t
"
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
e5e857c2
...
...
@@ -2171,6 +2171,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec
}
}
CS_sig
(
sigcontext
)
=
cs64_sel
;
RIP_sig
(
sigcontext
)
=
(
ULONG_PTR
)
pKiUserExceptionDispatcher
;
RSP_sig
(
sigcontext
)
=
(
ULONG_PTR
)
stack
;
/* clear single-step, direction, and align check flag */
...
...
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