]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Dxe: Move assertions inside CoreInsertGcdMapEntry()
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 8 Aug 2011 18:16:22 +0000 (18:16 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 8 Aug 2011 18:16:22 +0000 (18:16 +0000)
CoreInsertGcdMapEntry() does not assume the new region could overlap two existing GCDs.
In this case, we need to call this function twice and the TopEntry or BottomEntry could
have been updated by the previous call.

Reviewed by: rsun3
Reviewed by: lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12097 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/Gcd/Gcd.c

index ab8677a972740016fbb44ec77e3b9e019a07c0df..05f711de2e97eadbfaf61afa812d6335a0fe1662 100644 (file)
@@ -393,10 +393,10 @@ CoreInsertGcdMapEntry (
   )\r
 {\r
   ASSERT (Length != 0);\r
   )\r
 {\r
   ASSERT (Length != 0);\r
-  ASSERT (TopEntry->Signature == 0);\r
-  ASSERT (BottomEntry->Signature == 0);\r
 \r
   if (BaseAddress > Entry->BaseAddress) {\r
 \r
   if (BaseAddress > Entry->BaseAddress) {\r
+    ASSERT (BottomEntry->Signature == 0);\r
+\r
     CopyMem (BottomEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));\r
     Entry->BaseAddress      = BaseAddress;\r
     BottomEntry->EndAddress = BaseAddress - 1;\r
     CopyMem (BottomEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));\r
     Entry->BaseAddress      = BaseAddress;\r
     BottomEntry->EndAddress = BaseAddress - 1;\r
@@ -404,6 +404,8 @@ CoreInsertGcdMapEntry (
   }\r
 \r
   if ((BaseAddress + Length - 1) < Entry->EndAddress) {\r
   }\r
 \r
   if ((BaseAddress + Length - 1) < Entry->EndAddress) {\r
+    ASSERT (TopEntry->Signature == 0);\r
+\r
     CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));\r
     TopEntry->BaseAddress = BaseAddress + Length;\r
     Entry->EndAddress     = BaseAddress + Length - 1;\r
     CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));\r
     TopEntry->BaseAddress = BaseAddress + Length;\r
     Entry->EndAddress     = BaseAddress + Length - 1;\r