mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/PiSmmCpuDxeSmm:Check resource HOB range before mapping
This commit is to check if the resource HOB range does not exceed the max supported physical address. The function BuildMemoryMapFromResDescHobs is to build Memory Region from resource HOBs. Then the memory maps will be used during creating or modifying SMM page table. If the resource HOB range exceeds the max supported physical address, then subsequent calling of PageTableMap() will fail. Signed-off-by: Dun Tan <dun.tan@intel.com>
This commit is contained in:
parent
065df32de3
commit
468b3d9589
|
@ -125,11 +125,14 @@ BuildMemoryMapFromResDescHobs (
|
|||
EFI_PEI_HOB_POINTERS Hob;
|
||||
UINTN Count;
|
||||
UINTN Index;
|
||||
EFI_PHYSICAL_ADDRESS MaxPhysicalAddress;
|
||||
EFI_PHYSICAL_ADDRESS ResourceHobEnd;
|
||||
|
||||
ASSERT (MemoryRegion != NULL && MemoryRegionCount != NULL);
|
||||
|
||||
*MemoryRegion = NULL;
|
||||
*MemoryRegionCount = 0;
|
||||
MaxPhysicalAddress = LShiftU64 (1, mPhysicalAddressBits);
|
||||
|
||||
//
|
||||
// Get the count.
|
||||
|
@ -138,6 +141,13 @@ BuildMemoryMapFromResDescHobs (
|
|||
Hob.Raw = GetFirstHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR);
|
||||
while (Hob.Raw != NULL) {
|
||||
if ((Hob.ResourceDescriptor->ResourceAttribute & MM_RESOURCE_ATTRIBUTE_LOGGING) == 0) {
|
||||
ResourceHobEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength;
|
||||
|
||||
ASSERT (ResourceHobEnd <= MaxPhysicalAddress);
|
||||
if (ResourceHobEnd > MaxPhysicalAddress) {
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
//
|
||||
// Resource HOBs describe all accessible non-smram regions.
|
||||
// Logging attribute range is treated as not present. Not-present ranges are not included in this memory map.
|
||||
|
|
Loading…
Reference in New Issue