To fix
[mirror_edk2.git] / EdkModulePkg / Core / DxeIplPeim / Ia32 / VirtualMemory.c
index 609fea2eca629a4ebe0bd26fb64d39e22559b7dd..89b18c36f8cf9e9d09b0fdcfa466501433a778b3 100644 (file)
@@ -57,7 +57,6 @@ Returns:
 \r
 --*/\r
 {  \r
-  UINT32                                        RegEax;\r
   UINT8                                         PhysicalAddressBits;\r
   EFI_PHYSICAL_ADDRESS                          PageAddress;\r
   UINTN                                         IndexOfPml4Entries;\r
@@ -71,16 +70,16 @@ Returns:
   PAGE_TABLE_ENTRY                              *PageDirectoryEntry;\r
   UINTN                                         TotalPagesNum;\r
   UINTN                                         BigPageAddress;\r
+  VOID                                          *Hob;\r
 \r
   //\r
-  // Get physical address bits supported.\r
+  // Get physical address bits supported from CPU HOB.\r
   //\r
-  AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);\r
-  if (RegEax >= 0x80000008) {\r
-    AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);\r
-    PhysicalAddressBits = (UINT8) RegEax;\r
-  } else {\r
-    PhysicalAddressBits = 36;\r
+  PhysicalAddressBits = 36;\r
+  \r
+  Hob = GetFirstHob (EFI_HOB_TYPE_CPU);\r
+  if (Hob != NULL) {\r
+    PhysicalAddressBits = ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace;    \r
   }\r
 \r
   //\r