diff --git a/sdk/xtdk/bltypes.h b/sdk/xtdk/bltypes.h index 0b14b24..e667d28 100644 --- a/sdk/xtdk/bltypes.h +++ b/sdk/xtdk/bltypes.h @@ -189,6 +189,7 @@ typedef struct _XTBL_MODULE_INFO typedef struct _XTBL_PAGE_MAPPING { LIST_ENTRY MemoryMap; + ULONG MapSize; PVOID PtePointer; SHORT PageMapLevel; PAGE_SIZE PageSize; diff --git a/xtldr/memory.c b/xtldr/memory.c index 8ae89d1..dc90a9c 100644 --- a/xtldr/memory.c +++ b/xtldr/memory.c @@ -178,6 +178,7 @@ BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap, { /* Initialize memory mappings */ RtlInitializeListHead(&PageMap->MemoryMap); + PageMap->MapSize = 0; /* Set page map size/level and memory map address */ PageMap->PageMapLevel = PageMapLevel; @@ -457,8 +458,9 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap, ListEntry = ListEntry->Flink; } - /* Insert new mapping to the list */ + /* Insert new mapping to the list and increase page map size */ RtlInsertTailList(&PageMap->MemoryMap, &Mapping1->ListEntry); + PageMap->MapSize++; /* Return success */ return STATUS_EFI_SUCCESS;