Commit a4d44266 authored by Stafford Horne's avatar Stafford Horne

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: default avatarJakob Viketoft <jakob.viketoft@aacmicrotec.com>
Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
parent a0eba4f7
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
l.add rd,rd,rs l.add rd,rd,rs
#define CLEAR_GPR(gpr) \ #define CLEAR_GPR(gpr) \
l.or gpr,r0,r0 l.movhi gpr,0x0
#define LOAD_SYMBOL_2_GPR(gpr,symbol) \ #define LOAD_SYMBOL_2_GPR(gpr,symbol) \
l.movhi gpr,hi(symbol) ;\ l.movhi gpr,hi(symbol) ;\
...@@ -443,6 +443,9 @@ _dispatch_do_ipage_fault: ...@@ -443,6 +443,9 @@ _dispatch_do_ipage_fault:
__HEAD __HEAD
.global _start .global _start
_start: _start:
/* Init r0 to zero as per spec */
CLEAR_GPR(r0)
/* save kernel parameters */ /* save kernel parameters */
l.or r25,r0,r3 /* pointer to fdt */ l.or r25,r0,r3 /* pointer to fdt */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment