;------------------------------------------------------------------------------\r
global ASM_PFX(FspSwitchStack)\r
ASM_PFX(FspSwitchStack):\r
- ; Save current contexts\r
+ ; Save current contexts. The format must align with CONTEXT_STACK_64.\r
+ push rdx ; Reserved QWORD for stack alignment\r
push rdx ; ApiParam2\r
push rcx ; ApiParam1\r
push rax ; FspInfoHeader\r
add rsp, 16\r
POPA_64\r
popfq\r
- add rsp, 24 ; FspInfoHeader + ApiParam[2]\r
+ add rsp, 32 ; FspInfoHeader + ApiParam[2] + Reserved QWORD\r
ret\r
\r