rpms/openoffice.org/devel workspace.ppc64one.patch,1.3,1.4

Caolan McNamara (caolanm) fedora-extras-commits at redhat.com
Wed Jun 13 09:51:28 UTC 2007


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29405

Modified Files:
	workspace.ppc64one.patch 
Log Message:
add new ppc64one

workspace.ppc64one.patch:

Index: workspace.ppc64one.patch
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/devel/workspace.ppc64one.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- workspace.ppc64one.patch	6 Jun 2007 08:27:18 -0000	1.3
+++ workspace.ppc64one.patch	13 Jun 2007 09:51:22 -0000	1.4
@@ -153,7 +153,7 @@
  # don't change - required to work around optimization bugs
 Index: tools/solenv/inc/unxlngppc64.mk
 diff -u /dev/null tools/solenv/inc/unxlngppc64.mk:1.1.2.2
---- /dev/null	Wed Jun  6 01:25:02 2007
+--- /dev/null	Wed Jun 13 02:42:41 2007
 +++ tools/solenv/inc/unxlngppc64.mk	Fri Jun  1 05:05:04 2007
 @@ -0,0 +1,40 @@
 +#*************************************************************************
@@ -235,126 +235,11 @@
  
  .IF "$(cppu_no_leak)" == ""
  CFLAGS += -DLEAK_STATIC_DATA
-Index: udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/call.s
-diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/call.s:1.1.2.2
---- /dev/null	Wed Jun  6 01:25:18 2007
-+++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/call.s	Tue Jun  5 05:09:50 2007
-@@ -0,0 +1,110 @@
-+# http://www.ibm.com/developerworks/linux/library/l-powasm1.html
-+# http://www.linux-foundation.org/spec/booksets/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
-+# http://dwarfstd.org/Dwarf3.pdf
-+
-+# Caolan McNamara <caolanm at redhat.com>
-+
-+.globl  privateSnippetExecutor, .privateSnippetExecutor
-+	.section        ".opd","aw"
-+	.align  3
-+privateSnippetExecutor:
-+	.quad   .privateSnippetExecutor,.TOC. at tocbase,0
-+	.size   privateSnippetExecutor,24
-+	.type   .privateSnippetExecutor, at function
-+	.text
-+.privateSnippetExecutor:
-+.LFB3:
-+	mflr 0 			# Save Link Register
-+        std 0, 16(1) 		# Link Register save area
-+
-+	# General non-volatile register save area
-+	std 3,  48(1)
-+	std 4,  56(1)
-+	std 5,  64(1)
-+	std 6,  72(1)
-+	std 7,  80(1)
-+	std 8,  88(1)
-+	std 9,  96(1)
-+	std 10, 104(1)
-+
-+	#Reserve Space of 48 (save areas) + (8*gpr) + (13*fpr) = 216 bytes.
-+        stdu 1, -224(1) 	# aligned to 16-byte boundary = 224 bytes
-+
-+        # Floating point non-volatile register save area
-+        stfd 1,  112(1)
-+        stfd 2,  120(1) 
-+        stfd 3,  128(1) 
-+        stfd 4,  136(1) 
-+        stfd 5,  144(1)
-+        stfd 6,  152(1)
-+        stfd 7,  160(1) 
-+        stfd 8,  168(1)
-+        stfd 9,  176(1) 
-+        stfd 10, 184(1)
-+        stfd 11, 192(1)
-+        stfd 12, 200(1)
-+        stfd 13, 208(1)
-+.LCFI0:
-+	mr %r3, %r11		# move into arg1 the 64bit value passed from OOo
-+	addi %r4, %r1, 224 + 48 # move into arg2 the gpr registers
-+	addi %r5, %r1, 112	# move into arg3 the fpr registers
-+	addi %r6, %r1, -8       # move into arg4 previous call stack
-+	addi %r7, %r1, 216 	# where we're stuffing the "true" return value
-+	bl .cpp_vtable_call
-+
-+        cmpwi   3, 10           # typelib_TypeClass_FLOAT
-+        bt eq, .Lfloat
-+        cmpwi   3, 11           # typelib_TypeClass_DOUBLE
-+        bt eq, .Lfloat
-+
-+        ld 3, 216(1)            # Return value (int case)
-+        b .Lfinish
-+.Lfloat:
-+        lfd %f1, 216(1)         # Return value (float/double case)
-+.Lfinish:
-+	# now r3/f1 contains the return type
-+        ld 0, 240(1) 		# std 0, SIZE_OF_STACK+16(1)
-+	mtlr 0			# Restore LR
-+        ld 1, 0(1) 		# Restore stack frame atomically
-+	blr 			# Return
-+.LFE3:
-+	.long	0
-+        .byte 	0,9,0,1,128,1,0,1
-+	.size	.privateSnippetExecutor,.-.privateSnippetExecutor
-+#Common Information Entry Format
-+	.section	.eh_frame,"a", at progbits
-+.Lframe1:
-+	.4byte	.LECIE1-.LSCIE1	# Length
-+.LSCIE1:
-+	.4byte	0x0	 	# CIE ID, always 0
-+	.byte	0x1	 	# Version, always 1
-+	.ascii "zR"	 	# Augmentation String
-+	.uleb128 0x1	 	# Code Alignment Factor
-+	.sleb128 -8	 	# Data Alignment Factor
-+	.byte	0x41	 	# Return Address Register
-+	.uleb128 0x1	 	# Augmentation Data Length (zR)
-+	.byte	0x14	 	# Augmentation Data
-+	.byte	0xc	 	# Initial Instructions
-+	.uleb128 0x1
-+	.uleb128 0x0
-+	.align 3
-+.LECIE1:
-+#Frame Description Entry
-+.LSFDE1:
-+	.4byte	.LEFDE1-.LASFDE1 # Length
-+.LASFDE1:
-+	.4byte	.LASFDE1-.Lframe1 # CIE Pointer
-+	.8byte	.LFB3-.	 	  # PC Begin
-+	.8byte	.LFE3-.LFB3	  # PC Range
-+	.uleb128 0x0	 	  # Augmentation Data Length
-+	 # Call Frame Instructions
-+	.byte	0x4	 	  # DW_CFA_advance_loc4
-+	.4byte	.LCFI0-.LFB3
-+	.byte	0xe	   	  # DW_CFA_def_cfa_offset
-+	.uleb128 224
-+	.byte	0x11	 	  # DW_CFA_offset_extended_sf
-+	.uleb128 0x41
-+	.sleb128 -2
-+	.align 3
-+.LEFDE1:
-+	.section	.note.GNU-stack,"", at progbits
 Index: udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
-diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx:1.1.2.2
---- /dev/null	Wed Jun  6 01:25:18 2007
-+++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx	Tue Jun  5 05:09:50 2007
-@@ -0,0 +1,729 @@
+diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx:1.1.2.4
+--- /dev/null	Wed Jun 13 02:43:04 2007
++++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx	Tue Jun 12 12:10:34 2007
+@@ -0,0 +1,722 @@
 +/*************************************************************************
 + *
 + *  OpenOffice.org - a multi-platform office productivity suite
@@ -426,7 +311,6 @@
 +
 +    int ng = 0; //number of gpr registers used 
 +    int nf = 0; //number of fpr regsiters used
-+    void ** pCppStack; //temporary stack pointer
 +       
 +    // gpreg:  [ret *], this, [gpr params]
 +    // fpreg:  [fpr params]
@@ -471,8 +355,8 @@
 +	// type descriptions for reconversions
 +	typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
 +	
-+	sal_Int32 nTempIndizes   = 0;
-+	
++	sal_Int32 nTempIndizes = 0;
++	bool bOverFlowUsed = false;
 +	for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
 +	{
 +		const typelib_MethodParameter & rParam = pParams[nPos];
@@ -491,133 +375,108 @@
 +
 +			switch (pParamTypeDescr->eTypeClass)
 +			{
-+
-+			  case typelib_TypeClass_DOUBLE:
-+			   if (nf < 13) {
-+			      pCppArgs[nPos] = fpreg;
-+			      pUnoArgs[nPos] = fpreg;
-+			      nf++;
-+			      fpreg += 2;
-+			   } else {
-+				if (((long)ovrflw) & 4) ovrflw++;
-+				pCppArgs[nPos] = ovrflw;
-+				pUnoArgs[nPos] = ovrflw;
-+			        ovrflw += 2;
-+			   }
-+			   break;
-+
-+			   case typelib_TypeClass_FLOAT:
-+			    // fpreg are all double values so need to
-+			    // modify fpreg to be a single word float value
-+			    if (nf < 13) {
-+			       float tmp = (float) (*((double *)fpreg));
-+			       (*((float *) fpreg)) = tmp;
-+			       pCppArgs[nPos] = fpreg;
-+			       pUnoArgs[nPos] = fpreg;
-+			       nf++;
-+			       fpreg += 2;
-+			    } else {
-+#if 0 /* abi is not being followed correctly */
-+			      if (((long)ovrflw) & 4) ovrflw++;
-+			      float tmp = (float) (*((double *)ovrflw));
-+			      (*((float *) ovrflw)) = tmp;
-+			      pCppArgs[nPos] = ovrflw;
-+			      pUnoArgs[nPos] = ovrflw;
-+			      ovrflw += 2;
-+#else
-+                              pCppArgs[nPos] = ovrflw;
-+			      pUnoArgs[nPos] = ovrflw;
-+			      ovrflw += 1;
-+#endif
-+                            }
-+			    break;
-+
-+			case typelib_TypeClass_HYPER:
-+			case typelib_TypeClass_UNSIGNED_HYPER:
-+			 if (ng < 7) {
-+			    if (ng & 1) {
-+			      ng++;
-+			      gpreg++;
-+			    }  
-+			    pCppArgs[nPos] = gpreg;
-+			    pUnoArgs[nPos] = gpreg;
-+			    ng += 2;
-+			    gpreg += 2;
-+			 } else {
-+			    if (((long)ovrflw) & 4) ovrflw++;
-+			    pCppArgs[nPos] = ovrflw;
-+			    pUnoArgs[nPos] = ovrflw;
-+			    ovrflw += 2;
-+			  }
-+			  break;
-+
-+			case typelib_TypeClass_BYTE:
-+			case typelib_TypeClass_BOOLEAN:
-+			 if (ng < 8) {
-+			      pCppArgs[nPos] = (((char *)gpreg) + 3);
-+			      pUnoArgs[nPos] = (((char *)gpreg) + 3);
-+			      ng++;
-+			      gpreg++;
-+			 } else {
-+			      pCppArgs[nPos] = (((char *)ovrflw) + 3);
-+			      pUnoArgs[nPos] = (((char *)ovrflw) + 3);
-+			      ovrflw++;
-+			 }
-+			 break;
-+
-+
-+		       case typelib_TypeClass_CHAR:
-+		       case typelib_TypeClass_SHORT:
-+		       case typelib_TypeClass_UNSIGNED_SHORT:
-+			if (ng < 8) {
-+			      pCppArgs[nPos] = (((char *)gpreg)+ 2);
-+			      pUnoArgs[nPos] = (((char *)gpreg)+ 2);
-+			      ng++;
-+			      gpreg++;
-+			} else {
-+			      pCppArgs[nPos] = (((char *)ovrflw) + 2);
-+			      pUnoArgs[nPos] = (((char *)ovrflw) + 2);
-+			      ovrflw++;
-+			}
-+			break;
-+
-+
-+		      default:
-+			if (ng < 8) {
-+			      pCppArgs[nPos] = gpreg;
-+			      pUnoArgs[nPos] = gpreg;
-+			      ng++;
-+			      gpreg++;
-+			} else {
-+			      pCppArgs[nPos] = ovrflw;
-+			      pUnoArgs[nPos] = ovrflw;
-+			      ovrflw++;
-+			}
-+                        break;
-+
++				case typelib_TypeClass_FLOAT:
++				case typelib_TypeClass_DOUBLE:
++					if (nf < 13)
++					{
++						if (pParamTypeDescr->eTypeClass == typelib_TypeClass_FLOAT)
++						{
++                        	float tmp = (float) (*((double *)fpreg));
++                        	(*((float *) fpreg)) = tmp;
++						}
++						pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
++						nf++;
++					}
++					else
++                    {
++						pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
++                        bOverFlowUsed = true;
++                    }
++                    if (bOverFlowUsed) ovrflw++;
++					break;
++                case typelib_TypeClass_BYTE:
++                case typelib_TypeClass_BOOLEAN:
++                    if (ng < 8)
++					{
++                        pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)gpreg) + (sizeof(void*)-1));
++                        ng++;
++                        gpreg++;
++                    }
++                    else
++					{
++                        pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-1));
++                        bOverFlowUsed = true;
++                    }
++                    if (bOverFlowUsed) ovrflw++;
++                    break;
++                case typelib_TypeClass_CHAR:
++                case typelib_TypeClass_SHORT:
++                case typelib_TypeClass_UNSIGNED_SHORT:
++                    if (ng < 8)
++					{
++                        pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)gpreg) + (sizeof(void*)-2));
++                        ng++;
++                        gpreg++;
++                    }
++                    else
++					{
++                        pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-2));
++                        bOverFlowUsed = true;
++                    }
++                    if (bOverFlowUsed) ovrflw++;
++                    break;
++		case typelib_TypeClass_ENUM:
++                case typelib_TypeClass_LONG:
++                case typelib_TypeClass_UNSIGNED_LONG:
++                    if (ng < 8)
++					{
++                        pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)gpreg) + (sizeof(void*)-4));
++                        ng++;
++                        gpreg++;
++                    }
++                    else
++					{
++                        pCppArgs[nPos] = pUnoArgs[nPos] = (((char *)ovrflw) + (sizeof(void*)-4));
++                        bOverFlowUsed = true;
++                    }
++                    if (bOverFlowUsed) ovrflw++;
++                    break;
++				default:
++					if (ng < 8) 
++					{
++						pCppArgs[nPos] = pUnoArgs[nPos] = gpreg++;
++						ng++;
++					}
++					else
++                    {
++						pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
++                        bOverFlowUsed = true;
++                    }
++                    if (bOverFlowUsed) ovrflw++;
++					break;
 +		        }
