summaryrefslogtreecommitdiff
path: root/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.s
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-09-26 22:51:03 +0300
committerTor Lillqvist <tml@iki.fi>2012-09-27 08:20:44 +0300
commitd83de4b1a93ba7ed7bc3243073be3de96a44bfa9 (patch)
treeef5bbc6a0d8155fcab8a6029f3cf45ebdbc86f9b /bridges/source/cpp_uno/gcc3_macosx_x86-64/call.s
parent30d33b126f47021a99fb8ca63d6c6be29407e9cc (diff)
First attempt at C++/UNO bridge for 64-bit OS X
Basically, a 1:1 copy of the Linux x86-64 one. The Apple docs say that "The OS X x86-64 function calling conventions are the same as the function calling conventions described in System V Application Binary Interface AMD64 Architecture Processor Supplement," which should mean that it's the same as on Linux. Once this works, the very minor differences to the Linux one will be merged as ifdefs into the Linux one, and no separate source files will be needed. Change-Id: I1ff58f303a7ab7f59ec2ff7a9e24465e89151ec5
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_macosx_x86-64/call.s')
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_x86-64/call.s79
1 files changed, 79 insertions, 0 deletions
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.s b/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.s
new file mode 100644
index 000000000000..8b8072ff049c
--- /dev/null
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.s
@@ -0,0 +1,79 @@
+/*
+ * 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 .
+ */
+
+ .text
+ .align 4, 0x90
+ .globl _privateSnippetExecutor
+_privateSnippetExecutor:
+ .cfi_startproc
+.LFB3:
+ pushq %rbp
+.LCFI0:
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+.LCFI1:
+ subq $160, %rsp
+.LCFI2:
+ .cfi_def_cfa_register %rbp
+ movq %r10, -152(%rbp) # Save (nVtableOffset << 32) + nFunctionIndex
+
+ movq %rdi, -112(%rbp) # Save GP registers
+ movq %rsi, -104(%rbp)
+ movq %rdx, -96(%rbp)
+ movq %rcx, -88(%rbp)
+ movq %r8 , -80(%rbp)
+ movq %r9 , -72(%rbp)
+
+ movsd %xmm0, -64(%rbp) # Save FP registers
+ movsd %xmm1, -56(%rbp)
+ movsd %xmm2, -48(%rbp)
+ movsd %xmm3, -40(%rbp)
+ movsd %xmm4, -32(%rbp)
+ movsd %xmm5, -24(%rbp)
+ movsd %xmm6, -16(%rbp)
+ movsd %xmm7, -8(%rbp)
+
+ leaq -144(%rbp), %r9 # 6th param: sal_uInt64 * pRegisterReturn
+ leaq 16(%rbp), %r8 # 5rd param: void ** ovrflw
+ leaq -64(%rbp), %rcx # 4th param: void ** fpreg
+ leaq -112(%rbp), %rdx # 3rd param: void ** gpreg
+ movl -148(%rbp), %esi # 2nd param: sal_int32 nVtableOffset
+ movl -152(%rbp), %edi # 1st param: sal_int32 nFunctionIndex
+
+ call _cpp_vtable_call
+
+ cmp $10, %rax # typelib_TypeClass_FLOAT
+ je .Lfloat
+ cmp $11, %rax # typelib_TypeClass_DOUBLE
+ je .Lfloat
+
+ movq -144(%rbp), %rax # Return value (int case)
+ movq -136(%rbp), %rdx # Return value (int case)
+ movq -144(%rbp), %xmm0 # Return value (int case)
+ movq -136(%rbp), %xmm1 # Return value (int case)
+ jmp .Lfinish
+.Lfloat:
+ movlpd -144(%rbp), %xmm0 # Return value (float/double case)
+
+.Lfinish:
+ leave
+ ret
+ .cfi_endproc
+
+.subsections_via_symbols