mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 10:28:45 +00:00
[NTOSKRNL/x64] Fix a bug in KeSwitchKernelStack
Don't safe anything in the callee's home space, because the callee can overwrite it. Use the functions home space instead.
This commit is contained in:
parent
d41a4030bc
commit
26a64324e7
1 changed files with 4 additions and 5 deletions
|
@ -1213,19 +1213,18 @@ EXTERN KiSwitchKernelStack:PROC
|
|||
PUBLIC KeSwitchKernelStack
|
||||
FUNC KeSwitchKernelStack
|
||||
|
||||
/* Save rcx and allocate callee home space */
|
||||
mov [rsp + P1Home], rcx
|
||||
.savereg rcx, P1Home
|
||||
sub rsp, 40
|
||||
.allocstack 40
|
||||
|
||||
/* Save rcx */
|
||||
mov [rsp], rcx
|
||||
.savereg rcx, 0
|
||||
.endprolog
|
||||
|
||||
/* Call the C handler, which returns the old stack in rax */
|
||||
call KiSwitchKernelStack
|
||||
|
||||
/* Restore rcx (StackBase) */
|
||||
mov rcx, [rsp]
|
||||
mov rcx, [rsp + 40 + P1Home]
|
||||
|
||||
/* Switch to new stack: RSP += (StackBase - OldStackBase) */
|
||||
sub rcx, rax
|
||||
|
|
Loading…
Reference in a new issue