diff --git a/MdeModulePkg/Core/Dxe/SysCall/X64/CoreBootServices.nasm b/MdeModulePkg/Core/Dxe/SysCall/X64/CoreBootServices.nasm index 3c88b9a743..3f9f4661ce 100644 --- a/MdeModulePkg/Core/Dxe/SysCall/X64/CoreBootServices.nasm +++ b/MdeModulePkg/Core/Dxe/SysCall/X64/CoreBootServices.nasm @@ -151,6 +151,8 @@ ASM_PFX(CoreBootServices): push r8 push rdx mov rbp, rsp + ; Reserve space on stack for 3 CallBootService arguments (NOOPT prerequisite). + sub rsp, 8*3 ; Prepare CallBootService arguments. mov rcx, r10 @@ -166,8 +168,8 @@ ASM_PFX(CoreBootServices): pop rax - ; Step over Arguments [1..3]. - add rsp, 8*3 + ; Step over Arguments [1..3] and NOOPT buffer. + add rsp, 8*6 ; Prepare SYSRET arguments. pop r11