summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-03-19 12:25:27 +0000
committerOliver Bolte <obo@openoffice.org>2004-03-19 12:25:27 +0000
commite2c31d6c4f0f5771bd76ec2355b5d83b0f8d80e1 (patch)
tree1aae7b847aacf22852d272fcae190b05f566c484 /bridges
parente8a9ad3af837dd67ea9d0fe150488ad98af3031f (diff)
INTEGRATION: CWS sb15 (1.5.4); FILE MERGED
2004/02/15 19:51:48 khendricks 1.5.4.2: moving the defintion of flushCode out of the anonymous namespace area to be beside the other vtable functions (just in case it matters) 2004/02/15 19:00:24 khendricks 1.5.4.1: adding implementation of flushCode and related changes to ppc Linux multi-inheriti bridge code. The exact same code should work for MacOSX as well once I get a 680 MacOSX bridge
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx55
1 files changed, 19 insertions, 36 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx
index ee9b301cbe47..ac72e3fac38c 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cpp2uno.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: hr $ $Date: 2004-02-03 12:39:39 $
+ * last change: $Author: obo $ $Date: 2004-03-19 13:25:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -572,29 +572,6 @@ static void cpp_vtable_call( int nFunctionIndex, int nVtableOffset, void** gpreg
}
-//__________________________________________________________________________________________________
-void flush_icache(unsigned char *addr)
-{
- __asm__ volatile (
- "dcbf 0,%0;"
- "sync;"
- "icbi 0,%0;"
- "sync;"
- "isync;"
- : : "r"(addr) : "memory");
-}
-
-
-void flush_range(unsigned char * addr1, int size)
-{
-#define MIN_LINE_SIZE 16
- int i;
- for (i = 0; i < size; i += MIN_LINE_SIZE)
- flush_icache(addr1+i);
- flush_icache(addr1+size-1);
-}
-
-
int const codeSnippetSize = 108;
unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex, sal_Int32 vtableOffset,
@@ -693,11 +670,25 @@ unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex, sal
}
+#define MIN_LINE_SIZE 32
+
+void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const * bptr, unsigned char const * eptr)
+{
+ unsigned char * eaddr = (unsigned char *) eptr + MIN_LINE_SIZE + 1;
+ for ( unsigned char * addr = (unsigned char *) bptr; addr < eaddr; addr += MIN_LINE_SIZE) {
+ __asm__ volatile ( "dcbf 0,%0;" "icbi 0,%0;" : : "r"(addr) : "memory");
+ }
+ __asm__ volatile ( "sync;" "isync;" : : : "memory");
+}
+
+
+
void ** bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(char * block)
{
return reinterpret_cast< void ** >(block) + 2;
}
+
char * bridges::cpp_uno::shared::VtableFactory::createBlock(
sal_Int32 slotCount, void *** slots)
{
@@ -719,7 +710,6 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
// fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
// fflush(stderr);
- unsigned char * ncode;
for (sal_Int32 i = 0; i < type->nMembers; ++i) {
typelib_TypeDescription * member = 0;
TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
@@ -728,15 +718,12 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
// Getter:
*slots++ = code;
- ncode = codeSnippet(
+ code = codeSnippet(
code, functionOffset++, vtableOffset,
bridges::cpp_uno::shared::isSimpleType(
reinterpret_cast<
typelib_InterfaceAttributeTypeDescription * >(
member)->pAttributeTypeRef));
- flush_range(code,codeSnippetSize);
- code = ncode;
-
// Setter:
if (!reinterpret_cast<
@@ -744,22 +731,18 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
member)->bReadOnly)
{
*slots++ = code;
- ncode = codeSnippet(code, functionOffset++, vtableOffset, true);
- flush_range(code,codeSnippetSize);
- code = ncode;
+ code = codeSnippet(code, functionOffset++, vtableOffset, true);
}
break;
case typelib_TypeClass_INTERFACE_METHOD:
*slots++ = code;
- ncode = codeSnippet(
+ code = codeSnippet(
code, functionOffset++, vtableOffset,
bridges::cpp_uno::shared::isSimpleType(
reinterpret_cast<
typelib_InterfaceMethodTypeDescription * >(
member)->pReturnTypeRef));
- flush_range(code,codeSnippetSize);
- code = ncode;
break;
default: