Simon Richter : libwine: Fix wine_switch_to_stack on ppc.

Alexandre Julliard julliard at winehq.org
Mon Jun 2 07:24:24 CDT 2008


Module: wine
Branch: master
Commit: 2416533cd5187fdb0118c14a8a4bb48b5dc28e07
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2416533cd5187fdb0118c14a8a4bb48b5dc28e07

Author: Simon Richter <Simon.Richter at hogyros.de>
Date:   Sat May 31 10:50:11 2008 +0200

libwine: Fix wine_switch_to_stack on ppc.

The PowerPC ABI expects the caller to allocate space for the return
address on the stack, above the current stack pointer, even if the
address is passed in the link register (usually the address is stored at
SP+4 by the callee).

---

 libs/wine/port.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libs/wine/port.c b/libs/wine/port.c
index cbc00f9..859818f 100644
--- a/libs/wine/port.c
+++ b/libs/wine/port.c
@@ -90,14 +90,17 @@ __ASM_GLOBAL_FUNC( wine_switch_to_stack,
                    "mr r3,r4\n\t" /* args -> function param 1 (r3) */
                    "mr r1,r5\n\t" /* stack */
                    "subi r1,r1,0x100\n\t" /* adjust stack pointer */
-                   "bctr\n" /* call ctr */
+                   "bctrl\n" /* call ctr */
                    "1:\tb 1b") /* loop */
 #elif defined(__powerpc__) && defined(__GNUC__)
 __ASM_GLOBAL_FUNC( wine_switch_to_stack,
                    "mtctr 3\n\t" /* func -> ctr */
                    "mr 3,4\n\t" /* args -> function param 1 (r3) */
                    "mr 1,5\n\t" /* stack */
-                   "bctr\n\t" /* call ctr */
+                   "subi 1, 1, 16\n\t" /* allocate space for the callee */
+                   "li 0, 0\n\t" /* load zero */
+                   "stw 0, 0(1)\n\t" /* create a bottom stack frame */
+                   "bctrl\n\t" /* call ctr */
                    "1:\tb 1b") /* loop */
 #elif defined(__ALPHA__) && defined(__GNUC__)
 __ASM_GLOBAL_FUNC( wine_switch_to_stack,




More information about the wine-cvs mailing list