UefiCpuPkg: Use Top of each AP's stack to save CpuMpData

To remove the dependency of CPU register, 4/8 byte at the top of the
stack is occupied for CpuMpData. BIST information is also taken care
here. This modification is only for PEI phase, since in DXE phase
CpuMpData is accessed via global variable.

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
This commit is contained in:
Yuanhao Xie
2022-08-19 14:17:28 +08:00
committed by mergify[bot]
parent 76cf3d35e6
commit 9ab2b34dd4
5 changed files with 59 additions and 13 deletions

View File

@@ -239,11 +239,20 @@ ProgramStack:
mov rsp, qword [rdi + CPU_INFO_IN_HOB.ApTopOfStack]
CProcedureInvoke:
;
; Reserve 8 bytes for CpuMpData.
; When the AP wakes up again via INIT-SIPI-SIPI, push 0 will cause the existing CpuMpData to be overwritten with 0.
; CpuMpData is filled in via InitializeApData() during the first time INIT-SIPI-SIPI,
; while overwirrten may occurs when under ApInHltLoop but InitFlag is not set to ApInitConfig.
; Therefore reservation is implemented by sub rsp instead of push 0.
;
sub rsp, 8
push rbp ; Push BIST data at top of AP stack
xor rbp, rbp ; Clear ebp for call stack trace
push rbp
mov rbp, rsp
push qword 0 ; Push 8 bytes for alignment
mov rax, qword [esi + MP_CPU_EXCHANGE_INFO_FIELD (InitializeFloatingPointUnits)]
sub rsp, 20h
call rax ; Call assembly function to initialize FPU per UEFI spec