[memmap] Allow explicit colour selection for memory map debug messages

Provide DBGC_MEMMAP() as a replacement for memmap_dump(), allowing the
colour used to match other messages within the same message group.

Retain a dedicated colour for output from memmap_dump_all(), on the
basis that it is generally most useful to visually compare full memory
dumps against previous full memory dumps.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-25 12:06:53 +01:00
parent 8d88870da5
commit 09140ab2c1
7 changed files with 36 additions and 33 deletions
+1 -1
View File
@@ -102,7 +102,7 @@ static int lkrn_ram ( struct image *image, struct lkrn_context *ctx ) {
/* Locate start of RAM */
for_each_memmap ( &region, 0 ) {
memmap_dump ( &region );
DBGC_MEMMAP ( image, &region );
if ( ! ( region.flags & MEMMAP_FL_MEMORY ) )
continue;
ctx->ram = region.min;
+5 -5
View File
@@ -65,11 +65,11 @@ int prep_segment ( void *segment, size_t filesz, size_t memsz ) {
physaddr_t end = ( start + memsz );
physaddr_t max;
DBGC ( &region, "SEGMENT [%#08lx,%#08lx,%#08lx)\n", start, mid, end );
DBGC ( segment, "SEGMENT [%#08lx,%#08lx,%#08lx)\n", start, mid, end );
/* Check for malformed lengths */
if ( filesz > memsz ) {
DBGC ( &region, "SEGMENT [%#08lx,%#08lx,%#08lx) is "
DBGC ( segment, "SEGMENT [%#08lx,%#08lx,%#08lx) is "
"malformed\n", start, mid, end );
return -EINVAL;
}
@@ -81,18 +81,18 @@ int prep_segment ( void *segment, size_t filesz, size_t memsz ) {
/* Check for address space overflow */
if ( max < start ) {
DBGC ( &region, "SEGMENT [%#08lx,%#08lx,%#08lx) wraps "
DBGC ( segment, "SEGMENT [%#08lx,%#08lx,%#08lx) wraps "
"around\n", start, mid, end );
return -EINVAL;
}
/* Describe region containing this segment */
memmap_describe ( start, 1, &region );
memmap_dump ( &region );
DBGC_MEMMAP ( segment, &region );
/* Fail unless region is usable and sufficiently large */
if ( ( ! memmap_is_usable ( &region ) ) || ( region.max < max ) ) {
DBGC ( &region, "SEGMENT [%#08lx,%#08lx,%#08lx) does not fit "
DBGC ( segment, "SEGMENT [%#08lx,%#08lx,%#08lx) does not fit "
"into available memory\n", start, mid, end );
return -ERANGE_SEGMENT;
}