[Skiboot] [PATCH] external/opal-prd: Use link register for cross-endian branch

Jeremy Kerr jk at ozlabs.org
Tue Mar 31 18:47:01 AEDT 2015


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 at ozlabs.org>

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

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)


More information about the Skiboot mailing list