diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-08 18:16:22 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-08 18:16:22 +0000 |
commit | f75316c3ab99e80e78cbf72293f9c929dc8eb02f (patch) | |
tree | b2a2b061747edfb84be000b0226dfd7105a6b1db /MdeModulePkg/Core | |
parent | d1cab2b8c1de0bee896422550ab02b214c568ac2 (diff) | |
download | edk2-platforms-f75316c3ab99e80e78cbf72293f9c929dc8eb02f.tar.xz |
MdeModulePkg/Dxe: Move assertions inside CoreInsertGcdMapEntry()
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
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index ab8677a972..05f711de2e 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -393,10 +393,10 @@ CoreInsertGcdMapEntry ( )
{
ASSERT (Length != 0);
- ASSERT (TopEntry->Signature == 0);
- ASSERT (BottomEntry->Signature == 0);
if (BaseAddress > Entry->BaseAddress) {
+ ASSERT (BottomEntry->Signature == 0);
+
CopyMem (BottomEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));
Entry->BaseAddress = BaseAddress;
BottomEntry->EndAddress = BaseAddress - 1;
@@ -404,6 +404,8 @@ CoreInsertGcdMapEntry ( }
if ((BaseAddress + Length - 1) < Entry->EndAddress) {
+ ASSERT (TopEntry->Signature == 0);
+
CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));
TopEntry->BaseAddress = BaseAddress + Length;
Entry->EndAddress = BaseAddress + Length - 1;
|