// Peripheral space after DRAM\r
VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length;\r
VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase;\r
- VirtualMemoryTable[2].Length = ArmGetPhysAddrTop () - VirtualMemoryTable[2].PhysicalBase;\r
+ VirtualMemoryTable[2].Length = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize),\r
+ ArmGetPhysAddrTop ()) -\r
+ VirtualMemoryTable[2].PhysicalBase;\r
VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
\r
// Remap the FD region as normal executable memory\r