[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 <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-22 16:13:36 +01:00
parent a534563345
commit b9095a045a

View 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 ) );