[Skiboot] [PATCH] opal entry: Fix LE skiboot clobbering r10 argument

Nicholas Piggin npiggin at gmail.com
Wed Apr 29 17:40:21 AEST 2020


Fortunately no OPAL calls seem to use 8 arguments yet.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 asm/head.S          | 2 +-
 include/asm-utils.h | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/asm/head.S b/asm/head.S
index 88b2bc12a..3b41815c6 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -837,7 +837,7 @@ enter_nap:
 	.balign	0x10
 .global opal_entry
 opal_entry:
-	OPAL_ENTRY_TO_SKIBOOT_ENDIAN
+	OPAL_ENTRY_TO_SKIBOOT_ENDIAN /* This clobbers r11, r12 */
 
 	/* Get our per CPU pointer in r12 to check for quiesce */
 	mfspr	%r12,SPR_PIR
diff --git a/include/asm-utils.h b/include/asm-utils.h
index 73416cd0b..18325a8b3 100644
--- a/include/asm-utils.h
+++ b/include/asm-utils.h
@@ -28,16 +28,17 @@
 /* Load an address via the TOC */
 #define LOAD_ADDR_FROM_TOC(r, e)	ld r,e at got(%r2)
 
-/* This must preserve LR, so can't use Linux kernel's FIXUP_ENDIAN */
+/* This must preserve LR, may only clobber r11-r12, so can't use Linux kernel's
+ * FIXUP_ENDIAN */
 #define SWITCH_ENDIAN						   \
 	.long 0xa600607d; /* mfmsr r11				*/ \
 	.long 0x01006b69; /* xori r11,r11,1			*/ \
 	.long 0xa64b7b7d; /* mthsrr1 r11			*/ \
 	.long 0xa602687d; /* mflr r11				*/ \
 	.long 0x05009f42; /* bcl 20,31,$+4			*/ \
-	.long 0xa602487d; /* mflr r10				*/ \
-	.long 0x14004a39; /* addi r10,r10,20			*/ \
-	.long 0xa64b5a7d; /* mthsrr0 r10			*/ \
+	.long 0xa602887d; /* mflr r12				*/ \
+	.long 0x14008c39; /* addi r12,r12,20			*/ \
+	.long 0xa64b9a7d; /* mthsrr0 r12			*/ \
 	.long 0xa603687d; /* mtlr r11				*/ \
 	.long 0x2402004c  /* hrfid				*/
 
-- 
2.23.0



More information about the Skiboot mailing list