[memmap] Rename addr/last fields to min/max for clarity

Use the terminology "min" and "max" for addresses covered by a memory
region descriptor, since this is sufficiently intuitive to generally
not require further explanation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-23 16:55:42 +01:00
parent cd38ed4fab
commit 036e43334a
12 changed files with 69 additions and 73 deletions
+2 -2
View File
@@ -364,8 +364,8 @@ int initrd_region ( size_t len, struct memmap_region *region ) {
min, ( min + available ) );
/* Populate region descriptor */
region->addr = min;
region->last = ( min + available - 1 );
region->min = min;
region->max = ( min + available - 1 );
region->flags = MEMMAP_FL_MEMORY;
region->name = "initrd";
+2 -2
View File
@@ -105,7 +105,7 @@ static int lkrn_ram ( struct image *image, struct lkrn_context *ctx ) {
memmap_dump ( &region );
if ( ! ( region.flags & MEMMAP_FL_MEMORY ) )
continue;
ctx->ram = region.addr;
ctx->ram = region.min;
DBGC ( image, "LKRN %s RAM starts at %#08lx\n",
image->name, ctx->ram );
return 0;
@@ -181,7 +181,7 @@ static int lkrn_exec ( struct image *image ) {
/* Check that everything can be placed at its target addresses */
totalsz = ( ctx.fdt + fdtimg.len - ctx.ram );
if ( ( ctx.entry >= region.addr ) &&
if ( ( ctx.entry >= region.min ) &&
( ( ctx.offset + totalsz ) <= memmap_size ( &region ) ) ) {
/* Target addresses are within the reshuffle region */
DBGC ( image, "LKRN %s fits within reshuffle region\n",
+4 -4
View File
@@ -63,7 +63,7 @@ int prep_segment ( void *segment, size_t filesz, size_t memsz ) {
physaddr_t start = virt_to_phys ( segment );
physaddr_t mid = ( start + filesz );
physaddr_t end = ( start + memsz );
physaddr_t last;
physaddr_t max;
DBGC ( &region, "SEGMENT [%#08lx,%#08lx,%#08lx)\n", start, mid, end );
@@ -77,10 +77,10 @@ int prep_segment ( void *segment, size_t filesz, size_t memsz ) {
/* Zero-length segments do not need a memory region */
if ( memsz == 0 )
return 0;
last = ( end - 1 );
max = ( end - 1 );
/* Check for address space overflow */
if ( last < start ) {
if ( max < start ) {
DBGC ( &region, "SEGMENT [%#08lx,%#08lx,%#08lx) wraps "
"around\n", start, mid, end );
return -EINVAL;
@@ -91,7 +91,7 @@ int prep_segment ( void *segment, size_t filesz, size_t memsz ) {
memmap_dump ( &region );
/* Fail unless region is usable and sufficiently large */
if ( ( ! memmap_is_usable ( &region ) ) || ( region.last < last ) ) {
if ( ( ! memmap_is_usable ( &region ) ) || ( region.max < max ) ) {
DBGC ( &region, "SEGMENT [%#08lx,%#08lx,%#08lx) does not fit "
"into available memory\n", start, mid, end );
return -ERANGE_SEGMENT;