[Libreoffice-commits] .: bridges/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Mon Apr 23 05:30:50 PDT 2012


 bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 3120273ab10e9e8b765e2d13a90b62102a45c56f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Apr 23 14:28:48 2012 +0200

    Port gcc3_linux_powerpc fix to gcc3_macosx_powerpc
    
    This ports 84dbc4fe2547f8fc341a46d7f000e721c81e63ee "do not let gcc use
    registers we are setting ourselves," in the hope that it is also an
    improvement for Mac OS X PPC.  (But the patch was applied blindly, so
    please revert if it makes things worse instead.)

diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
index 59cec3c..0750980 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
@@ -67,7 +67,6 @@ static void callVirtualMethod(
   // of floating point registers f1 to f13
 
      unsigned long * mfunc;        // actual function to be invoked
-     void (*ptr)();
      int gpr[8];                   // storage for gpregisters, map to r3-r10
      int off;                      // offset used to find function
      double fpr[13];               // storage for fpregisters, map to f1-f13
@@ -208,7 +207,8 @@ static void callVirtualMethod(
      mfunc = *((unsigned long **)pAdjustedThisPtr);    // get the address of the vtable
      mfunc = (unsigned long *)((char *)mfunc + off); // get the address from the vtable entry at offset
      mfunc = *((unsigned long **)mfunc);                 // the function is stored at the address
-     ptr = (void (*)())mfunc;
+     typedef void (*FunctionCall)(sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32);
+     FunctionCall ptr = (FunctionCall)mfunc;
 
     /* Set up the machine registers and invoke the function */
 
@@ -240,7 +240,17 @@ static void callVirtualMethod(
             "f10", "f11", "f12", "f13"
     );
 
-    (*ptr)();
+    // tell gcc that r3 to r10 are not available to it for doing the TOC and exception munge on the func call
+    register sal_uInt32 r3 __asm__("r3");
+    register sal_uInt32 r4 __asm__("r4");
+    register sal_uInt32 r5 __asm__("r5");
+    register sal_uInt32 r6 __asm__("r6");
+    register sal_uInt32 r7 __asm__("r7");
+    register sal_uInt32 r8 __asm__("r8");
+    register sal_uInt32 r9 __asm__("r9");
+    register sal_uInt32 r10 __asm__("r10");
+
+    (*ptr)(r3, r4, r5, r6, r7, r8, r9, r10);
 
 
     __asm__ __volatile__ (


More information about the Libreoffice-commits mailing list