From 3874a377451e4d1f45710f5bf801dd96e8b8f67e Mon Sep 17 00:00:00 2001 From: Julius Baxter Date: Sat, 5 May 2012 12:32:11 +0000 Subject: openrisc: Work around potential relocation issues When reset code is in flash, the jump instructions emitted by the compiler are relative instead of absolute jumps. A fix to the reset code to make correct jumps to the beginning of code relocated to RAM have also been added. Signed-off-by: Julius Baxter --- arch/openrisc/cpu/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'arch/openrisc/cpu/cpu.c') diff --git a/arch/openrisc/cpu/cpu.c b/arch/openrisc/cpu/cpu.c index 25cd6249d2..73ecc6f766 100644 --- a/arch/openrisc/cpu/cpu.c +++ b/arch/openrisc/cpu/cpu.c @@ -151,7 +151,11 @@ extern void __reset(void); int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { disable_interrupts(); - __reset(); + /* Code the jump to __reset here as the compiler is prone to + emitting a bad jump instruction if the function is in flash */ + __asm__("l.movhi r1,hi(__reset); \ + l.ori r1,r1,lo(__reset); \ + l.jr r1"); /* not reached, __reset does not return */ return 0; } -- cgit