Skip to content

Commit

Permalink
asm/cvc_entry.S: r2 save fix
Browse files Browse the repository at this point in the history
The TOC save area for the current stack frame should be used to save
r2, not the caller's frame.

Acked-by: Stewart Smith <stewart@flamingspork.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
npiggin authored and oohal committed Dec 16, 2019
1 parent 87a470c commit 2665739
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions asm/cvc_entry.S
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions include/stack.h
Expand Up @@ -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

Expand Down

0 comments on commit 2665739

Please sign in to comment.