summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorjan Iversen <jani@libreoffice.org>2018-03-11 18:18:57 +0100
committerjan Iversen <jani@libreoffice.org>2018-03-11 19:09:15 +0100
commit056bc3cf26e539f4e841aeeecc8f1badff7ddc37 (patch)
tree9a440d689c6c3b0c420915e052e22d916791057c /bridges
parente42d869a2f0551aca748f70d8c2c2f770ad3742c (diff)
iOS, moved privateSnippetExecutor from asm to C function.
move asm code to C as first step towards reducing the asm code. Since iOS does not permit java/python or anything else than the compiled C++ code, the throw should be done simpler. Apart from that this is the first step in solving a stack corruption problem in the throw code Change-Id: I4f3d3a3ba3f55fb46131d9a8eeb0deebf179d95f
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx44
-rw-r--r--bridges/source/cpp_uno/gcc3_ios/ios64_helper.s36
2 files changed, 36 insertions, 44 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
index 17ed29f60789..1250beedbcda 100644
--- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
@@ -17,14 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-// For iOS devices (64-bit ARM). Originally a copy of
-// ../gcc3_linux_arm/cpp2uno.cxx.
-
-// No attempts at factoring out the large amounts of more or less
-// common code in this, cpp2uno-arm.cxx and cpp2uno-i386.cxx have been
-// done. Which is sad. But then the whole bridges/source/cpp_uno is
-// full of copy/paste. So I continue in that tradition...
-
#include <com/sun/star/uno/RuntimeException.hpp>
#include <sal/log.hxx>
#include <uno/data.h>
@@ -37,6 +29,42 @@
#include "share.hxx"
+
+// Snippet code done inline
+extern "C" void privateSnippetExecutor()
+{
+ // _privateSnippetExecutor is jumped to from each codeSnippet_*
+ asm volatile (
+ // Store potential args in general purpose registers
+ " stp x6, x7, [sp, #-16]!\n"
+ " stp x4, x5, [sp, #-16]!\n"
+ " stp x2, x3, [sp, #-16]!\n"
+ " stp x0, x1, [sp, #-16]!\n"
+
+ // Store potential args in floating point/SIMD registers
+ " stp d6, d7, [sp, #-16]!\n"
+ " stp d4, d5, [sp, #-16]!\n"
+ " stp d2, d3, [sp, #-16]!\n"
+ " stp d0, d1, [sp, #-16]!\n"
+
+ // First argument to cpp_vtable_call: The x15 set up in the codeSnippet instance
+ " mov x0, x15\n"
+
+ // Store x8 (potential pointer to return value storage) and lr
+ " stp x8, lr, [sp, #-16]!\n"
+
+ // Second argument: The pointer to all the above
+ " mov x1, sp\n"
+
+ " bl _cpp_vtable_call\n"
+
+ " ldp x8, lr, [sp, #0]\n"
+ " add sp, sp, #144\n"
+ " ret lr\n"
+ );
+}
+
+
extern "C" {
extern int nFunIndexes, nVtableOffsets;
extern int codeSnippets[];
diff --git a/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s b/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s
index 6e6e8c74b347..14a62a012e11 100644
--- a/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s
+++ b/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s
@@ -221,40 +221,4 @@ _codeSnippets:
.long codeSnippet_00000007_3 - _codeSnippets
-
- .text
- .align 4
-
-_privateSnippetExecutor:
-
- .cfi_startproc
- // _privateSnippetExecutor is jumped to from each of the
- // codeSnippet_* generated by generate-snippets.pl
-
- // Store potential args in general purpose registers
- stp x6, x7, [sp, #-16]!
- stp x4, x5, [sp, #-16]!
- stp x2, x3, [sp, #-16]!
- stp x0, x1, [sp, #-16]!
-
- // Store potential args in floating point/SIMD registers
- stp d6, d7, [sp, #-16]!
- stp d4, d5, [sp, #-16]!
- stp d2, d3, [sp, #-16]!
- stp d0, d1, [sp, #-16]!
-
- // First argument to cpp_vtable_call: The x15 set up in the codeSnippet instance
- mov x0, x15
- // Store x8 (potential pointer to return value storage) and lr
- stp x8, lr, [sp, #-16]!
- // Second argument: The pointer to all the above
- mov x1, sp
-
- bl _cpp_vtable_call
-
- ldp x8, lr, [sp, #0]
- add sp, sp, #144
- ret lr
- .cfi_endproc
-
// vim:set shiftwidth=4 softtabstop=4 expandtab: