mirror of
https://github.com/reactos/reactos.git
synced 2025-04-30 02:58:48 +00:00
[NTOS:KE/x64] Loop in KiInitiateUserApc
This is required since while interrupts are enabled, another user APC could get queued and we want to guarantee that those are all delivered before returning to user mode.
This commit is contained in:
parent
e3bfcdf9e2
commit
36fa628605
1 changed files with 11 additions and 5 deletions
|
@ -1150,21 +1150,27 @@ PUBLIC KiInitiateUserApc
|
||||||
mov rax, APC_LEVEL
|
mov rax, APC_LEVEL
|
||||||
mov cr8, rax
|
mov cr8, rax
|
||||||
|
|
||||||
|
/* Get the current thread */
|
||||||
|
mov rbp, gs:[PcCurrentThread]
|
||||||
|
|
||||||
|
deliver_apcs:
|
||||||
|
|
||||||
/* Enable interrupts */
|
/* Enable interrupts */
|
||||||
sti
|
sti
|
||||||
|
|
||||||
/* Get the current trap frame */
|
|
||||||
mov rax, gs:[PcCurrentThread]
|
|
||||||
mov r8, [rax + KTHREAD_TrapFrame]
|
|
||||||
|
|
||||||
/* Call the C function */
|
/* Call the C function */
|
||||||
mov ecx, 1
|
mov ecx, 1
|
||||||
mov rdx, rsp
|
mov rdx, rsp
|
||||||
|
mov r8, [rbp + ThTrapFrame]
|
||||||
call KiDeliverApc
|
call KiDeliverApc
|
||||||
|
|
||||||
/* Disable interrupts again */
|
/* Disable interrupts again */
|
||||||
cli
|
cli
|
||||||
|
|
||||||
|
/* Check if there are more APCs to deliver */
|
||||||
|
cmp byte ptr [rbp + ThApcState + AsUserApcPending], 0
|
||||||
|
jne deliver_apcs
|
||||||
|
|
||||||
/* Go back to PASSIVE_LEVEL */
|
/* Go back to PASSIVE_LEVEL */
|
||||||
mov rax, PASSIVE_LEVEL
|
mov rax, PASSIVE_LEVEL
|
||||||
mov cr8, rax
|
mov cr8, rax
|
||||||
|
|
Loading…
Reference in a new issue