Skip to content

Commit a4d4426

Browse files
committed
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>
1 parent a0eba4f commit a4d4426

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/openrisc/kernel/head.S

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
l.add rd,rd,rs
3636

3737
#define CLEAR_GPR(gpr) \
38-
l.or gpr,r0,r0
38+
l.movhi gpr,0x0
3939

4040
#define LOAD_SYMBOL_2_GPR(gpr,symbol) \
4141
l.movhi gpr,hi(symbol) ;\
@@ -443,6 +443,9 @@ _dispatch_do_ipage_fault:
443443
__HEAD
444444
.global _start
445445
_start:
446+
/* Init r0 to zero as per spec */
447+
CLEAR_GPR(r0)
448+
446449
/* save kernel parameters */
447450
l.or r25,r0,r3 /* pointer to fdt */
448451

0 commit comments

Comments
 (0)