summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2025-05-22 17:13:36 +0200
committerMichael Brown2025-05-22 17:16:14 +0200
commitb9095a045aeebefc0beff8ea2d30d7d0b73e44a0 (patch)
tree3957880ca2d18321d00234463140c3895fe1c48e /src/core
parent[riscv] Speed up memmove() when copying in forwards direction (diff)
downloadipxe-b9095a045aeebefc0beff8ea2d30d7d0b73e44a0.tar.gz
ipxe-b9095a045aeebefc0beff8ea2d30d7d0b73e44a0.tar.xz
ipxe-b9095a045aeebefc0beff8ea2d30d7d0b73e44a0.zip
[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>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/fdtmem.c3
1 files changed, 2 insertions, 1 deletions
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 ( &region ) && ( next >= len ) ) {
+ if ( memmap_is_usable ( &region ) &&
+ ( ( next == 0 ) || ( next >= len ) ) ) {
/* Determine candidate address after alignment */
try = ( ( next - len ) & ~( max_align - 1 ) );