Skip to contentSkip to conversation

ppc: Create a stack frame for wait_ticks()

PATCH New Joakim Tjernlund 2 participants 2 messages Jul 17, 2012 – Sep 2, 2012 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc: Create a stack frame for wait_ticks()

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.

---
 arch/powerpc/lib/ticks.S |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/lib/ticks.S +5 -2
index b8d25b7..1781039 100644
@@ -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
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 ppc: Create a stack frame for wait_ticks()

Dear Joakim Tjernlund,

Quoted 8 lines · In message <[email protected]>…

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.

---
 arch/powerpc/lib/ticks.S |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Deliver yesterday, code today, think tomorrow."