summaryrefslogtreecommitdiff
path: root/arch/openrisc/cpu/cpu.c
diff options
context:
space:
mode:
authorJulius Baxter <juliusbaxter@gmail.com>2012-05-05 12:32:11 +0000
committerWolfgang Denk <wd@denx.de>2012-08-09 23:37:45 +0200
commit3874a377451e4d1f45710f5bf801dd96e8b8f67e (patch)
treec9ecb29bc7b72a91affc6ab25e8950cb5ebc483c /arch/openrisc/cpu/cpu.c
parenteb0b43f264077fb7ff53b479dce76324a8aaa696 (diff)
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 <juliusbaxter@gmail.com>
Diffstat (limited to 'arch/openrisc/cpu/cpu.c')
-rw-r--r--arch/openrisc/cpu/cpu.c6
1 files changed, 5 insertions, 1 deletions
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;
}