From: Stafford Horne Date: Sun, 5 Feb 2017 09:55:40 +0000 (+0900) Subject: openrisc: head: Init r0 to 0 on start X-Git-Tag: MMI-PSA29.97-13-9~6106^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a4d4426635804379d618dd28e29f574a2bc11184;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: Stafford Horne --- 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 @@ l.add rd,rd,rs #define CLEAR_GPR(gpr) \ - l.or gpr,r0,r0 + l.movhi gpr,0x0 #define LOAD_SYMBOL_2_GPR(gpr,symbol) \ l.movhi gpr,hi(symbol) ;\ @@ -443,6 +443,9 @@ _dispatch_do_ipage_fault: __HEAD .global _start _start: + /* Init r0 to zero as per spec */ + CLEAR_GPR(r0) + /* save kernel parameters */ l.or r25,r0,r3 /* pointer to fdt */