[Skiboot] [PATCH v4 01/15] asm/cvc_entry.S: r2 save fix

Nicholas Piggin npiggin at gmail.com
Thu Oct 10 10:49:37 AEDT 2019


The TOC save area for the current stack frame should be used to save
r2, not the caller's frame.

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

diff --git a/asm/cvc_entry.S b/asm/cvc_entry.S
index 1296e88fe..3e8b3fdad 100644
--- a/asm/cvc_entry.S
+++ b/asm/cvc_entry.S
@@ -24,6 +24,11 @@
 
 #.include "kernel/ppcconsts.S"
 
+# Updated hostboot location is src/securerom/rom_entry.S.
+# This also has a fix for TOC save frame pointer.
+
+#include <stack.h>
+
 .section .text
 
 .global __cvc_verify_v1
@@ -33,10 +38,10 @@ __cvc_verify_v1:
 __cvc_sha512_v1:
 
 call_rom_entry:
-    std %r2, 40(%r1)
     mflr %r0
     std %r0, 16(%r1)
     stdu %r1, -128(%r1)
+    std %r2, STACK_TOC_OFFSET(%r1)
     li %r2, 0
     mtctr %r3
     mr %r3, %r4
@@ -45,8 +50,8 @@ call_rom_entry:
     mr %r6, %r7
     mr %r7, %r8
     bctrl
+    ld %r2, STACK_TOC_OFFSET(%r1)
     addi %r1, %r1, 128
-    ld %r2, 40(%r1)
     ld %r0, 16(%r1)
     mtlr %r0
     blr
diff --git a/include/stack.h b/include/stack.h
index 3ad52d64c..09d22adb6 100644
--- a/include/stack.h
+++ b/include/stack.h
@@ -11,6 +11,8 @@
 #define STACK_ENTRY_RESET	0x0100	/* System reset */
 #define STACK_ENTRY_SOFTPATCH	0x1500	/* Soft patch (denorm emulation) */
 
+#define STACK_TOC_OFFSET	40
+
 /* Safety/ABI gap at top of stack */
 #define STACK_TOP_GAP		0x100
 
-- 
2.23.0



More information about the Skiboot mailing list