Dump EFI memory mappings

This commit is contained in:
Rafal Kupiec 2022-12-29 17:09:44 +01:00
parent 6a27ea140b
commit 7f21e4f19c
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 12 additions and 2 deletions

View File

@ -137,7 +137,8 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
return Status;
}
/* Iterate through all mappings */
/* Iterate through and map all the mappings*/
BlDbgPrint(L"Mapping and dumping EFI memory:\n");
ListEntry = MemoryMappings->Flink;
while(ListEntry != MemoryMappings)
{
@ -147,6 +148,10 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
/* Check if virtual address is set */
if(Mapping->VirtualAddress)
{
/* Dump memory mapping */
BlDbgPrint(L" Type=%02lu, PhysicalBase=0x%016lx, VirtualBase=0x%016lx, Pages=%lu\n", Mapping->MemoryType,
Mapping->PhysicalAddress, Mapping->VirtualAddress, Mapping->NumberOfPages);
/* Map memory */
Status = BlMapVirtualMemory(MemoryMappings, (UINT_PTR)Mapping->VirtualAddress,
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages, PtePointer);

View File

@ -223,7 +223,8 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
return Status;
}
/* Iterate through all mappings */
/* Iterate through and map all the mappings*/
BlDbgPrint(L"Mapping and dumping EFI memory:\n");
ListEntry = MemoryMappings->Flink;
while(ListEntry != MemoryMappings)
{
@ -233,6 +234,10 @@ BlEnablePaging(IN PLIST_ENTRY MemoryMappings,
/* Check if virtual address is set */
if(Mapping->VirtualAddress)
{
/* Dump memory mapping */
BlDbgPrint(L" Type=%02lu, PhysicalBase=0x%08lx, VirtualBase=0x%08lx, Pages=%lu\n", Mapping->MemoryType,
Mapping->PhysicalAddress, Mapping->VirtualAddress, Mapping->NumberOfPages);
/* Map memory */
Status = BlMapVirtualMemory(MemoryMappings, (UINT_PTR)Mapping->VirtualAddress,
(UINT_PTR)Mapping->PhysicalAddress, Mapping->NumberOfPages, PtePointer);