diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-06-04 13:24:59 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-06-05 16:01:43 +0200 |
commit | 6b8393474974d2af7a2cb3c47b3d5c081b550bdb (patch) | |
tree | 06f801a497d0a33161996fdfca10398a59b229fa /bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx | |
parent | Use background back->Use background cache (diff) | |
download | core-6b8393474974d2af7a2cb3c47b3d5c081b550bdb.tar.gz core-6b8393474974d2af7a2cb3c47b3d5c081b550bdb.zip |
fix gcc inline assembler operands usage
Apparently whoever did these didn't get the gcc docs and specified
every operand only as input, and then added volatile, explicit
initialization and what not until it worked. Specify output operands
correctly instead.
I couldn't verify all assembler variants, as I don't know them,
but the ones I don't know had at least some proper usage of output
operands, so I'll assume those are all correct.
Change-Id: I2910308b5e00cce8db756496df50ed26cfe35bb6
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx index 9b14f17c526c..7c09e3ce7369 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx @@ -70,11 +70,11 @@ void callVirtualMethod( // never called if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something - volatile long edx = 0, eax = 0; // for register returns - void * stackptr = 0; + long edx, eax; // for register returns + void * stackptr; asm volatile ( - "mov %%esp, %6\n\t" - "mov %0, %%eax\n\t" + "mov %%esp, %2\n\t" + "mov %3, %%eax\n\t" "mov %%eax, %%edx\n\t" // stack padding to keep stack aligned: "shl $2, %%eax\n\t" @@ -86,28 +86,27 @@ void callVirtualMethod( "mov %%edx, %%eax\n\t" "dec %%edx\n\t" "shl $2, %%edx\n\t" - "add %1, %%edx\n" + "add %4, %%edx\n" "Lcopy:\n\t" "pushl 0(%%edx)\n\t" "sub $4, %%edx\n\t" "dec %%eax\n\t" "jne Lcopy\n\t" // do the actual call - "mov %2, %%edx\n\t" + "mov %5, %%edx\n\t" "mov 0(%%edx), %%edx\n\t" - "mov %3, %%eax\n\t" + "mov %6, %%eax\n\t" "shl $2, %%eax\n\t" "add %%eax, %%edx\n\t" "mov 0(%%edx), %%edx\n\t" "call *%%edx\n\t" // save return registers - "mov %%eax, %4\n\t" - "mov %%edx, %5\n\t" + "mov %%eax, %0\n\t" + "mov %%edx, %1\n\t" // cleanup stack - "mov %6, %%esp\n\t" - : - : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), - "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr) + "mov %2, %%esp\n\t" + : "=m"(eax), "=m"(edx), "=m"(stackptr) + : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex) : "eax", "ecx", "edx" ); switch( pReturnTypeDescr->eTypeClass ) { @@ -131,10 +130,10 @@ void callVirtualMethod( *(unsigned char*)pRegisterReturn = eax; break; case typelib_TypeClass_FLOAT: - asm ( "fstps %0" : : "m"(*(char *)pRegisterReturn) ); + asm ( "fstps %0" : "=m"(*(char *)pRegisterReturn) ); break; case typelib_TypeClass_DOUBLE: - asm ( "fstpl %0\n\t" : : "m"(*(char *)pRegisterReturn) ); + asm ( "fstpl %0\n\t" : "=m"(*(char *)pRegisterReturn) ); break; default: { sal_Int32 const nRetSize = pReturnTypeDescr->nSize; |