Skip to content

Commit

Permalink
[efi] Show memory map returned by wrapped calls to GetMemoryMap
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Sep 22, 2020
1 parent e08ad61 commit fe69934
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/interface/efi/efi_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,36 @@ efi_get_memory_map_wrapper ( UINTN *memory_map_size,
UINT32 *descriptor_version ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
void *retaddr = __builtin_return_address ( 0 );
EFI_MEMORY_DESCRIPTOR *desc;
size_t remaining;
EFI_STATUS efirc;

DBGC ( colour, "GetMemoryMap ( %#llx, %p ) ",
( ( unsigned long long ) *memory_map_size ), memory_map );
efirc = bs->GetMemoryMap ( memory_map_size, memory_map, map_key,
descriptor_size, descriptor_version );
DBGC ( colour, "= %s ( %#llx, %#llx, %#llx, v%d ) -> %p\n",
DBGC ( colour, "= %s ( %#llx, %#llx, %#llx, v%d",
efi_status ( efirc ),
( ( unsigned long long ) *memory_map_size ),
( ( unsigned long long ) *map_key ),
( ( unsigned long long ) *descriptor_size ),
*descriptor_version, retaddr );
*descriptor_version );
if ( DBG_EXTRA && ( efirc == 0 ) ) {
DBGC2 ( colour, ",\n" );
for ( desc = memory_map, remaining = *memory_map_size ;
remaining >= *descriptor_size ;
desc = ( ( ( void * ) desc ) + *descriptor_size ),
remaining -= *descriptor_size ) {
DBGC2 ( colour, "%#016llx+%#08llx %#016llx "
"%s\n", desc->PhysicalStart,
( desc->NumberOfPages * EFI_PAGE_SIZE ),
desc->Attribute,
efi_memory_type ( desc->Type ) );
}
} else {
DBGC ( colour, " " );
}
DBGC ( colour, ") -> %p\n", retaddr );
return efirc;
}

Expand Down

0 comments on commit fe69934

Please sign in to comment.