[Skiboot] [PATCH] asm/head: fix power save wakeup register corruption

Nicholas Piggin npiggin at gmail.com
Thu Sep 10 02:29:46 AEST 2020


Power save wakeup handlers can clobber r30 before testing for state
loss and avoiding restoring non-volatile GPRs. Fix this by using r5
instead (and move the register usage to one place, for clarity).

Cc: skiboot-stable at lists.ozlabs.org
Fixes: 8a43bf86b7 ("core/exceptions: implement an exception handler for non-powersave sresets")
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 asm/head.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/asm/head.S b/asm/head.S
index 0b81bb51a..7058f734d 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -114,7 +114,6 @@ hdat_entry:
 	li	%r4,0x200
 	b	_exception
 1:
-	LOAD_IMM64(%r30, SKIBOOT_BASE)
 	cmpdi	%r3,0x1
 	bne	2f		/* state loss */
 	LOAD_IMM32(%r3, reset_resume - __head)
@@ -122,7 +121,8 @@ hdat_entry:
 2:
 	LOAD_IMM32(%r3, reset_wakeup - __head)
 3:
-	add	%r3,%r30,%r3
+	LOAD_IMM64(%r5, SKIBOOT_BASE)
+	add	%r3,%r5,%r3
 	mtctr	%r3
 	li	%r3,0x200
 	bctr
@@ -582,7 +582,6 @@ reset_patch_start:
 	li	%r4,0x100
 	b	_exception + (reset_patch_start - sreset_vector)
 1:
-	LOAD_IMM64(%r30, SKIBOOT_BASE)
 	cmpdi	%r3,0x1
 	bne	2f		/* state loss */
 	LOAD_IMM32(%r3, reset_resume - __head)
@@ -590,7 +589,8 @@ reset_patch_start:
 2:
 	LOAD_IMM32(%r3, reset_wakeup - __head)
 3:
-	add	%r3,%r30,%r3
+	LOAD_IMM64(%r5, SKIBOOT_BASE)
+	add	%r3,%r5,%r3
 	mtctr	%r3
 	li	%r3,0x100
 	bctr
-- 
2.23.0



More information about the Skiboot mailing list