summaryrefslogtreecommitdiffstats
path: root/arch/openrisc
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2017-02-05 04:55:40 -0500
committerStafford Horne <shorne@gmail.com>2017-02-24 15:08:47 -0500
commita4d4426635804379d618dd28e29f574a2bc11184 (patch)
tree38ef4394a132b84ebac0db16ca86d1792311c9da /arch/openrisc
parenta0eba4f7ebcdf81da0a4480d8fc514af4f76579e (diff)
openrisc: head: Init r0 to 0 on start
Originally openrisc spec 0 specified that r0 would be wired to ground. This is no longer the case. r0 is not guaranteed to be 0 at init, so we need to initialize it to 0 before using it. Also, if we are clearing r0 we cant use r0 to clear itself. Change the the CLEAR_GPR macro to use movhi for clearing. Reported-by: Jakob Viketoft <jakob.viketoft@aacmicrotec.com> Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'arch/openrisc')
-rw-r--r--arch/openrisc/kernel/head.S5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
index fe55156983e0..d01b82eace3e 100644
--- a/arch/openrisc/kernel/head.S
+++ b/arch/openrisc/kernel/head.S
@@ -35,7 +35,7 @@
35 l.add rd,rd,rs 35 l.add rd,rd,rs
36 36
37#define CLEAR_GPR(gpr) \ 37#define CLEAR_GPR(gpr) \
38 l.or gpr,r0,r0 38 l.movhi gpr,0x0
39 39
40#define LOAD_SYMBOL_2_GPR(gpr,symbol) \ 40#define LOAD_SYMBOL_2_GPR(gpr,symbol) \
41 l.movhi gpr,hi(symbol) ;\ 41 l.movhi gpr,hi(symbol) ;\
@@ -443,6 +443,9 @@ _dispatch_do_ipage_fault:
443 __HEAD 443 __HEAD
444 .global _start 444 .global _start
445_start: 445_start:
446 /* Init r0 to zero as per spec */
447 CLEAR_GPR(r0)
448
446 /* save kernel parameters */ 449 /* save kernel parameters */
447 l.or r25,r0,r3 /* pointer to fdt */ 450 l.or r25,r0,r3 /* pointer to fdt */
448 451