diff mbox series

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

Message ID 20191009234951.2850-2-npiggin@gmail.com
State Superseded
Headers show
Series little endian skiboot | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (1785745d5a7eaefd7d0c135f2a3b0f5d86aefec5)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Nicholas Piggin Oct. 9, 2019, 11:49 p.m. UTC
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@gmail.com>
---
 asm/cvc_entry.S | 9 +++++++--
 include/stack.h | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Stewart Smith Oct. 10, 2019, 3:13 p.m. UTC | #1
On Wed, Oct 9, 2019, at 4:49 PM, Nicholas Piggin wrote:
> 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@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.

Should probably also go to hostboot?

Acked-by: Stewart Smith <stewart@flamingspork.com>
Nicholas Piggin Oct. 12, 2019, 10:22 p.m. UTC | #2
Stewart Smith's on October 11, 2019 1:13 am:
> On Wed, Oct 9, 2019, at 4:49 PM, Nicholas Piggin wrote:
>> 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@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.
> 
> Should probably also go to hostboot?
> 
> Acked-by: Stewart Smith <stewart@flamingspork.com>

Yeah I pinged hostboot about it.

Thanks,
Nick
diff mbox series

Patch

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