mirror of
https://github.com/reactos/reactos.git
synced 2025-07-30 18:01:36 +00:00
[NTOS:KE/x64][SDK] Add HANDLE_USER_APCS asm macro
This also fixes delivering APCs from the system call handler, which previously would have clobbered rax. Also don't use the thread's TrapFrame member, which is not always set, when returning.
This commit is contained in:
parent
88e24bc463
commit
24b4026ce8
2 changed files with 33 additions and 13 deletions
|
@ -37,6 +37,19 @@ IrqlIsPassive:
|
|||
#endif
|
||||
ENDM
|
||||
|
||||
// Checks for user APCs and delivers them if necessary.
|
||||
// Clobbers all volatile registers except rax.
|
||||
MACRO(HANDLE_USER_APCS, ThreadReg, TrapFrame)
|
||||
LOCAL NoUserApcPending
|
||||
|
||||
/* Check for pending user APC */
|
||||
cmp byte ptr [ThreadReg + ThApcState + AsUserApcPending], 0
|
||||
jz NoUserApcPending
|
||||
lea rcx, [TrapFrame]
|
||||
call KiInitiateUserApc
|
||||
NoUserApcPending:
|
||||
ENDM
|
||||
|
||||
APIC_EOI = HEX(0FFFFFFFFFFFE00B0)
|
||||
|
||||
TF_VOLATILES = HEX(01)
|
||||
|
@ -195,7 +208,6 @@ ENDM
|
|||
*/
|
||||
MACRO(ExitTrap, Flags)
|
||||
LOCAL kernel_mode_return
|
||||
LOCAL NoUserApc
|
||||
|
||||
ASSERT_TRAP_FRAME_IRQL_VALID rbp
|
||||
|
||||
|
@ -217,12 +229,8 @@ MACRO(ExitTrap, Flags)
|
|||
jz kernel_mode_return
|
||||
|
||||
if (Flags AND TF_CHECKUSERAPC)
|
||||
/* Load current thread into r10 */
|
||||
mov r10, gs:[PcCurrentThread]
|
||||
cmp byte ptr [r10 + KTHREAD_UserApcPending], 0
|
||||
je NoUserApc
|
||||
call KiInitiateUserApc
|
||||
NoUserApc:
|
||||
HANDLE_USER_APCS r10, rbp
|
||||
endif
|
||||
|
||||
ASSERT_TRAP_FRAME_INTS_ENABLED rbp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue