audk/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib
Star Zeng ecf85eb24c MdeModulePkg PiSmmCoreMemoryAllocLib: Fix a FreePool() assertion issue
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>
2017-08-01 17:44:02 +08:00
..
MemoryAllocationLib.c MdeModulePkg PiSmmCoreMemoryAllocLib: Fix a FreePool() assertion issue 2017-08-01 17:44:02 +08:00
PiSmmCoreMemoryAllocationLib.inf MdeModulePkg PiSmmCoreMemoryAllocLib: Extend to support MemoryProfileLib 2016-07-01 09:39:59 +08:00
PiSmmCoreMemoryAllocationLib.uni MdeModulePkg PiSmmCoreMemoryAllocLib: Extend to support MemoryProfileLib 2016-07-01 09:39:59 +08:00
PiSmmCoreMemoryAllocationProfileLib.inf MdeModulePkg PiSmmCoreMemoryAllocLib: Extend to support MemoryProfileLib 2016-07-01 09:39:59 +08:00
PiSmmCoreMemoryAllocationProfileLib.uni MdeModulePkg PiSmmCoreMemoryAllocLib: Extend to support MemoryProfileLib 2016-07-01 09:39:59 +08:00
PiSmmCoreMemoryAllocationServices.h MdeModulePkg PiSmmCore: Remove a hidden assumption of SMRAM reservation 2015-07-26 07:38:12 +00:00
PiSmmCoreMemoryProfileLib.c MdeModulePkg/Library: Fix typos in comments and variables 2016-10-27 09:11:19 +08:00
PiSmmCoreMemoryProfileLibNull.c MdeModulePkg PiSmmCoreMemoryAllocLib: Extend to support MemoryProfileLib 2016-07-01 09:39:59 +08:00
PiSmmCoreMemoryProfileServices.h MdeModulePkg PiSmmCoreMemoryAllocLib: Extend to support MemoryProfileLib 2016-07-01 09:39:59 +08:00