diff mbox

external/opal-prd: Use link register for cross-endian branch

Message ID 1427788021.662389.12407382643.1.gpush@pablo
State Accepted
Headers show

Commit Message

Jeremy Kerr March 31, 2015, 7:47 a.m. UTC
With the change to the official switch_endian system call, we lost
preservation of the counter across the system call.

This change uses the LR instead. It's preserved across the system call,
and is going to be overwritten by the branch-and-link instruction
anyway.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 external/opal-prd/thunk.S |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/external/opal-prd/thunk.S b/external/opal-prd/thunk.S
index 773df26..ab1e737 100644
--- a/external/opal-prd/thunk.S
+++ b/external/opal-prd/thunk.S
@@ -47,15 +47,15 @@  call_be:
 	ld %r2,8(%r11)
 #endif
 
-	mtctr %r0
+	mtlr %r0
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 	/* Switch to the "other endian" */
 	li %r0,__NR_switch_endian
 	sc
 
-	/* Branch to CTR */
-	.long 0x2104804e /* (byteswapped bctrl) */
+	/* Branch to LR */
+	.long 0x2100804e /* (byteswapped blrl) */
 
 	/* Switch endian back */
 	.long 0x00000038 | le_si16(__NR_switch_endian)