++
 +		        // no longer needed
-+			TYPELIB_DANGER_RELEASE( pParamTypeDescr );
++				TYPELIB_DANGER_RELEASE( pParamTypeDescr );
 +		}
 +		else // ptr to complex value | ref
 +		{
 +#ifdef CMC_DEBUG
 +			fprintf(stderr, "complex, ng is %d\n", ng);
 +#endif
++            void *pCppStack; //temporary stack pointer
 +
-+		    if (ng < 8)
++			if (ng < 8)
 +			{ 
-+		        pCppArgs[nPos] = *(void **)gpreg;
-+		        pCppStack = gpreg;
-+		        ng++;
-+		        gpreg++;
-+		    }
++		        pCppArgs[nPos] = pCppStack = *gpreg++;
++			    ng++;
++			}
 +			else
-+			{
-+		        pCppArgs[nPos] = *(void **)ovrflw;
-+		        pCppStack = ovrflw;
-+		        ovrflw++;
-+		    }
++            {
++			    pCppArgs[nPos] = pCppStack = *ovrflw;
++                bOverFlowUsed = true;
++            }
++            if (bOverFlowUsed) ovrflw++;
 +
 +			if (! rParam.bIn) // is pure out
 +			{
@@ -631,7 +490,7 @@
 +			else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
 +			{
 +				uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
-+										*(void **)pCppStack, pParamTypeDescr,
++										pCppStack, pParamTypeDescr,
 +										pThis->getBridge()->getCpp2Uno() );
 +				pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
 +				// will be released at reconversion
@@ -639,7 +498,7 @@
 +			}
 +			else // direct way
 +			{
-+				pUnoArgs[nPos] = *(void **)pCppStack;
++				pUnoArgs[nPos] = pCppStack;
 +				// no longer needed
 +				TYPELIB_DANGER_RELEASE( pParamTypeDescr );
 +			}
