From: Cerion Armour-Brown Date: Wed, 23 Feb 2005 11:20:53 +0000 (+0000) Subject: Fix to run_translation: need to save LR on _caller's_ stack, and leave a hole for... X-Git-Tag: svn/VALGRIND_3_0_1^2~384 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10387d61099f87a6fcf52c754a5c67456604bd0e;p=thirdparty%2Fvalgrind.git Fix to run_translation: need to save LR on _caller's_ stack, and leave a hole for a callee to do the same on our stack. git-svn-id: svn://svn.valgrind.org/vex/trunk@950 --- diff --git a/VEX/switchback/switchback.c b/VEX/switchback/switchback.c index de68c70150..25a89497f9 100644 --- a/VEX/switchback/switchback.c +++ b/VEX/switchback/switchback.c @@ -390,7 +390,12 @@ asm( // save LR " mflr %r0\n" -" stw %r0, 4(%r1)\n" +" stw %r0,260(%r1)\n" + +// leave hole @ 4(%r1) for a caller to save it's LR +// no params +// no local vars +// no need to save non-volatile CR fields // store registers to stack: just the callee-saved regs " stw %r13, 8(%r1)\n" @@ -427,10 +432,6 @@ asm( " lis %r5,res@ha\n" " stw %r3,res@l(%r5)\n" -// restore LR -" lwz %r0, 4(%r1)\n" -" mtlr %r0\n" - // reload registers from stack " lwz %r13, 8(%r1)\n" " lwz %r14, 12(%r1)\n" @@ -452,10 +453,14 @@ asm( " lwz %r30, 76(%r1)\n" " lwz %r31, 80(%r1)\n" -// restore stack pointer -" lwz %r1,0(%r1)\n" +// restore LR +" lwz %r0,260(%r1)\n" +" mtlr %r0\n" + +// restore previous stack pointer +" addi %r1,%r1,256\n" -// return in usual way +// return " blr" );