From dc8d93ca0c9a798fe4e23f68b5b5adc032bf5509 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Tue, 23 Sep 2008 14:49:45 +0000 Subject: [PATCH] add detail comments on the complicated code segment. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5954 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Mem/Page.c | 23 ++++++++++++++--------- MdeModulePkg/Core/Dxe/Mem/Pool.c | 4 ++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 5e3c81d786..c55bbe3b92 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -35,18 +35,20 @@ typedef struct { // UINTN mMemoryMapKey = 0; -// -// mMapStack - space to use as temp storage to build new map descriptors -// mMapDepth - depth of new descriptor stack -// - #define MAX_MAP_DEPTH 6 + +/// +/// mMapDepth - depth of new descriptor stack +/// UINTN mMapDepth = 0; +/// +/// mMapStack - space to use as temp storage to build new map descriptors +/// MEMORY_MAP mMapStack[MAX_MAP_DEPTH]; UINTN mFreeMapStack = 0; -// -// This list maintain the free memory map list -// +/// +/// This list maintain the free memory map list +/// LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList); BOOLEAN mMemoryTypeInformationInitialized = FALSE; @@ -1287,7 +1289,10 @@ CoreGetMemoryMap ( if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) || (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) { if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) { - + // + // Create EFI_MEMORY_DESCRIPTOR for every Reserved and MMIO GCD entries + // that are marked for runtime use + // MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress; MemoryMap->VirtualStart = 0; MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT); diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index cea6fada4c..ce70cff513 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -124,6 +124,10 @@ LookupPoolHead ( return &mPoolHead[MemoryType]; } + // + // MemoryType values in the range 0x80000000..0xFFFFFFFF are reserved for use by UEFI + // OS loaders that are provided by operating system vendors + // if (MemoryType < 0) { for (Link = mPoolHeadList.ForwardLink; Link != &mPoolHeadList; Link = Link->ForwardLink) { -- 2.39.2