ArmPlatformPkg/PrePeiCore: seed temporary stack before entering PEI core
DEBUG builds of PEI code will print a diagnostic message regarding
the utilization of temporary RAM before switching to permanent RAM.
For example,
Total temporary memory: 16352 bytes.
temporary memory stack ever used: 4820 bytes.
temporary memory heap used for HobList: 4720 bytes.
Tracking stack utilization like this requires the stack to be seeded
with a known magic value, and this needs to occur before entering C
code, given that it uses the stack. Currently, only Nt32Pkg appears
to implement this feature, but it is useful nonetheless, so let's
wire it up for PrePeiCore.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
@@ -84,4 +84,10 @@ _PrepareArguments:
|
|||||||
|
|
||||||
_SetupPrimaryCoreStack:
|
_SetupPrimaryCoreStack:
|
||||||
mov sp, x1
|
mov sp, x1
|
||||||
|
MOV64 (x8, FixedPcdGet64 (PcdCPUCoresStackBase))
|
||||||
|
MOV64 (x9, FixedPcdGet32 (PcdInitValueInTempStack) |\
|
||||||
|
FixedPcdGet32 (PcdInitValueInTempStack) << 32)
|
||||||
|
0:stp x9, x9, [x8], #16
|
||||||
|
cmp x8, x1
|
||||||
|
b.lt 0b
|
||||||
b _PrepareArguments
|
b _PrepareArguments
|
||||||
|
|||||||
@@ -65,6 +65,14 @@ _PrepareArguments:
|
|||||||
|
|
||||||
_SetupPrimaryCoreStack:
|
_SetupPrimaryCoreStack:
|
||||||
mov sp, r1
|
mov sp, r1
|
||||||
|
MOV32 (r8, FixedPcdGet64 (PcdCPUCoresStackBase))
|
||||||
|
MOV32 (r9, FixedPcdGet32 (PcdInitValueInTempStack))
|
||||||
|
mov r10, r9
|
||||||
|
mov r11, r9
|
||||||
|
mov r12, r9
|
||||||
|
0:stm r8!, {r9-r12}
|
||||||
|
cmp r8, r1
|
||||||
|
blt 0b
|
||||||
b _PrepareArguments
|
b _PrepareArguments
|
||||||
|
|
||||||
_NeverReturn:
|
_NeverReturn:
|
||||||
|
|||||||
@@ -79,6 +79,14 @@ _PrepareArguments
|
|||||||
|
|
||||||
_SetupPrimaryCoreStack
|
_SetupPrimaryCoreStack
|
||||||
mov sp, r1
|
mov sp, r1
|
||||||
|
mov32 r8, FixedPcdGet64 (PcdCPUCoresStackBase)
|
||||||
|
mov32 r9, FixedPcdGet32 (PcdInitValueInTempStack)
|
||||||
|
mov r10, r9
|
||||||
|
mov r11, r9
|
||||||
|
mov r12, r9
|
||||||
|
0:stm r8!, {r9-r12}
|
||||||
|
cmp r8, r1
|
||||||
|
blt 0b
|
||||||
b _PrepareArguments
|
b _PrepareArguments
|
||||||
|
|
||||||
_NeverReturn
|
_NeverReturn
|
||||||
|
|||||||
@@ -75,3 +75,5 @@
|
|||||||
gArmTokenSpaceGuid.PcdGicDistributorBase
|
gArmTokenSpaceGuid.PcdGicDistributorBase
|
||||||
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
|
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
|
||||||
gArmTokenSpaceGuid.PcdGicSgiIntId
|
gArmTokenSpaceGuid.PcdGicSgiIntId
|
||||||
|
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
|
||||||
|
|||||||
@@ -69,3 +69,5 @@
|
|||||||
gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
|
gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
|
||||||
gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
|
gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
|
||||||
gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
|
gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
|
||||||
|
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
|
||||||
|
|||||||
Reference in New Issue
Block a user