summaryrefslogtreecommitdiffstats
path: root/bridges
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2007-12-12 14:35:44 +0000
committerKurt Zenker <kz@openoffice.org>2007-12-12 14:35:44 +0000
commitb88d858829cbe4065689bd5739f17c87ed5ff8dc (patch)
tree4edf32785118c49afcb6eb1a8ec8d601f8eb5413 /bridges
parentINTEGRATION: CWS configure22 (1.20.8); FILE MERGED (diff)
downloadcore-b88d858829cbe4065689bd5739f17c87ed5ff8dc.tar.gz
core-b88d858829cbe4065689bd5739f17c87ed5ff8dc.zip
INTEGRATION: CWS armeabi01 (1.2.2); FILE MERGED
2007/12/03 18:56:58 cmc 1.2.2.1: #i83775# arm eabi soft-float uno bridge
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s17
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx21
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/except.cxx21
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk7
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/share.hxx27
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx85
6 files changed, 139 insertions, 39 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s b/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s
index 917e307d8082..8fd1a38e4f51 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/armhelper.s
@@ -8,14 +8,15 @@
.global privateSnippetExecutor
.type privateSnippetExecutor, %function
privateSnippetExecutor:
- stmfd sp!, {r0-r3} @ follow other parameters on stack
- stmfd sp!, {fp,ip,lr}
- add fp, sp, #28
-
+ stmfd sp!, {r0-r3} @ follow other parameters on stack
mov r0, ip @ r0 points to functionoffset/vtable
- add r1, sp, #12 @ r1 points to this and params
+ mov ip, sp @ fix up the ip
+ stmfd sp!, {fp,ip,lr,pc} @ 8 x 4 => stack remains 8 aligned
+ sub fp, ip, #4 @ set frame pointer
+
+ add r1, sp, #16 @ r1 points to this and params
bl cpp_vtable_call(PLT)
- add sp, sp, #28 @ restore stack
- ldr fp, [sp, #-28] @ restore fp
- ldr pc, [sp, #-20] @ return
+ add sp, sp, #32 @ restore stack
+ ldr fp, [sp, #-32] @ restore frame pointer
+ ldr pc, [sp, #-24] @ return
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
index 62ef5a84786c..02f924e05752 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: cpp2uno.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: ihi $ $Date: 2007-11-26 18:01:44 $
+ * last change: $Author: kz $ $Date: 2007-12-12 15:34:25 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -70,7 +70,8 @@ namespace
sal_Int64 * pRegisterReturn /* space for register return */ )
{
// pCallStack: ret, [return ptr], this, params
- char * pCppStack = (char *)(pCallStack + 0);
+ char * pTopStack = (char *)(pCallStack + 0);
+ char * pCppStack = pTopStack;
// return
typelib_TypeDescription * pReturnTypeDescr = 0;
@@ -125,6 +126,19 @@ namespace
if (!rParam.bOut &&
bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{
+#ifdef __ARM_EABI__
+ switch (pParamTypeDescr->eTypeClass)
+ {
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ case typelib_TypeClass_DOUBLE:
+ if ((pCppStack - pTopStack) % 8) pCppStack+=sizeof(sal_Int32); //align to 8
+ break;
+ default:
+ break;
+ }
+#endif
+
pCppArgs[nPos] = pCppStack;
pUnoArgs[nPos] = pCppStack;
switch (pParamTypeDescr->eTypeClass)
@@ -406,7 +420,6 @@ extern "C" sal_Int64 cpp_vtable_call( long *pFunctionAndOffset,
sal_Int64 nRegReturn;
cpp_mediate( pFunctionAndOffset[0], pFunctionAndOffset[1], pCallStack,
&nRegReturn );
-
return nRegReturn;
}
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
index a30dbd3010a1..0e6716deebe2 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: except.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: ihi $ $Date: 2007-11-26 18:02:01 $
+ * last change: $Author: kz $ $Date: 2007-12-12 15:34:44 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -284,8 +284,21 @@ namespace CPPU_CURRENT_NAMESPACE
}
}
- __cxa_throw( pCppExc, rtti, deleteException );
+
+ __cxa_throw( pCppExc, rtti, deleteException );
+ }
+
+#ifdef __ARM_EABI__
+ static void* getAdjustedPtr(__cxa_exception* header)
+ {
+ return (void*)header->unwindHeader.barrier_cache.bitpattern[0];
}
+#else
+ static void* getAdjustedPtr(__cxa_exception* header)
+ {
+ return header->adjustedPtr;
+ }
+#endif
//===================================================================
void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
@@ -326,7 +339,7 @@ namespace CPPU_CURRENT_NAMESPACE
else
{
// construct uno exception any
- uno_any_constructAndConvert( pUnoExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
+ uno_any_constructAndConvert( pUnoExc, getAdjustedPtr(header), pExcTypeDescr, pCpp2Uno );
typelib_typedescription_release( pExcTypeDescr );
}
}
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk b/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk
index 3119316f5e5a..e27cd51e429c 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.2 $
+# $Revision: 1.3 $
#
-# last change: $Author: ihi $ $Date: 2007-11-26 18:02:19 $
+# last change: $Author: kz $ $Date: 2007-12-12 15:35:04 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -84,13 +84,14 @@ CFLAGSCXX += -fno-omit-frame-pointer
NOOPTFILES= \
$(SLO)$/cpp2uno.obj \
+ $(SLO)$/except.obj \
$(SLO)$/uno2cpp.obj
CFLAGSNOOPT=-O0
SLOFILES= \
- $(SLO)$/except.obj \
$(SLO)$/cpp2uno.obj \
+ $(SLO)$/except.obj \
$(SLO)$/uno2cpp.obj \
$(SLO)$/armhelper.obj
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
index 580afa006fa1..72d9bc258d22 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: share.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: ihi $ $Date: 2007-11-26 18:02:35 $
+ * last change: $Author: kz $ $Date: 2007-12-12 15:35:25 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -32,11 +32,14 @@
* MA 02111-1307 USA
*
************************************************************************/
+#ifndef _ARM_SHARE_HXX
+#define _ARM_SHARE_HXX
#include "uno/mapping.h"
#include <typeinfo>
#include <exception>
#include <cstddef>
+#include <unwind.h>
namespace CPPU_CURRENT_NAMESPACE
{
@@ -45,14 +48,6 @@ namespace CPPU_CURRENT_NAMESPACE
// -- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
- struct _Unwind_Exception
- {
- unsigned exception_class __attribute__((__mode__(__DI__)));
- void * exception_cleanup;
- unsigned private_1 __attribute__((__mode__(__word__)));
- unsigned private_2 __attribute__((__mode__(__word__)));
- } __attribute__((__aligned__));
-
struct __cxa_exception
{
::std::type_info *exceptionType;
@@ -64,13 +59,16 @@ namespace CPPU_CURRENT_NAMESPACE
__cxa_exception *nextException;
int handlerCount;
-
+#ifdef __ARM_EABI__
+ __cxa_exception *nextPropagatingException;
+ int propagationCount;
+#else
int handlerSwitchValue;
const unsigned char *actionRecord;
const unsigned char *languageSpecificData;
void *catchTemp;
void *adjustedPtr;
-
+#endif
_Unwind_Exception unwindHeader;
};
@@ -84,6 +82,9 @@ namespace CPPU_CURRENT_NAMESPACE
{
__cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
+#ifdef __ARM_EABI__
+ __cxa_exception *propagatingExceptions;
+#endif
};
extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
@@ -96,5 +97,5 @@ namespace CPPU_CURRENT_NAMESPACE
void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
-
+#endif
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
index 18418852da97..7866459fb925 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: uno2cpp.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: ihi $ $Date: 2007-11-26 18:02:47 $
+ * last change: $Author: kz $ $Date: 2007-12-12 15:35:44 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -50,6 +50,53 @@
#include <stdio.h>
#include <string.h>
+#if defined(__ARM_EABI__) && !defined(__SOFTFP__)
+#error Not Implemented
+
+/*
+ some possibly handy code to detect that we have VFP registers
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <elf.h>
+
+#define HWCAP_ARM_VFP 64
+
+int hasVFP(void)
+{
+ int fd = open ("/proc/self/auxv", O_RDONLY);
+ if (fd == -1)
+ return -1;
+
+ int ret = -1;
+
+ Elf32_auxv_t buf[128];
+ ssize_t n;
+ while ((ret == -1) && ((n = read(fd, buf, sizeof (buf))) > 0))
+ {
+ for (int i = 0; i < 128; ++i)
+ {
+ if (buf[i].a_type == AT_HWCAP)
+ {
+ ret = (buf[i].a_un.a_val & HWCAP_ARM_VFP) ? true : false;
+ break;
+ }
+ else if (buf[i].a_type == AT_NULL)
+ {
+ ret = -2;
+ break;
+ }
+ }
+ }
+
+ close (fd);
+ return ret;
+}
+
+#endif
using namespace ::rtl;
using namespace ::com::sun::star::uno;
@@ -188,15 +235,39 @@ void callVirtualMethod(
if (bOverFlow) \
*pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV );
-#define INSERT_INT64( pSV, nr, pGPR, pDS, bOverflow ) \
+#ifdef __ARM_EABI__
+#define INSERT_INT64( pSV, nr, pGPR, pDS, pStart, bOverflow ) \
+ if ( (nr < arm::MAX_GPR_REGS) && (nr % 2) ) \
+ { \
+ ++nr; \
+ } \
+ if ( nr < arm::MAX_GPR_REGS ) \
+ { \
+ pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \
+ pGPR[nr++] = *(reinterpret_cast<sal_uInt32 *>( pSV ) + 1); \
+ } \
+ else \
+ bOverFlow = true; \
+ if (bOverFlow) \
+ { \
+ if ( (pDS - pStart) % 2) \
+ { \
+ ++pDS; \
+ } \
+ *pDS++ = reinterpret_cast<sal_uInt32 *>( pSV )[0]; \
+ *pDS++ = reinterpret_cast<sal_uInt32 *>( pSV )[1]; \
+ }
+#else
+#define INSERT_INT64( pSV, nr, pGPR, pDS, pStart, bOverflow ) \
INSERT_INT32( pSV, nr, pGPR, pDS, bOverflow) \
INSERT_INT32( ((sal_uInt32*)pSV)+1, nr, pGPR, pDS, bOverflow)
+#endif
#define INSERT_FLOAT( pSV, nr, pFPR, pDS, bOverflow ) \
INSERT_INT32( pSV, nr, pGPR, pDS, bOverflow)
-#define INSERT_DOUBLE( pSV, nr, pFPR, pDS, bOverflow ) \
- INSERT_INT64( pSV, nr, pGPR, pDS, bOverflow )
+#define INSERT_DOUBLE( pSV, nr, pFPR, pDS, pStart, bOverflow ) \
+ INSERT_INT64( pSV, nr, pGPR, pDS, pStart, bOverflow )
#define INSERT_INT16( pSV, nr, pGPR, pDS, bOverflow ) \
if ( nr < arm::MAX_GPR_REGS ) \
@@ -292,7 +363,7 @@ static void cpp_call(
#ifdef CMC_DEBUG
fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]);
#endif
- INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
+ INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, pStackStart, bOverFlow );
break;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
@@ -315,7 +386,7 @@ static void cpp_call(
INSERT_FLOAT( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
break;
case typelib_TypeClass_DOUBLE:
- INSERT_DOUBLE( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow );
+ INSERT_DOUBLE( pCppArgs[nPos], nGPR, pGPR, pStack, pStackStart, bOverFlow );
break;
}
// no longer needed