[memmap] Use memmap_dump_all() to dump debug memory maps

There are several places where get_memmap() is called solely to
produce debug output.  Replace these with calls to memmap_dump_all()
(which will be a no-op unless debugging is enabled).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-15 17:09:35 +01:00
parent 3812860e39
commit a353e70800
2 changed files with 6 additions and 9 deletions

View File

@@ -164,20 +164,19 @@ void int15_intercept ( int intercept ) {
* returned by the BIOS. * returned by the BIOS.
*/ */
static void hide_etherboot ( void ) { static void hide_etherboot ( void ) {
struct memory_map memmap;
unsigned int rm_ds_top; unsigned int rm_ds_top;
unsigned int rm_cs_top; unsigned int rm_cs_top;
unsigned int fbms; unsigned int fbms;
/* Dump memory map before mangling */ /* Dump memory map before mangling */
DBG ( "Hiding iPXE from system memory map\n" ); DBG ( "Hiding iPXE from system memory map\n" );
get_memmap ( &memmap ); memmap_dump_all ( 1 );
/* Hook in fake E820 map, if we're testing one */ /* Hook in fake E820 map, if we're testing one */
if ( FAKE_E820 ) { if ( FAKE_E820 ) {
DBG ( "Hooking in fake E820 map\n" ); DBG ( "Hooking in fake E820 map\n" );
fake_e820(); fake_e820();
get_memmap ( &memmap ); memmap_dump_all ( 1 );
} }
/* Initialise the hidden regions */ /* Initialise the hidden regions */
@@ -210,7 +209,7 @@ static void hide_etherboot ( void ) {
/* Dump memory map after mangling */ /* Dump memory map after mangling */
DBG ( "Hidden iPXE from system memory map\n" ); DBG ( "Hidden iPXE from system memory map\n" );
get_memmap ( &memmap ); memmap_dump_all ( 1 );
} }
/** /**
@@ -220,7 +219,6 @@ static void hide_etherboot ( void ) {
* possible. * possible.
*/ */
static void unhide_etherboot ( int flags __unused ) { static void unhide_etherboot ( int flags __unused ) {
struct memory_map memmap;
int rc; int rc;
/* If we have more than one hooked interrupt at this point, it /* If we have more than one hooked interrupt at this point, it
@@ -251,7 +249,7 @@ static void unhide_etherboot ( int flags __unused ) {
/* Dump memory map after unhiding */ /* Dump memory map after unhiding */
DBG ( "Unhidden iPXE from system memory map\n" ); DBG ( "Unhidden iPXE from system memory map\n" );
get_memmap ( &memmap ); memmap_dump_all ( 1 );
} }
/** Hide Etherboot startup function */ /** Hide Etherboot startup function */

View File

@@ -31,12 +31,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include <ipxe/blockdev.h> #include <ipxe/blockdev.h>
#include <ipxe/io.h>
#include <ipxe/acpi.h> #include <ipxe/acpi.h>
#include <ipxe/sanboot.h> #include <ipxe/sanboot.h>
#include <ipxe/device.h> #include <ipxe/device.h>
#include <ipxe/pci.h> #include <ipxe/pci.h>
#include <ipxe/eltorito.h> #include <ipxe/eltorito.h>
#include <ipxe/memmap.h>
#include <realmode.h> #include <realmode.h>
#include <bios.h> #include <bios.h>
#include <biosint.h> #include <biosint.h>
@@ -1523,7 +1523,6 @@ static int int13_load_eltorito ( unsigned int drive, struct segoff *address ) {
*/ */
static int int13_boot ( unsigned int drive, static int int13_boot ( unsigned int drive,
struct san_boot_config *config __unused ) { struct san_boot_config *config __unused ) {
struct memory_map memmap;
struct segoff address; struct segoff address;
int rc; int rc;
@@ -1537,7 +1536,7 @@ static int int13_boot ( unsigned int drive,
* many problems that turn out to be memory-map related that * many problems that turn out to be memory-map related that
* it's worth doing. * it's worth doing.
*/ */
get_memmap ( &memmap ); memmap_dump_all ( 1 );
/* Jump to boot sector */ /* Jump to boot sector */
if ( ( rc = call_bootsector ( address.segment, address.offset, if ( ( rc = call_bootsector ( address.segment, address.offset,