@@ -724,12 +583,17 @@
 +
 +//==================================================================================================
 +static typelib_TypeClass cpp_mediate(
-+	sal_Int32 nFunctionIndex,
-+        sal_Int32 nVtableOffset,
-+        void ** gpreg, void ** fpreg, void ** ovrflw,
++	sal_uInt64 nOffsetAndIndex,
++        void ** gpreg, void ** fpreg, long sp,
 +	sal_Int64 * pRegisterReturn /* space for register return */ )
 +{
 +    OSL_ENSURE( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" );
++
++    sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32);
++    sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
++
++    long sf = *(long*)sp;
++    void ** ovrflw = (void**)(sf + 112);
 +	
 +    // gpreg:  [ret *], this, [other gpr params]
 +    // fpreg:  [fpr params]
@@ -890,89 +754,102 @@
 +	return eRet;
 +}
 +
-+const int codeSnippetSize = 24;
-+
-+extern "C" void privateSnippetExecutor( ... );
-+extern "C" typelib_TypeClass cpp_vtable_call(sal_uInt64 nOffsetAndIndex, 
-+    void** gpregptr, void** fpregptr, void** ovrflw, sal_Int64 * pRegisterReturn);
-+
-+typelib_TypeClass cpp_vtable_call(sal_uInt64 nOffsetAndIndex, void** gpregptr, void** fpregptr, 
-+    void** ovrflw, sal_Int64 * pRegisterReturn)
++extern "C" void privateSnippetExecutor( ... )
 +{
-+    sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32);
-+    sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
++    volatile long nOffsetAndIndex;
 +
-+#ifdef CMC_DEBUG
-+    fprintf(stderr, "out: %lx %x %x\n", nOffsetAndIndex, nVtableOffset, nFunctionIndex);
-+    fprintf(stderr, "out: gpregptr is %ld\n", gpregptr);
-+#endif
-+
-+    sal_Int64     gpreg[8];
-+    double        fpreg[13];
-+
-+    memcpy( gpreg, gpregptr, sizeof(gpreg) );
-+    memcpy( fpreg, fpregptr, sizeof(fpreg) );
-+
-+#ifdef CMC_DEBUG
-+    fprintf(stderr,"in cpp_vtable_call nFunctionIndex is %x\n",nFunctionIndex);
-+    fprintf(stderr,"in cpp_vtable_call nVtableOffset is %x\n",nVtableOffset);
-+#endif
++    //mr %r3, %r11            # move into arg1 the 64bit value passed from OOo
++    __asm__ __volatile__ (
++                "mr     %0,    11\n\t"
++                : "=r" (nOffsetAndIndex) : );
 +
-+    sal_Bool bComplex = nFunctionIndex & 0x80000000 ? sal_True : sal_False;
++    sal_uInt64 gpreg[8];
++    double fpreg[13];
 +
