]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[fdtmem] Allow iPXE to be relocated to the top of the address space
authorMichael Brown <mcb30@ipxe.org>
Thu, 22 May 2025 15:13:36 +0000 (16:13 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 22 May 2025 15:16:14 +0000 (16:16 +0100)
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 <mcb30@ipxe.org>
src/core/fdtmem.c

index b357287c5ce38b183cef1898cdd50f53e5caffb5..ef1ceb59df30be0caaca04af5bcbb456dc2cdf10 100644 (file)
@@ -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 ( &region ) && ( next >= len ) ) {
+               if ( memmap_is_usable ( &region ) &&
+                    ( ( next == 0 ) || ( next >= len ) ) ) {
 
                        /* Determine candidate address after alignment */
                        try = ( ( next - len ) & ~( max_align - 1 ) );