From 2416533cd5187fdb0118c14a8a4bb48b5dc28e07 Mon Sep 17 00:00:00 2001 From: Simon Richter Date: Sat, 31 May 2008 10:50:11 +0200 Subject: [PATCH] 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 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/wine/port.c b/libs/wine/port.c index cbc00f97fad..859818f9828 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, -- 2.11.4.GIT