-+    typelib_TypeClass aType = 
-+        cpp_mediate( nFunctionIndex, nVtableOffset, (void**)gpreg, (void**)fpreg, ovrflw, 
-+        pRegisterReturn );
++    __asm__ __volatile__ (
++        "std 3,   0(%0)\t\n"
++        "std 4,   8(%0)\t\n"
++        "std 5,  16(%0)\t\n"
++        "std 6,  24(%0)\t\n"
++        "std 7,  32(%0)\t\n"
++        "std 8,  40(%0)\t\n"
++        "std 9,  48(%0)\t\n"
++        "std 10, 56(%0)\t\n"
++        "stfd 1,   0(%1)\t\n"
++        "stfd 2,   8(%1)\t\n"
++        "stfd 3,  16(%1)\t\n"
++        "stfd 4,  24(%1)\t\n"
++        "stfd 5,  32(%1)\t\n"
++        "stfd 6,  40(%1)\t\n"
++        "stfd 7,  48(%1)\t\n"
++        "stfd 8,  56(%1)\t\n"
++        "stfd 9,  64(%1)\t\n"
++        "stfd 10, 72(%1)\t\n"
++        "stfd 11, 80(%1)\t\n"
++        "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",
++          "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9",
++          "fr10", "fr11", "fr12", "fr13"
++    );
 +
-+#ifdef CMC_DEBUG
-+    fprintf(stderr,"returning here, type is %d\n", aType);
-+#endif
++    volatile long sp;
 +
-+    return aType;
-+#if 0
-+	switch( aType )
-+	{
++    //stack pointer
++    __asm__ __volatile__ (
++                "mr     %0,    1\n\t"
++                : "=r" (sp) : );
 +
-+                // move return value into register space
-+                // (will be loaded by machine code snippet)
++    volatile long nRegReturn[0];
 +
-+                case typelib_TypeClass_BOOLEAN:
-+                case typelib_TypeClass_BYTE:
-+                  __asm__( "lbz 3,%0\n\t" : :
-+			   "m"(nRegReturn[0]) );
-+                  break;
-+ 
-+                case typelib_TypeClass_CHAR:
-+                case typelib_TypeClass_SHORT:
-+                case typelib_TypeClass_UNSIGNED_SHORT:
-+                  __asm__( "lhz 3,%0\n\t" : :
-+			   "m"(nRegReturn[0]) );
-+                  break;
-+
-+		case typelib_TypeClass_FLOAT:
-+                  __asm__( "lfs 1,%0\n\t" : :
-+                           "m" (*((float*)nRegReturn)) );
-+		  break;
-+
-+		case typelib_TypeClass_DOUBLE:
-+		  __asm__( "lfd 1,%0\n\t" : :
-+                           "m" (*((double*)nRegReturn)) );
-+		  break;
-+
-+		case typelib_TypeClass_HYPER:
-+		case typelib_TypeClass_UNSIGNED_HYPER:
-+		  __asm__( "lwz 4,%0\n\t" : :
-+                           "m"(nRegReturn[1]) );  // fall through
++    typelib_TypeClass aType =
++        cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, sp, (sal_Int64*)nRegReturn);
 +
-+		default:
-+		  __asm__( "lwz 3,%0\n\t" : :
-+                           "m"(nRegReturn[0]) );
-+		  break;
-+	}
-+}
-+#endif
++    switch( aType )
++    {
++        case typelib_TypeClass_VOID:
++	    break;
++        case typelib_TypeClass_BOOLEAN:
++        case typelib_TypeClass_BYTE:
++            __asm__( "lbz 3,%0\n\t" 
++                : : "m" (nRegReturn[0]) );
++            break;
++        case typelib_TypeClass_CHAR:
++        case typelib_TypeClass_UNSIGNED_SHORT:
++            __asm__( "lhz 3,%0\n\t"
++                : : "m" (nRegReturn[0]) );
++            break;
++        case typelib_TypeClass_SHORT:
++            __asm__( "lha 3,%0\n\t"
++                : : "m" (nRegReturn[0]) );
++            break;
++        case typelib_TypeClass_ENUM:
++        case typelib_TypeClass_UNSIGNED_LONG:
++            __asm__( "lwz 3,%0\n\t"
++                : : "m"(nRegReturn[0]) );
++            break;
++        case typelib_TypeClass_LONG:
++            __asm__( "lwa 3,%0\n\t"
++                : : "m"(nRegReturn[0]) );
++            break;
++        case typelib_TypeClass_FLOAT:
++            __asm__( "lfs 1,%0\n\t" 
++                : : "m" (*((float*)nRegReturn)) );
++            break;
++        case typelib_TypeClass_DOUBLE:
++            __asm__( "lfd 1,%0\n\t" 
++                : : "m" (*((double*)nRegReturn)) );
++            break;
++        default:
++            __asm__( "ld 3,%0\n\t" 
++                : : "m" (nRegReturn[0]) );
++            break;
++    }
 +}
 +
++const int codeSnippetSize = 24;
++
 +unsigned char *  codeSnippet( unsigned char * code, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, 
 +                              bool simpleRetType)
 +{
@@ -1031,7 +908,7 @@
 +}
 +
 +unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
-+    void ** slots, unsigned char * code,
++    void ** slots, unsigned char * code, 
 +    typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
 +    sal_Int32 functionCount, sal_Int32 vtableOffset)
 +{
@@ -1084,10 +961,11 @@
 +    return code;
 +}
 +
