From: Michael Brown Date: Thu, 22 May 2025 15:13:36 +0000 (+0100) Subject: [fdtmem] Allow iPXE to be relocated to the top of the address space X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b9095a045aeebefc0beff8ea2d30d7d0b73e44a0;p=thirdparty%2Fipxe.git [fdtmem] Allow iPXE to be relocated to the top of the address space Allow for relocation to a region at the very end of the physical address space (where the next address wraps to zero). Signed-off-by: Michael Brown --- diff --git a/src/core/fdtmem.c b/src/core/fdtmem.c index b357287c5..ef1ceb59d 100644 --- a/src/core/fdtmem.c +++ b/src/core/fdtmem.c @@ -300,7 +300,8 @@ physaddr_t fdtmem_relocate ( struct fdt_header *hdr, physaddr_t max ) { assert ( region.last >= region.addr ); /* Use highest possible region */ - if ( memmap_is_usable ( ®ion ) && ( next >= len ) ) { + if ( memmap_is_usable ( ®ion ) && + ( ( next == 0 ) || ( next >= len ) ) ) { /* Determine candidate address after alignment */ try = ( ( next - len ) & ~( max_align - 1 ) );