Simon Richter : libwine: Implement wine_call_on_stack for ppc.

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


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

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

libwine: Implement wine_call_on_stack for ppc.

---

 libs/wine/port.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/libs/wine/port.c b/libs/wine/port.c
index e2f7b0c..cbc00f9 100644
--- a/libs/wine/port.c
+++ b/libs/wine/port.c
@@ -179,6 +179,23 @@ __ASM_GLOBAL_FUNC( wine_call_on_stack,
                    "popq %rbx\n\t"
                    "popq %rbp\n\t"
                    "ret")
+#elif defined(__powerpc__) && defined(__GNUC__)
+__ASM_GLOBAL_FUNC( wine_call_on_stack,
+                   "mflr 0\n\t"         /* get return address */
+                   "stw 0, 4(1)\n\t"    /* save return address */
+                   "subi 5, 5, 16\n\t" /* reserve space on new stack */
+                   "stw 1, 12(5)\n\t"   /* store old sp */
+                   "mtctr 3\n\t"        /* func -> ctr */
+                   "mr 3,4\n\t"         /* args -> function param 1 (r3) */
+                   "mr 1,5\n\t"         /* stack */
+                   "li 0, 0\n\t"        /* zero */
+                   "stw 0, 0(1)\n\t"    /* bottom of stack */
+                   "stwu 1, -16(1)\n\t" /* create a frame for this function */
+                   "bctrl\n\t"          /* call ctr */
+                   "lwz 1, 28(1)\n\t"   /* fetch old sp */
+                   "lwz 0, 4(1)\n\t"    /* fetch return address */
+                   "mtlr 0\n\t"         /* return address -> lr */
+                   "blr")               /* return */
 #else
 #error You must implement wine_switch_to_stack for your platform
 #endif




More information about the wine-cvs mailing list