mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
When PiSmmCore links against PeiDxeDebugLibReportStatusCode, the code flow below will cause a FreePool() assertion issue. PiSmmCoreMemoryAllocationLibConstructor() -> SmmInitializeMemoryServices() -> DEBUG ((DEBUG_INFO, "SmmAddMemoryRegion\n")) in SmmAddMemoryRegion() -> DebugPrint() -> REPORT_STATUS_CODE_EX() -> ReportStatusCodeEx() -> AllocatePool()/FreePool(PiSmmCoreMemoryAllocLib) -> ASSERT() at Head = CR (Buffer, POOL_HEAD, Data, POOL_HEAD_SIGNATURE) in CoreFreePoolI() of DxeCore Pool.c It is because at the point of FreePool() in the code flow above, mSmmCoreMemoryAllocLibSmramRanges/mSmmCoreMemoryAllocLibSmramRangeCount are not been initialized yet, the FreePool() will be directed to gBS->FreePool(), that is wrong. This patch is to temporarily use BootServicesData to hold the SmramRanges data before calling SmmInitializeMemoryServices(). Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> |
||
|---|---|---|
| .. | ||
| MemoryAllocationLib.c | ||
| PiSmmCoreMemoryAllocationLib.inf | ||
| PiSmmCoreMemoryAllocationLib.uni | ||
| PiSmmCoreMemoryAllocationProfileLib.inf | ||
| PiSmmCoreMemoryAllocationProfileLib.uni | ||
| PiSmmCoreMemoryAllocationServices.h | ||
| PiSmmCoreMemoryProfileLib.c | ||
| PiSmmCoreMemoryProfileLibNull.c | ||
| PiSmmCoreMemoryProfileServices.h | ||