summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridges/Library_cpp_uno.mk8
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx60
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_aarch64/vtableslotcall.s72
3 files changed, 75 insertions, 65 deletions
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index 40c47d6bdc17..3cdce5bbe7a8 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -30,17 +30,13 @@ else ifeq ($(CPUNAME),AARCH64)
ifneq ($(filter ANDROID DRAGONFLY FREEBSD LINUX NETBSD OPENBSD,$(OS)),)
bridges_SELECTED_BRIDGE := gcc3_linux_aarch64
-bridge_exception_objects := abi uno2cpp
+bridge_asm_objects := vtableslotcall
+bridge_exception_objects := abi cpp2uno uno2cpp
$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno, \
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/callvirtualfunction, \
$(if $(HAVE_GCC_STACK_CLASH_PROTECTION),-fno-stack-clash-protection) \
))
-
-$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno, \
- bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/cpp2uno, \
- -fstack-protector \
-))
endif
else ifeq ($(CPUNAME),AXP)
diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
index f9396321cb14..f9f26419b381 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
@@ -42,7 +42,7 @@
#include "abi.hxx"
-extern "C" void vtableSlotCall_();
+extern "C" void vtableSlotCall();
namespace {
@@ -304,64 +304,6 @@ extern "C" void vtableCall(
}
}
-struct aarch64_va_list {
- void * stack;
- void * gr_top;
- void * vr_top;
- int gr_offs;
- int vr_offs;
-};
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wuninitialized"
-#pragma GCC diagnostic ignored "-Wvolatile-register-var"
-extern "C" void vtableSlotCall(
- unsigned long gpr0, unsigned long gpr1, unsigned long gpr2,
- unsigned long gpr3, unsigned long gpr4, unsigned long gpr5,
- unsigned long gpr6, unsigned long gpr7, double fpr0, double fpr1,
- double fpr2, double fpr3, double fpr4, double fpr5, double fpr6,
- double fpr7, ...)
-{
- register void * volatile indirectRet asm ("x8");
- register sal_Int32 volatile functionIndex asm ("x9");
- register sal_Int32 volatile vtableOffset asm ("x10");
- va_list ap;
- va_start(ap, fpr7);
- assert(sizeof (va_list) == sizeof (aarch64_va_list));
- unsigned long gpr[8];
- gpr[0] = gpr0;
- gpr[1] = gpr1;
- gpr[2] = gpr2;
- gpr[3] = gpr3;
- gpr[4] = gpr4;
- gpr[5] = gpr5;
- gpr[6] = gpr6;
- gpr[7] = gpr7;
- double fpr[8];
- fpr[0] = fpr0;
- fpr[1] = fpr1;
- fpr[2] = fpr2;
- fpr[3] = fpr3;
- fpr[4] = fpr4;
- fpr[5] = fpr5;
- fpr[6] = fpr6;
- fpr[7] = fpr7;
- vtableCall(
- functionIndex, vtableOffset, gpr,
- reinterpret_cast<unsigned long *>(fpr),
- static_cast<unsigned long *>(
- reinterpret_cast<aarch64_va_list *>(&ap)->stack),
- indirectRet);
- asm volatile(
- "ldp x0, x1, [%[gpr_]]\n\t"
- "ldp d0, d1, [%[fpr_]]\n\t"
- "ldp d2, d3, [%[fpr_], #16]\n\t"
- :: [gpr_]"r" (gpr), [fpr_]"r" (fpr)
- : "r0", "r1", "v0", "v1", "v2", "v3");
- va_end(ap);
-}
-#pragma GCC diagnostic pop
-
std::size_t const codeSnippetSize = 8 * 4;
unsigned char * generateCodeSnippet(
diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/vtableslotcall.s b/bridges/source/cpp_uno/gcc3_linux_aarch64/vtableslotcall.s
new file mode 100644
index 000000000000..39873b64d7a6
--- /dev/null
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/vtableslotcall.s
@@ -0,0 +1,72 @@
+/* -*- tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+ .arch armv8-a
+ .text
+ .align 2
+ .global vtableSlotCall
+ .hidden vtableSlotCall
+ .type vtableSlotCall, %function
+vtableSlotCall:
+ .cfi_startproc
+ stp x29, x30, [sp, -192]!
+ .cfi_def_cfa_offset 192
+ .cfi_offset 29, -192
+ .cfi_offset 30, -184
+ add x11, sp, 192
+ mov x29, sp
+ stp x19, x20, [sp, 16]
+ .cfi_offset 19, -176
+ .cfi_offset 20, -168
+ add x20, sp, 128
+ add x19, sp, 64
+ stp x11, x11, [sp, 32]
+ str x11, [sp, 48]
+ stp wzr, wzr, [sp, 56]
+ stp x0, x1, [sp, 64]
+ mov w0, w9
+ mov w1, w10
+ stp x2, x3, [sp, 80]
+ mov x3, x20
+ mov x2, x19
+ stp x4, x5, [sp, 96]
+ mov x5, x8
+ mov x4, x11
+ stp x6, x7, [sp, 112]
+ stp d0, d1, [sp, 128]
+ stp d2, d3, [sp, 144]
+ stp d4, d5, [sp, 160]
+ stp d6, d7, [sp, 176]
+ bl vtableCall
+ ldp x0, x1, [x19]
+ ldp d0, d1, [x20]
+ ldp d2, d3, [x20, #16]
+ ldp x19, x20, [sp, 16]
+ ldp x29, x30, [sp], 192
+ .cfi_restore 30
+ .cfi_restore 29
+ .cfi_restore 19
+ .cfi_restore 20
+ .cfi_def_cfa_offset 0
+ ret
+ .cfi_endproc
+ .size vtableSlotCall, .-vtableSlotCall
+ .section .note.GNU-stack, "", @progbits
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab */