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
78c2b7df
Commit
78c2b7df
authored
Jan 22, 2024
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use a .seh handler for KiUserCallbackDispatcher exceptions.
parent
47aebf67
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
13 deletions
+63
-13
exception.c
dlls/ntdll/exception.c
+21
-0
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+2
-0
signal_arm.c
dlls/ntdll/signal_arm.c
+12
-3
signal_arm64.c
dlls/ntdll/signal_arm64.c
+9
-5
signal_arm64ec.c
dlls/ntdll/signal_arm64ec.c
+9
-5
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+10
-0
No files found.
dlls/ntdll/exception.c
View file @
78c2b7df
...
...
@@ -185,6 +185,26 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
}
#if defined(__WINE_PE_BUILD) && !defined(__i386__)
/*******************************************************************
* user_callback_handler
*
* Exception handler for KiUserCallbackDispatcher.
*/
EXCEPTION_DISPOSITION
WINAPI
user_callback_handler
(
EXCEPTION_RECORD
*
record
,
void
*
frame
,
CONTEXT
*
context
,
void
*
dispatch
)
{
if
(
!
(
record
->
ExceptionFlags
&
(
EH_UNWINDING
|
EH_EXIT_UNWIND
)))
{
ERR
(
"ignoring exception %lx
\n
"
,
record
->
ExceptionCode
);
RtlUnwind
(
frame
,
KiUserCallbackDispatcherReturn
,
record
,
ULongToPtr
(
record
->
ExceptionCode
)
);
}
return
ExceptionContinueSearch
;
}
#else
/*******************************************************************
* dispatch_user_callback
*
...
...
@@ -208,6 +228,7 @@ NTSTATUS WINAPI dispatch_user_callback( void *args, ULONG len, ULONG id )
return
status
;
}
#endif
/*******************************************************************
* raise_status
...
...
dlls/ntdll/ntdll_misc.h
View file @
78c2b7df
...
...
@@ -50,6 +50,8 @@ extern UINT_PTR page_size;
/* exceptions */
extern
LONG
call_vectored_handlers
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
);
extern
NTSTATUS
WINAPI
dispatch_user_callback
(
void
*
args
,
ULONG
len
,
ULONG
id
);
extern
EXCEPTION_DISPOSITION
WINAPI
user_callback_handler
(
EXCEPTION_RECORD
*
record
,
void
*
frame
,
CONTEXT
*
context
,
void
*
dispatch
);
extern
void
DECLSPEC_NORETURN
raise_status
(
NTSTATUS
status
,
EXCEPTION_RECORD
*
rec
);
extern
LONG
WINAPI
call_unhandled_exception_filter
(
PEXCEPTION_POINTERS
eptr
);
...
...
dlls/ntdll/signal_arm.c
View file @
78c2b7df
...
...
@@ -585,10 +585,19 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
__ASM_EHABI
(
".save {sp, pc}
\n\t
"
)
__ASM_EHABI
(
".save {lr}
\n\t
"
)
__ASM_EHABI
(
".pad #0x0c
\n\t
"
)
"ldr r0, [sp]
\n\t
"
/* args */
"ldr r1, [sp, #0x04]
\n\t
"
/* len */
"ldr r2, [sp, #0x08]
\n\t
"
/* id */
"ldr r0, [sp]
\n\t
"
/* args */
"ldr r1, [sp, #0x04]
\n\t
"
/* len */
"ldr r2, [sp, #0x08]
\n\t
"
/* id */
#ifdef __WINE_PE_BUILD
"mrc p15, 0, r3, c13, c0, 2
\n\t
"
/* NtCurrentTeb() */
"ldr r3, [r3, 0x30]
\n\t
"
/* peb */
"ldr r3, [r3, 0x2c]
\n\t
"
/* peb->KernelCallbackTable */
"ldr ip, [r3, r2, lsl #3]
\n\t
"
"blx ip
\n\t
"
".seh_handler "
__ASM_NAME
(
"user_callback_handler"
)
", %except
\n\t
"
#else
"bl "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
#endif
".globl "
__ASM_NAME
(
"KiUserCallbackDispatcherReturn"
)
"
\n
"
__ASM_NAME
(
"KiUserCallbackDispatcherReturn"
)
":
\n\t
"
"mov r2, r0
\n\t
"
/* status */
...
...
dlls/ntdll/signal_arm64.c
View file @
78c2b7df
...
...
@@ -606,15 +606,19 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
* KiUserCallbackDispatcher (NTDLL.@)
*/
__ASM_GLOBAL_FUNC
(
KiUserCallbackDispatcher
,
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
".seh_pushframe
\n\t
"
"nop
\n\t
"
__ASM_SEH
(
".seh_stackalloc 0x20
\n\t
"
)
".seh_stackalloc 0x20
\n\t
"
"nop
\n\t
"
__ASM_SEH
(
".seh_save_reg lr, 0x18
\n\t
"
)
__ASM_SEH
(
".seh_endprologue
\n\t
"
)
".seh_save_reg lr, 0x18
\n\t
"
".seh_endprologue
\n\t
"
".seh_handler "
__ASM_NAME
(
"user_callback_handler"
)
", @except
\n\t
"
"ldr x0, [sp]
\n\t
"
/* args */
"ldp w1, w2, [sp, #0x08]
\n\t
"
/* len, id */
"bl "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
"ldr x3, [x18, 0x60]
\n\t
"
/* peb */
"ldr x3, [x3, 0x58]
\n\t
"
/* peb->KernelCallbackTable */
"ldr x15, [x3, x2, lsl #3]
\n\t
"
"blr x15
\n\t
"
".globl "
__ASM_NAME
(
"KiUserCallbackDispatcherReturn"
)
"
\n
"
__ASM_NAME
(
"KiUserCallbackDispatcherReturn"
)
":
\n\t
"
"mov x2, x0
\n\t
"
/* status */
...
...
dlls/ntdll/signal_arm64ec.c
View file @
78c2b7df
...
...
@@ -1717,15 +1717,19 @@ __ASM_GLOBAL_FUNC( "#KiUserApcDispatcher",
* KiUserCallbackDispatcher (NTDLL.@)
*/
__ASM_GLOBAL_FUNC
(
"#KiUserCallbackDispatcher"
,
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
".seh_pushframe
\n\t
"
"nop
\n\t
"
__ASM_SEH
(
".seh_stackalloc 0x20
\n\t
"
)
".seh_stackalloc 0x20
\n\t
"
"nop
\n\t
"
__ASM_SEH
(
".seh_save_reg lr, 0x18
\n\t
"
)
__ASM_SEH
(
".seh_endprologue
\n\t
"
)
".seh_save_reg lr, 0x18
\n\t
"
".seh_endprologue
\n\t
"
".seh_handler "
__ASM_NAME
(
"user_callback_handler"
)
", @except
\n\t
"
"ldr x0, [sp]
\n\t
"
/* args */
"ldp w1, w2, [sp, #0x08]
\n\t
"
/* len, id */
"bl "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
"ldr x3, [x18, 0x60]
\n\t
"
/* peb */
"ldr x3, [x3, 0x58]
\n\t
"
/* peb->KernelCallbackTable */
"ldr x15, [x3, x2, lsl #3]
\n\t
"
"blr x15
\n\t
"
".globl
\"
#KiUserCallbackDispatcherReturn
\"\n
"
"
\"
#KiUserCallbackDispatcherReturn
\"
:
\n\t
"
"mov x2, x0
\n\t
"
/* status */
...
...
dlls/ntdll/signal_x86_64.c
View file @
78c2b7df
...
...
@@ -702,7 +702,17 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
"movq 0x20(%rsp),%rcx
\n\t
"
/* args */
"movl 0x28(%rsp),%edx
\n\t
"
/* len */
"movl 0x2c(%rsp),%r8d
\n\t
"
/* id */
#ifdef __WINE_PE_BUILD
"movq %gs:0x30,%rax
\n\t
"
/* NtCurrentTeb() */
"movq 0x60(%rax),%rax
\n\t
"
/* peb */
"movq 0x58(%rax),%rax
\n\t
"
/* peb->KernelCallbackTable */
"call *(%rax,%r8,8)
\n\t
"
/* KernelCallbackTable[id] */
".seh_handler "
__ASM_NAME
(
"user_callback_handler"
)
", @except
\n\t
"
".globl "
__ASM_NAME
(
"KiUserCallbackDispatcherReturn"
)
"
\n
"
__ASM_NAME
(
"KiUserCallbackDispatcherReturn"
)
":
\n\t
"
#else
"call "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
#endif
"xorq %rcx,%rcx
\n\t
"
/* ret_ptr */
"xorl %edx,%edx
\n\t
"
/* ret_len */
"movl %eax,%r8d
\n\t
"
/* status */
...
...
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