[Libreoffice-commits] .: 3 commits - bridges/source testtools/source

David Tardon dtardon at kemper.freedesktop.org
Mon Apr 23 04:52:24 PDT 2012


 bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx   |   16 +++++++++++++---
 bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx |   16 ++++++++--------
 testtools/source/bridgetest/makefile.mk                 |    4 ----
 3 files changed, 21 insertions(+), 15 deletions(-)

New commits:
commit b8044cb828af149a4598b35a4d46d8fe4205ae74
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Apr 23 13:51:51 2012 +0200

    i hope this is fixed now

diff --git a/testtools/source/bridgetest/makefile.mk b/testtools/source/bridgetest/makefile.mk
index 3e31ba6..f87327e 100644
--- a/testtools/source/bridgetest/makefile.mk
+++ b/testtools/source/bridgetest/makefile.mk
@@ -146,15 +146,11 @@ ALLTAR: \
 runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk \
         $(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN)
 .IF "$(CROSS_COMPILING)"!="YES"
-.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP"
-    @echo "Mac OSX PPC GCC fails this test!, likely broken UNO bridge. Fix me."
-.ELSE
         cd $(DLLDEST) && $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/uno \
         -ro uno_services.rdb -ro uno_types.rdb \
         -s com.sun.star.test.bridge.BridgeTest -- \
         com.sun.star.test.bridge.CppTestObject
 .ENDIF
-.ENDIF
 
 $(DLLDEST)/services.rdb :
     $(COPY) $(SOLARXMLDIR)/ure/services.rdb $@
commit 84dbc4fe2547f8fc341a46d7f000e721c81e63ee
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Apr 23 13:19:39 2012 +0200

    do not let gcc use registers we are setting ourselves
    
    gcc uses a register for the function call--and it tried r9 here...

diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx
index 34e8c63..f409bf7 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx
@@ -67,7 +67,6 @@ static void callVirtualMethod(
   // of floating point registers f1 to f8
 
      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
 #ifndef __NO_FPRS__
@@ -243,7 +242,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 */
 
@@ -272,7 +272,17 @@ static void callVirtualMethod(
         : "0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"
     );
 
-    (*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__ (
        "mr     %0,     3\n\t"
commit c4c9484a1f55266c92e83406ddee3715affed7f6
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Apr 23 09:47:41 2012 +0200

    save register arguments first
    
    The "mr" stores r11 to indeterminate register (r9 in my case) before
    storing it into the output variable, thus overwriting one of our input
    arguments... This later leads to nice segfault in
    testtools/source/bridgetest ...
    
    I suppose there is a better way to get the variable, but I do not know
    it .-)

diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
index 425c5b5..3cb94dd 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
@@ -504,13 +504,6 @@ static typelib_TypeClass cpp_mediate(
 
 extern "C" void privateSnippetExecutor( ... )
 {
-    volatile long nOffsetAndIndex;
-
-    //mr %r3, %r11            # move into arg1 the 64bit value passed from OOo
-    __asm__ __volatile__ (
-                "mr     %0,    11\n\t"
-                : "=r" (nOffsetAndIndex) : );
-
     sal_uInt64 gpreg[ppc64::MAX_GPR_REGS];
     double fpreg[ppc64::MAX_SSE_REGS];
 
@@ -537,11 +530,18 @@ extern "C" void privateSnippetExecutor( ... )
         "stfd 12, 88(%1)\t\n"
         "stfd 13, 96(%1)\t\n"
     : : "r" (gpreg), "r" (fpreg)
-        : "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
+        : "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
           "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9",
           "fr10", "fr11", "fr12", "fr13"
     );
 
+    volatile long nOffsetAndIndex;
+
+    //mr %r3, %r11            # move into arg1 the 64bit value passed from OOo
+    __asm__ __volatile__ (
+                "mr     %0,    11\n\t"
+                : "=r" (nOffsetAndIndex) : );
+
     volatile long sp;
 
     //stack pointer


More information about the Libreoffice-commits mailing list