openrisc: entry: Fix delay slot detection
authorStafford Horne <shorne@gmail.com>
Tue, 10 Jan 2017 14:30:23 +0000 (23:30 +0900)
committerStafford Horne <shorne@gmail.com>
Fri, 24 Feb 2017 19:31:06 +0000 (04:31 +0900)
Use execption SR stored in pt_regs for detection, the current SR is not
correct as the handler is running after return from exception.

Also, The code that checks for a delay slot uses a flag bitmask and then
wants to check if the result is not zero.  The test it implemented was
wrong.

Correct it by changing the test to check result against non zero.

Signed-off-by: Stafford Horne <shorne@gmail.com>
arch/openrisc/kernel/entry.S

index daae2a423c3ab09e224a3fdfcc2ac56ecea1cffb..bc6500860f4d91c11fa2d420bc49f35d83e03228 100644 (file)
@@ -258,9 +258,9 @@ EXCEPTION_ENTRY(_data_page_fault_handler)
 
 #else
 
-       l.mfspr r6,r0,SPR_SR               // SR
+       l.lwz   r6,PT_SR(r3)               // SR
        l.andi  r6,r6,SPR_SR_DSX           // check for delay slot exception
-       l.sfeqi r6,0x1                     // exception happened in delay slot
+       l.sfne  r6,r0                      // exception happened in delay slot
        l.bnf   7f
         l.lwz  r6,PT_PC(r3)               // address of an offending insn