summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib/reloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lib/reloc.c')
-rw-r--r--arch/mips/lib/reloc.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index b084a88be7..a9078aa813 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -41,7 +41,7 @@
#include <asm-generic/memory_layout.h>
void main_entry(void *fdt, u32 fdt_size);
-void relocate_code(void *fdt, u32 fdt_size, u32 relocaddr);
+void __noreturn relocate_code(void *fdt, u32 fdt_size, u32 relocaddr);
/**
* read_uint() - Read an unsigned integer from the buffer
@@ -106,10 +106,9 @@ static void apply_reloc(unsigned int type, void *addr, long off)
}
}
-void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
+void __noreturn relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
{
- unsigned long addr, length, bss_len;
- u32 relocaddr, new_stack;
+ unsigned long addr, length, bss_len, relocaddr, new_stack;
uint8_t *buf;
unsigned int type;
long off;
@@ -121,9 +120,9 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
length = __bss_stop - __image_start;
relocaddr = ALIGN_DOWN(ram_size - length, SZ_64K);
if (IS_ENABLED(CONFIG_MMU)) {
- relocaddr = KSEG0ADDR(relocaddr);
+ relocaddr = CKSEG0ADDR(relocaddr);
} else {
- relocaddr = KSEG1ADDR(relocaddr);
+ relocaddr = CKSEG1ADDR(relocaddr);
}
new_stack = relocaddr - MALLOC_SIZE - 16;
@@ -134,7 +133,7 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
* space in the Barebox binary & complexity in handling them.
*/
off = relocaddr - (unsigned long)__image_start;
- if (off & 0xffff)
+ if (!IS_ALIGNED(off, SZ_64K))
panic("Mis-aligned relocation\n");
/* Copy Barebox to RAM */