From b9095a045aeebefc0beff8ea2d30d7d0b73e44a0 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 22 May 2025 16:13:36 +0100 Subject: [PATCH] [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 --- src/core/fdtmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 ) ); -- 2.47.3