++/* vi:set tabstop=4 shiftwidth=4 expandtab: */
 Index: udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
-diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx:1.1.2.1
---- /dev/null	Wed Jun  6 01:25:18 2007
-+++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx	Tue May 29 08:18:29 2007
+diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx:1.1.2.4
+--- /dev/null	Wed Jun 13 02:43:04 2007
++++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx	Wed Jun 13 02:16:32 2007
 @@ -0,0 +1,294 @@
 +/*************************************************************************
 + *
@@ -1384,10 +1262,10 @@
 +}
 +
 Index: udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/makefile.mk
-diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/makefile.mk:1.1.2.2
---- /dev/null	Wed Jun  6 01:25:18 2007
-+++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/makefile.mk	Tue Jun  5 05:09:50 2007
-@@ -0,0 +1,93 @@
+diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/makefile.mk:1.1.2.5
+--- /dev/null	Wed Jun 13 02:43:04 2007
++++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/makefile.mk	Wed Jun 13 02:16:32 2007
+@@ -0,0 +1,87 @@
 +#*************************************************************************
 +#
 +#   OpenOffice.org - a multi-platform office productivity suite
@@ -1448,16 +1326,14 @@
 +
 +NOOPTFILES= \
 +	$(SLO)$/uno2cpp.obj \
-+	$(SLO)$/cpp2uno.obj \
-+        $(SLO)$/call.obj
++	$(SLO)$/cpp2uno.obj
 +
 +CFLAGSNOOPT=-O0
 +
 +SLOFILES= \
 +	$(SLO)$/except.obj		\
 +	$(SLO)$/cpp2uno.obj		\
-+	$(SLO)$/uno2cpp.obj		\
-+        $(SLO)$/call.obj
++	$(SLO)$/uno2cpp.obj
 +
 +SHL1TARGET= $(TARGET)
 +
@@ -1477,14 +1353,10 @@
 +# --- Targets ------------------------------------------------------
 +
 +.INCLUDE :  target.mk
-+
-+$(SLO)$/%.obj: %.s
-+    $(CC) -c -o $(SLO)$/$(@:b).o $<
-+    touch $@
 Index: udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx
-diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx:1.1.2.1
---- /dev/null	Wed Jun  6 01:25:18 2007
-+++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx	Tue May 29 08:19:15 2007
+diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx:1.1.2.4
+--- /dev/null	Wed Jun 13 02:43:04 2007
++++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx	Wed Jun 13 02:16:32 2007
 @@ -0,0 +1,99 @@
 +/*************************************************************************
 + *
@@ -1586,10 +1458,10 @@
 +    __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
 +}
 Index: udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
-diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx:1.1.2.2
---- /dev/null	Wed Jun  6 01:25:18 2007
-+++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx	Tue Jun  5 05:09:50 2007
-@@ -0,0 +1,582 @@
+diff -u /dev/null udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx:1.1.2.5
+--- /dev/null	Wed Jun 13 02:43:04 2007
++++ udk/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx	Wed Jun 13 02:16:32 2007
+@@ -0,0 +1,613 @@
 +/*************************************************************************
 + *
 + *  OpenOffice.org - a multi-platform office productivity suite
@@ -1652,9 +1524,41 @@
 +	enum ppclimits { MAX_GPR_REGS = 8, MAX_SSE_REGS = 13 };
 +}
 +
-+namespace
++void MapReturn(long r3, double dret, typelib_TypeClass eTypeClass, void *pRegisterReturn)
 +{
++    switch (eTypeClass)
++    {
++    case typelib_TypeClass_HYPER:
++    case typelib_TypeClass_UNSIGNED_HYPER:
++            *reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = r3;
++            break;
++    case typelib_TypeClass_LONG:
++    case typelib_TypeClass_UNSIGNED_LONG:
++    case typelib_TypeClass_ENUM:
++            *reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = r3;
++            break;
++    case typelib_TypeClass_CHAR:
++    case typelib_TypeClass_SHORT:
++    case typelib_TypeClass_UNSIGNED_SHORT:
++            *reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = (unsigned short)r3;
++            break;
++    case typelib_TypeClass_BOOLEAN:
++    case typelib_TypeClass_BYTE:
++            *reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = (unsigned char)r3;
++            break;
++    case typelib_TypeClass_FLOAT:
++            *reinterpret_cast<float *>( pRegisterReturn ) = dret;
++	    break;
++    case typelib_TypeClass_DOUBLE:
++            *reinterpret_cast<double *>( pRegisterReturn ) = dret;
++            break;
++    default:
++            break;
++    }
++}
 +
++namespace
++{
 +//==================================================================================================
 +static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex, 
 +	void * pRegisterReturn, typelib_TypeDescription * pReturnTypeDescr, 
@@ -1680,7 +1584,7 @@
 +                        fprintf( stderr, "0x%lx, ", pGPR[i] );
 +                fprintf( stderr, "\nFPR's (%d): ", nFPR );
 +                for ( int i = 0; i < nFPR; ++i ) 
-+                        fprintf( stderr, "%f, ", pFPR[i] );
++                        fprintf( stderr, "0x%lx (%f), ", pFPR[i], pFPR[i] );
 +                fprintf( stderr, "\nStack (%d): ", nStack );
 +                for ( int i = 0; i < nStack; ++i )
 +                        fprintf( stderr, "0x%lx, ", pStack[i] );
@@ -1696,15 +1600,13 @@
 +    sal_uInt64 pMethod = *((sal_uInt64 *)pThis);
 +    pMethod += 8 * nVtableIndex;
 +    pMethod = *((sal_uInt64 *)pMethod);
-+    void (*ptr)() = (void (*)())pMethod;
 +
-+    volatile double dret;
-+    volatile long r3, r4;
++    typedef void (* FunctionCall )( sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64 );
++    FunctionCall pFunc = (FunctionCall)pMethod;
 +
-+#ifdef CMC_DEBUG
-+    fprintf(stderr, "before call\n");
-+#endif
++    volatile double dret;
 +
++    //  fill registers
 +    __asm__ __volatile__ (
 +                "ld   3,  0(%0)\n\t"
 +                "ld   4,  8(%0)\n\t"
@@ -1733,48 +1635,27 @@
 +                  "fr10", "fr11", "fr12", "fr13"
 +    );
 +
-+    (*ptr)();
++    // tell gcc that r3 to r11 are not available to it for doing the TOC and exception munge on the func call
++    register sal_uInt64 r3 asm("r3");
++    register sal_uInt64 r4 asm("r4");
++    register sal_uInt64 r5 asm("r5");
++    register sal_uInt64 r6 asm("r6");
++    register sal_uInt64 r7 asm("r7");
++    register sal_uInt64 r8 asm("r8");
++    register sal_uInt64 r9 asm("r9");
++    register sal_uInt64 r10 asm("r10");
++    register sal_uInt64 r11 asm("r11");
 +
++    (*pFunc)(r3, r4, r5, r6, r7, r8, r9, r10);
++
++    // get return value
 +    __asm__ __volatile__ (
 +                "mr     %1,     3\n\t"
 +                "mr     %2,     4\n\t"
 +                "fmr    %0,     1\n\t"
 +                : "=f" (dret), "=r" (r3), "=r" (r4) : );
 +
-+#ifdef CMC_DEBUG
-+    fprintf(stderr, "after call r3 is %ld\n", r3);
-+#endif
-+
-+    switch (pReturnTypeDescr->eTypeClass)
-+    {
-+    case typelib_TypeClass_HYPER:
-+    case typelib_TypeClass_UNSIGNED_HYPER:
-+            *reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = r3;
-+            break;
-+    case typelib_TypeClass_LONG:
-+    case typelib_TypeClass_UNSIGNED_LONG:
-+    case typelib_TypeClass_ENUM:
-+            *reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<volatile sal_uInt32*>( &r3);
-+            break;
-+    case typelib_TypeClass_CHAR:
-+    case typelib_TypeClass_SHORT:
-+    case typelib_TypeClass_UNSIGNED_SHORT:
-+            *reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<volatile sal_uInt16*>( &r3);
-+            break;
-+    case typelib_TypeClass_BOOLEAN:
-+    case typelib_TypeClass_BYTE:
-+            *reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<volatile sal_uInt8*>( &r3);
-+            break;
-+    case typelib_TypeClass_FLOAT:
-+    case typelib_TypeClass_DOUBLE:
-+            *reinterpret_cast<double *>( pRegisterReturn ) = dret;
-+            break;
-+    default:
-+#ifdef CMC_DEBUG
-+	    fprintf(stderr, "I don't think any action needs to be taken ?\n");
-+#endif
-+            break;
-+    }
++    MapReturn(r3, dret, pReturnTypeDescr->eTypeClass, pRegisterReturn);
 +}
 +
 +// Macros for easier insertion of values to registers or stack
@@ -1785,34 +1666,52 @@
 +
 +// The value in %xmm register is already prepared to be retrieved as a float,
 +// thus we treat float and double the same
-+#define INSERT_FLOAT_DOUBLE( pSV, nr, pFPR, pDS ) \
++#define INSERT_FLOAT( pSV, nr, pFPR, pDS, bOverflow ) \
++        if ( nr < ppc64::MAX_SSE_REGS ) \
++                pFPR[nr++] = *reinterpret_cast<float *>( pSV ); \
++        else \
++        	bOverFlow = true; \
++        if (bOverFlow) \
++                *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
++
++#define INSERT_DOUBLE( pSV, nr, pFPR, pDS, bOverflow ) \
 +        if ( nr < ppc64::MAX_SSE_REGS ) \
 +                pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \
 +        else \
++        	bOverFlow = true; \
++        if (bOverFlow) \
 +                *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
 +
-+#define INSERT_INT64( pSV, nr, pGPR, pDS ) \
++#define INSERT_INT64( pSV, nr, pGPR, pDS, bOverflow ) \
 +        if ( nr < ppc64::MAX_GPR_REGS ) \
 +                pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
 +        else \
++		bOverFlow = true; \
++	if (bOverFlow) \
 +                *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV );
 +
-+#define INSERT_INT32( pSV, nr, pGPR, pDS ) \
++#define INSERT_INT32( pSV, nr, pGPR, pDS, bOverflow ) \
 +        if ( nr < ppc64::MAX_GPR_REGS ) \
 +                pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \
 +        else \
++                bOverFlow = true; \
++        if (bOverFlow) \
 +                *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV );
 +
-+#define INSERT_INT16( pSV, nr, pGPR, pDS ) \
++#define INSERT_INT16( pSV, nr, pGPR, pDS, bOverflow ) \
 +        if ( nr < ppc64::MAX_GPR_REGS ) \
 +                pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \
 +        else \
++                bOverFlow = true; \
++        if (bOverFlow) \
 +                *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV );
 +
-+#define INSERT_INT8( pSV, nr, pGPR, pDS ) \
++#define INSERT_INT8( pSV, nr, pGPR, pDS, bOverflow ) \
 +        if ( nr < ppc64::MAX_GPR_REGS ) \
 +                pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
 +        else \
++                bOverFlow = true; \
++        if (bOverFlow) \
 +                *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
 +
 +//================================================================================================== 
@@ -1840,6 +1739,8 @@
 +	
 +	void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
 +
++        bool bOverFlow = false;
++
 +	if (pReturnTypeDescr)
 +	{
 +#ifdef CMC_DEBUG
@@ -1860,7 +1761,7 @@
 +#ifdef CMC_DEBUG
 +			fprintf(stderr, "pCppReturn/pUnoReturn is %lx/%lx", pCppReturn, pUnoReturn);
 +#endif
-+			INSERT_INT64( &pCppReturn, nGPR, pGPR, pStack );
++			INSERT_INT64( &pCppReturn, nGPR, pGPR, pStack, bOverFlow );
 +		}
 +	}
 +	// push "this" pointer
@@ -1868,7 +1769,7 @@
 +#ifdef CMC_DEBUG
 +	fprintf(stderr, "this pointer is %p\n", pAdjustedThisPtr);
 +#endif
-+	INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack );
++	INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack, bOverFlow );
 +
 +        // Args 
 +        void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams );
@@ -1896,7 +1797,8 @@
 +		
 +		if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
 +		{
-+			uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
++//			uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
++			uno_copyAndConvertData( pCppArgs[nPos] = pStack, pUnoArgs[nPos], pParamTypeDescr,
 +									pThis->getBridge()->getUno2Cpp() );
 +		        switch (pParamTypeDescr->eTypeClass)
 +                        {
@@ -1905,7 +1807,7 @@
 +#ifdef CMC_DEBUG
 +				fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]);
 +#endif
-+                                INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack );
++                                INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
 +                                break;
 +                        case typelib_TypeClass_LONG:
 +                        case typelib_TypeClass_UNSIGNED_LONG:
@@ -1913,20 +1815,22 @@
 +#ifdef CMC_DEBUG
 +				fprintf(stderr, "long is %x\n", pCppArgs[nPos]);
 +#endif
-+                                INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack );
++                                INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
 +                                break;
 +                        case typelib_TypeClass_SHORT:
 +                        case typelib_TypeClass_CHAR:
 +                        case typelib_TypeClass_UNSIGNED_SHORT:
-+                                INSERT_INT16( pCppArgs[nPos], nGPR, pGPR, pStack );
++                                INSERT_INT16( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
 +                                break;
 +                        case typelib_TypeClass_BOOLEAN:
 +                        case typelib_TypeClass_BYTE:
-+                                INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack );
++                                INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
 +                                break;
 +                        case typelib_TypeClass_FLOAT:
++                                INSERT_FLOAT( pCppArgs[nPos], nFPR, pFPR, pStack, bOverFlow );
++				break;
 +                        case typelib_TypeClass_DOUBLE:
-+                                INSERT_FLOAT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack );
++                                INSERT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack, bOverFlow );
 +                                break;
 +                        }
 +
@@ -1975,13 +1879,12 @@
 +                                // no longer needed
 +                                TYPELIB_DANGER_RELEASE( pParamTypeDescr );
 +                        }
-+                        INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack );
++                        INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack, bOverFlow );
 +		}
 +	}
 +  
 +	try
 +	{
-+		OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" );
 +               callVirtualMethod(
 +                        pAdjustedThisPtr, aVtableSlot.index,
 +                        pCppReturn, pReturnTypeDescr, 




More information about the fedora-extras-commits mailing list