diff --git a/OvmfPkg/RiscVVirt/Sec/SecMain.c b/OvmfPkg/RiscVVirt/Sec/SecMain.c index 73b9b21a67..adf73f2eb6 100644 --- a/OvmfPkg/RiscVVirt/Sec/SecMain.c +++ b/OvmfPkg/RiscVVirt/Sec/SecMain.c @@ -55,6 +55,7 @@ SecStartup ( EFI_STATUS Status; UINT64 UefiMemoryBase; UINT64 StackBase; + UINT32 StackSize; // // Report Status Code to indicate entering SEC core @@ -71,9 +72,9 @@ SecStartup ( FirmwareContext.FlattenedDeviceTree = (UINT64)DeviceTreeAddress; SetFirmwareContextPointer (&FirmwareContext); - StackBase = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + - FixedPcdGet32 (PcdOvmfSecPeiTempRamSize); - UefiMemoryBase = StackBase - SIZE_32MB; + StackBase = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase); + StackSize = FixedPcdGet32 (PcdOvmfSecPeiTempRamSize); + UefiMemoryBase = StackBase + StackSize - SIZE_32MB; // Declare the PI/UEFI memory region HobList = HobConstructor ( @@ -86,6 +87,8 @@ SecStartup ( SecInitializePlatform (); + BuildStackHob (StackBase, StackSize); + // // Process all libraries constructor function linked to SecMain. //