summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/Library/MpInitLib/X64
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-11-23 21:52:24 +0800
committerJeff Fan <jeff.fan@intel.com>2016-11-28 08:56:36 +0800
commitbf2786dc7900cb5ef04c9c5c720c0a26f11898b8 (patch)
tree1d9a01d51ed600239a40a2f871ff378fb8001d44 /UefiCpuPkg/Library/MpInitLib/X64
parent081f6416ff7c2b6a2fe91bb96cdb645c3890a6f3 (diff)
downloadedk2-bf2786dc7900cb5ef04c9c5c720c0a26f11898b8.tar.gz
edk2-bf2786dc7900cb5ef04c9c5c720c0a26f11898b8.tar.bz2
edk2-bf2786dc7900cb5ef04c9c5c720c0a26f11898b8.zip
UefiCpuPkg/DxeMpLib: Allocate new safe stack < 4GB
For long mode DXE, we will disable paging on AP to protected mode to execute AP safe loop code in reserved memory range under 4GB. But we forget to allocate stack for AP under 4GB and AP still are using original AP stack. If original AP stack is larger than 4GB, it cannot be used after AP is transferred to protected mode. Besides MwaitSupport == TRUE, AP stack is still required during phase of disabling paging in long mode DXE. Moreover, even though AP stack is always under 4GB (a) in Ia32 DXE and (b) with this patch, after transferring to protected mode from X64 DXE, AP stack (in BootServiceData) maybe crashed by OS after Exit Boot Service event. This fix is to allocate reserved memory range under 4GB together with AP safe loop code. APs will switch to new stack in safe loop code. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'UefiCpuPkg/Library/MpInitLib/X64')
-rw-r--r--UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm3
1 files changed, 2 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
index e7e7d8086d..7869970bbb 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
@@ -222,11 +222,12 @@ CProcedureInvoke:
RendezvousFunnelProcEnd:
;-------------------------------------------------------------------------------------
-; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment);
+; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack);
;-------------------------------------------------------------------------------------
global ASM_PFX(AsmRelocateApLoop)
ASM_PFX(AsmRelocateApLoop):
AsmRelocateApLoopStart:
+ mov rsp, r9
push rcx
push rdx