diff mbox

[U-Boot] ppc: Create a stack frame for wait_ticks()

Message ID 1342509940-12018-1-git-send-email-Joakim.Tjernlund@transmode.se
State Accepted
Commit 83f83d19354f9d9b4d5d6fc06dd9c00d2340dab5
Headers show

Commit Message

Joakim Tjernlund July 17, 2012, 7:25 a.m. UTC
wait_ticks() calls get_ticks() without building a back chain which
makes gdb unhappy when doing back trace. This can also cause
improper memory accesses.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
 arch/powerpc/lib/ticks.S |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Comments

Wolfgang Denk Sept. 2, 2012, 3:10 p.m. UTC | #1
Dear Joakim Tjernlund,

In message <1342509940-12018-1-git-send-email-Joakim.Tjernlund@transmode.se> you wrote:
> wait_ticks() calls get_ticks() without building a back chain which
> makes gdb unhappy when doing back trace. This can also cause
> improper memory accesses.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>  arch/powerpc/lib/ticks.S |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/arch/powerpc/lib/ticks.S b/arch/powerpc/lib/ticks.S
index b8d25b7..1781039 100644
--- a/arch/powerpc/lib/ticks.S
+++ b/arch/powerpc/lib/ticks.S
@@ -47,7 +47,9 @@  get_ticks:
  */
 	.globl	wait_ticks
 wait_ticks:
-	mflr	r8		/* save link register */
+	stwu	r1, -16(r1)
+	mflr	r0		/* save link register */
+	stw	r0, 20(r1)	/* Use r0 or GDB will be unhappy */
 	mr	r7, r3		/* save tick count */
 	bl	get_ticks	/* Get start time */
 
@@ -61,5 +63,6 @@  wait_ticks:
 	subfe.	r3, r3, r6
 	bge	1b		/* Loop until time expired */
 
-	mtlr	r8		/* restore link register */
+	mtlr	r0		/* restore link register */
+	addi	r1,r1,16
 	blr