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
d89037a8
Commit
d89037a8
authored
Jan 22, 2024
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Share KiUserCallbackDispatcher implementation across platforms.
parent
3031f157
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
91 deletions
+54
-91
exception.c
dlls/ntdll/exception.c
+24
-0
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-0
signal_arm.c
dlls/ntdll/signal_arm.c
+6
-19
signal_arm64.c
dlls/ntdll/signal_arm64.c
+6
-19
signal_arm64ec.c
dlls/ntdll/signal_arm64ec.c
+6
-19
signal_i386.c
dlls/ntdll/signal_i386.c
+3
-15
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+8
-19
No files found.
dlls/ntdll/exception.c
View file @
d89037a8
...
@@ -186,6 +186,30 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
...
@@ -186,6 +186,30 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
/*******************************************************************
/*******************************************************************
* dispatch_user_callback
*
* Implementation of KiUserCallbackDispatcher.
*/
NTSTATUS
WINAPI
dispatch_user_callback
(
void
*
args
,
ULONG
len
,
ULONG
id
)
{
NTSTATUS
status
;
__TRY
{
KERNEL_CALLBACK_PROC
func
=
NtCurrentTeb
()
->
Peb
->
KernelCallbackTable
[
id
];
status
=
func
(
args
,
len
);
}
__EXCEPT_ALL
{
ERR
(
"ignoring exception
\n
"
);
status
=
STATUS_SUCCESS
;
}
__ENDTRY
return
status
;
}
/*******************************************************************
* raise_status
* raise_status
*
*
* Implementation of RtlRaiseStatus with a specific exception record.
* Implementation of RtlRaiseStatus with a specific exception record.
...
...
dlls/ntdll/ntdll_misc.h
View file @
d89037a8
...
@@ -49,6 +49,7 @@ extern UINT_PTR page_size;
...
@@ -49,6 +49,7 @@ extern UINT_PTR page_size;
/* exceptions */
/* exceptions */
extern
LONG
call_vectored_handlers
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
);
extern
LONG
call_vectored_handlers
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
);
extern
NTSTATUS
WINAPI
dispatch_user_callback
(
void
*
args
,
ULONG
len
,
ULONG
id
);
extern
void
DECLSPEC_NORETURN
raise_status
(
NTSTATUS
status
,
EXCEPTION_RECORD
*
rec
);
extern
void
DECLSPEC_NORETURN
raise_status
(
NTSTATUS
status
,
EXCEPTION_RECORD
*
rec
);
extern
LONG
WINAPI
call_unhandled_exception_filter
(
PEXCEPTION_POINTERS
eptr
);
extern
LONG
WINAPI
call_unhandled_exception_filter
(
PEXCEPTION_POINTERS
eptr
);
...
...
dlls/ntdll/signal_arm.c
View file @
d89037a8
...
@@ -575,24 +575,6 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
...
@@ -575,24 +575,6 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
/*******************************************************************
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
* KiUserCallbackDispatcher (NTDLL.@)
*/
*/
void
WINAPI
dispatch_callback
(
void
*
args
,
ULONG
len
,
ULONG
id
)
{
NTSTATUS
status
;
__TRY
{
KERNEL_CALLBACK_PROC
func
=
NtCurrentTeb
()
->
Peb
->
KernelCallbackTable
[
id
];
status
=
NtCallbackReturn
(
NULL
,
0
,
func
(
args
,
len
));
}
__EXCEPT_ALL
{
ERR_
(
seh
)(
"ignoring exception
\n
"
);
status
=
NtCallbackReturn
(
0
,
0
,
0
);
}
__ENDTRY
RtlRaiseStatus
(
status
);
}
__ASM_GLOBAL_FUNC
(
KiUserCallbackDispatcher
,
__ASM_GLOBAL_FUNC
(
KiUserCallbackDispatcher
,
__ASM_SEH
(
".seh_custom 0xee,0x01
\n\t
"
)
/* MSFT_OP_MACHINE_FRAME */
__ASM_SEH
(
".seh_custom 0xee,0x01
\n\t
"
)
/* MSFT_OP_MACHINE_FRAME */
"nop
\n\t
"
"nop
\n\t
"
...
@@ -606,7 +588,12 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
...
@@ -606,7 +588,12 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
"ldr r0, [sp]
\n\t
"
/* args */
"ldr r0, [sp]
\n\t
"
/* args */
"ldr r1, [sp, #0x04]
\n\t
"
/* len */
"ldr r1, [sp, #0x04]
\n\t
"
/* len */
"ldr r2, [sp, #0x08]
\n\t
"
/* id */
"ldr r2, [sp, #0x08]
\n\t
"
/* id */
"bl "
__ASM_NAME
(
"dispatch_callback"
)
"
\n\t
"
"bl "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
"mov r2, r0
\n\t
"
/* status */
"mov r1, #0
\n\t
"
/* ret_len */
"mov r0, r1
\n\t
"
/* ret_ptr */
"bl "
__ASM_NAME
(
"NtCallbackReturn"
)
"
\n\t
"
"bl "
__ASM_NAME
(
"RtlRaiseStatus"
)
"
\n\t
"
"udf #1"
)
"udf #1"
)
...
...
dlls/ntdll/signal_arm64.c
View file @
d89037a8
...
@@ -605,24 +605,6 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
...
@@ -605,24 +605,6 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
/*******************************************************************
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
* KiUserCallbackDispatcher (NTDLL.@)
*/
*/
void
WINAPI
dispatch_callback
(
void
*
args
,
ULONG
len
,
ULONG
id
)
{
NTSTATUS
status
;
__TRY
{
KERNEL_CALLBACK_PROC
func
=
NtCurrentTeb
()
->
Peb
->
KernelCallbackTable
[
id
];
status
=
NtCallbackReturn
(
NULL
,
0
,
func
(
args
,
len
));
}
__EXCEPT_ALL
{
ERR_
(
seh
)(
"ignoring exception
\n
"
);
status
=
NtCallbackReturn
(
0
,
0
,
0
);
}
__ENDTRY
RtlRaiseStatus
(
status
);
}
__ASM_GLOBAL_FUNC
(
KiUserCallbackDispatcher
,
__ASM_GLOBAL_FUNC
(
KiUserCallbackDispatcher
,
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
"nop
\n\t
"
"nop
\n\t
"
...
@@ -632,7 +614,12 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
...
@@ -632,7 +614,12 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
__ASM_SEH
(
".seh_endprologue
\n\t
"
)
__ASM_SEH
(
".seh_endprologue
\n\t
"
)
"ldr x0, [sp]
\n\t
"
/* args */
"ldr x0, [sp]
\n\t
"
/* args */
"ldp w1, w2, [sp, #0x08]
\n\t
"
/* len, id */
"ldp w1, w2, [sp, #0x08]
\n\t
"
/* len, id */
"bl "
__ASM_NAME
(
"dispatch_callback"
)
"
\n\t
"
"bl "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
"mov x2, x0
\n\t
"
/* status */
"mov x1, #0
\n\t
"
/* ret_len */
"mov x0, x1
\n\t
"
/* ret_ptr */
"bl "
__ASM_NAME
(
"NtCallbackReturn"
)
"
\n\t
"
"bl "
__ASM_NAME
(
"RtlRaiseStatus"
)
"
\n\t
"
"brk #1"
)
"brk #1"
)
...
...
dlls/ntdll/signal_arm64ec.c
View file @
d89037a8
...
@@ -1716,24 +1716,6 @@ __ASM_GLOBAL_FUNC( "#KiUserApcDispatcher",
...
@@ -1716,24 +1716,6 @@ __ASM_GLOBAL_FUNC( "#KiUserApcDispatcher",
/*******************************************************************
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
* KiUserCallbackDispatcher (NTDLL.@)
*/
*/
void
WINAPI
dispatch_callback
(
void
*
args
,
ULONG
len
,
ULONG
id
)
{
NTSTATUS
status
;
__TRY
{
KERNEL_CALLBACK_PROC
func
=
NtCurrentTeb
()
->
Peb
->
KernelCallbackTable
[
id
];
status
=
NtCallbackReturn
(
NULL
,
0
,
func
(
args
,
len
));
}
__EXCEPT_ALL
{
ERR_
(
seh
)(
"ignoring exception
\n
"
);
status
=
NtCallbackReturn
(
0
,
0
,
0
);
}
__ENDTRY
RtlRaiseStatus
(
status
);
}
__ASM_GLOBAL_FUNC
(
"#KiUserCallbackDispatcher"
,
__ASM_GLOBAL_FUNC
(
"#KiUserCallbackDispatcher"
,
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
"nop
\n\t
"
"nop
\n\t
"
...
@@ -1743,7 +1725,12 @@ __ASM_GLOBAL_FUNC( "#KiUserCallbackDispatcher",
...
@@ -1743,7 +1725,12 @@ __ASM_GLOBAL_FUNC( "#KiUserCallbackDispatcher",
__ASM_SEH
(
".seh_endprologue
\n\t
"
)
__ASM_SEH
(
".seh_endprologue
\n\t
"
)
"ldr x0, [sp]
\n\t
"
/* args */
"ldr x0, [sp]
\n\t
"
/* args */
"ldp w1, w2, [sp, #0x08]
\n\t
"
/* len, id */
"ldp w1, w2, [sp, #0x08]
\n\t
"
/* len, id */
"bl "
__ASM_NAME
(
"dispatch_callback"
)
"
\n\t
"
"bl "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
"mov x2, x0
\n\t
"
/* status */
"mov x1, #0
\n\t
"
/* ret_len */
"mov x0, x1
\n\t
"
/* ret_ptr */
"bl "
__ASM_NAME
(
"NtCallbackReturn"
)
"
\n\t
"
"bl "
__ASM_NAME
(
"RtlRaiseStatus"
)
"
\n\t
"
"brk #1"
)
"brk #1"
)
...
...
dlls/ntdll/signal_i386.c
View file @
d89037a8
...
@@ -294,21 +294,9 @@ __ASM_STDCALL_FUNC( KiUserApcDispatcher, 20,
...
@@ -294,21 +294,9 @@ __ASM_STDCALL_FUNC( KiUserApcDispatcher, 20,
*/
*/
void
WINAPI
KiUserCallbackDispatcher
(
ULONG
id
,
void
*
args
,
ULONG
len
)
void
WINAPI
KiUserCallbackDispatcher
(
ULONG
id
,
void
*
args
,
ULONG
len
)
{
{
NTSTATUS
status
;
NTSTATUS
status
=
dispatch_user_callback
(
args
,
len
,
id
);
status
=
NtCallbackReturn
(
NULL
,
0
,
status
);
__TRY
for
(;;)
RtlRaiseStatus
(
status
);
{
KERNEL_CALLBACK_PROC
func
=
NtCurrentTeb
()
->
Peb
->
KernelCallbackTable
[
id
];
status
=
NtCallbackReturn
(
NULL
,
0
,
func
(
args
,
len
));
}
__EXCEPT_ALL
{
ERR_
(
seh
)(
"ignoring exception
\n
"
);
status
=
NtCallbackReturn
(
0
,
0
,
0
);
}
__ENDTRY
RtlRaiseStatus
(
status
);
}
}
...
...
dlls/ntdll/signal_x86_64.c
View file @
d89037a8
...
@@ -691,24 +691,6 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
...
@@ -691,24 +691,6 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
/*******************************************************************
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
* KiUserCallbackDispatcher (NTDLL.@)
*/
*/
void
WINAPI
dispatch_callback
(
void
*
args
,
ULONG
len
,
ULONG
id
)
{
NTSTATUS
status
;
__TRY
{
KERNEL_CALLBACK_PROC
func
=
NtCurrentTeb
()
->
Peb
->
KernelCallbackTable
[
id
];
status
=
NtCallbackReturn
(
NULL
,
0
,
func
(
args
,
len
));
}
__EXCEPT_ALL
{
ERR_
(
seh
)(
"ignoring exception
\n
"
);
status
=
NtCallbackReturn
(
0
,
0
,
0
);
}
__ENDTRY
RtlRaiseStatus
(
status
);
}
__ASM_GLOBAL_FUNC
(
KiUserCallbackDispatcher
,
__ASM_GLOBAL_FUNC
(
KiUserCallbackDispatcher
,
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
__ASM_SEH
(
".seh_pushframe
\n\t
"
)
__ASM_SEH
(
".seh_stackalloc 0x30
\n\t
"
)
__ASM_SEH
(
".seh_stackalloc 0x30
\n\t
"
)
...
@@ -720,7 +702,14 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
...
@@ -720,7 +702,14 @@ __ASM_GLOBAL_FUNC( KiUserCallbackDispatcher,
"movq 0x20(%rsp),%rcx
\n\t
"
/* args */
"movq 0x20(%rsp),%rcx
\n\t
"
/* args */
"movl 0x28(%rsp),%edx
\n\t
"
/* len */
"movl 0x28(%rsp),%edx
\n\t
"
/* len */
"movl 0x2c(%rsp),%r8d
\n\t
"
/* id */
"movl 0x2c(%rsp),%r8d
\n\t
"
/* id */
"call "
__ASM_NAME
(
"dispatch_callback"
)
)
"call "
__ASM_NAME
(
"dispatch_user_callback"
)
"
\n\t
"
"xorq %rcx,%rcx
\n\t
"
/* ret_ptr */
"xorl %edx,%edx
\n\t
"
/* ret_len */
"movl %eax,%r8d
\n\t
"
/* status */
"call "
__ASM_NAME
(
"NtCallbackReturn"
)
"
\n\t
"
"movl %eax,%ecx
\n\t
"
/* status */
"call "
__ASM_NAME
(
"RtlRaiseStatus"
)
"
\n\t
"
"int3"
)
/**************************************************************************
/**************************************************************************
...
...
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