mozilla-aarch64-bmo-963024.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 14 Apr 2014 09:09:11 +0200
changeset 716 cef565f1c325
parent 715 e1c226a4de34
permissions -rw-r--r--
update to Firefox 29.0b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
715
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     1
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     2
# HG changeset patch
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     3
# User Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     4
# Date 1393440196 18000
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     5
# Node ID d56b5c1a557348d4ac14a4d1ea7a5b5d240e3647
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     6
# Parent  6a46f53ad944b44385398822d7bcf7621a785d91
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     7
Bug 963024 - AArch64 support for XPCOM. r=froydnj
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     8
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
     9
diff --git a/xpcom/reflect/xptcall/src/md/unix/moz.build b/xpcom/reflect/xptcall/src/md/unix/moz.build
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    10
--- a/xpcom/reflect/xptcall/src/md/unix/moz.build
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    11
+++ b/xpcom/reflect/xptcall/src/md/unix/moz.build
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    12
@@ -144,16 +144,23 @@ if CONFIG['OS_ARCH'] == 'NetBSD':
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    13
     if CONFIG['OS_TEST'] in ('amiga', 'atari', 'hp300', 'mac68k', 'mvme68k',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    14
                              'next68k', 'sun3', 'sun3x', 'x68k'):
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    15
         SOURCES += [
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    16
             'xptcinvoke_netbsd_m68k.cpp',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    17
             'xptcstubs_netbsd_m68k.cpp'
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    18
         ]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    19
 
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    20
 if CONFIG['OS_ARCH'] == 'Linux':
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    21
+    if CONFIG['OS_TEST'] == 'aarch64':
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    22
+        SOURCES += [
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    23
+            'xptcinvoke_aarch64.cpp',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    24
+            'xptcinvoke_asm_aarch64.s',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    25
+            'xptcstubs_aarch64.cpp',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    26
+            'xptcstubs_asm_aarch64.s',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    27
+        ]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    28
     if CONFIG['OS_TEST'] == 'm68k':
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    29
         SOURCES += [
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    30
             'xptcinvoke_linux_m68k.cpp',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    31
             'xptcstubs_linux_m68k.cpp',
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    32
         ]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    33
     if CONFIG['OS_TEST'].find('mips') != -1:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    34
         if CONFIG['OS_TEST'].find('mips64') != -1:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    35
             SOURCES += [
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    36
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_aarch64.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_aarch64.cpp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    37
new file mode 100644
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    38
--- /dev/null
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    39
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_aarch64.cpp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    40
@@ -0,0 +1,136 @@
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    41
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    42
+/* This Source Code Form is subject to the terms of the Mozilla Public
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    43
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    44
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    45
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    46
+/* Platform specific code to invoke XPCOM methods on native objects */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    47
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    48
+#include "xptcprivate.h"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    49
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    50
+#if !defined(__aarch64__)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    51
+#error "This code is for Linux AArch64 only."
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    52
+#endif
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    53
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    54
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    55
+/* "Procedure Call Standard for the ARM 64-bit Architecture" document, sections
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    56
+ * "5.4 Parameter Passing" and "6.1.2 Procedure Calling" contain all the
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    57
+ * needed information.
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    58
+ *
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    59
+ * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    60
+ */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    61
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    62
+#ifndef __AARCH64EL__
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    63
+#error "Only little endian compatibility was tested"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    64
+#endif
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    65
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    66
+/*
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    67
+ * Allocation of integer function arguments initially to registers r1-r7
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    68
+ * and then to stack. Handling of 'that' argument which goes to register r0
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    69
+ * is handled separately and does not belong here.
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    70
+ *
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    71
+ * 'ireg_args'  - pointer to the current position in the buffer,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    72
+ *                corresponding to the register arguments
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    73
+ * 'stack_args' - pointer to the current position in the buffer,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    74
+ *                corresponding to the arguments on stack
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    75
+ * 'end'        - pointer to the end of the registers argument
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    76
+ *                buffer.
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    77
+ */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    78
+static inline void alloc_word(uint64_t* &ireg_args,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    79
+                              uint64_t* &stack_args,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    80
+                              uint64_t* end,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    81
+                              uint64_t  data)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    82
+{
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    83
+    if (ireg_args < end) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    84
+        *ireg_args = data;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    85
+        ireg_args++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    86
+    } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    87
+        *stack_args = data;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    88
+        stack_args++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    89
+    }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    90
+}
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    91
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    92
+static inline void alloc_double(double* &freg_args,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    93
+                                uint64_t* &stack_args,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    94
+                                double* end,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    95
+                                double  data)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    96
+{
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    97
+    if (freg_args < end) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    98
+        *freg_args = data;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
    99
+        freg_args++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   100
+    } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   101
+        memcpy(stack_args, &data, sizeof(data));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   102
+        stack_args++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   103
+    }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   104
+}
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   105
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   106
+static inline void alloc_float(double* &freg_args,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   107
+                               uint64_t* &stack_args,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   108
+                               double* end,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   109
+                               float  data)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   110
+{
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   111
+    if (freg_args < end) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   112
+        memcpy(freg_args, &data, sizeof(data));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   113
+        freg_args++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   114
+    } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   115
+        memcpy(stack_args, &data, sizeof(data));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   116
+        stack_args++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   117
+    }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   118
+}
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   119
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   120
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   121
+extern "C" void
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   122
+invoke_copy_to_stack(uint64_t* stk, uint64_t *end,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   123
+                     uint32_t paramCount, nsXPTCVariant* s)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   124
+{
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   125
+    uint64_t *ireg_args = stk;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   126
+    uint64_t *ireg_end  = ireg_args + 8;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   127
+    double *freg_args = (double *)ireg_end;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   128
+    double *freg_end  = freg_args + 8;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   129
+    uint64_t *stack_args = (uint64_t *)freg_end;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   130
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   131
+    // leave room for 'that' argument in x0
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   132
+    ++ireg_args;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   133
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   134
+    for (uint32_t i = 0; i < paramCount; i++, s++) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   135
+        if (s->IsPtrData()) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   136
+            alloc_word(ireg_args, stack_args, ireg_end, (uint64_t)s->ptr);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   137
+            continue;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   138
+        }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   139
+        // According to the ABI, integral types that are smaller than 8 bytes
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   140
+        // are to be passed in 8-byte registers or 8-byte stack slots.
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   141
+        switch (s->type) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   142
+            case nsXPTType::T_FLOAT:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   143
+                alloc_float(freg_args, stack_args, freg_end, s->val.f);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   144
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   145
+            case nsXPTType::T_DOUBLE:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   146
+                alloc_double(freg_args, stack_args, freg_end, s->val.d);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   147
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   148
+            case nsXPTType::T_I8:  alloc_word(ireg_args, stk, end, s->val.i8);   break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   149
+            case nsXPTType::T_I16: alloc_word(ireg_args, stk, end, s->val.i16);  break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   150
+            case nsXPTType::T_I32: alloc_word(ireg_args, stk, end, s->val.i32);  break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   151
+            case nsXPTType::T_I64: alloc_word(ireg_args, stk, end, s->val.i64);  break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   152
+            case nsXPTType::T_U8:  alloc_word(ireg_args, stk, end, s->val.u8);   break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   153
+            case nsXPTType::T_U16: alloc_word(ireg_args, stk, end, s->val.u16);  break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   154
+            case nsXPTType::T_U32: alloc_word(ireg_args, stk, end, s->val.u32);  break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   155
+            case nsXPTType::T_U64: alloc_word(ireg_args, stk, end, s->val.u64);  break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   156
+            case nsXPTType::T_BOOL: alloc_word(ireg_args, stk, end, s->val.b);   break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   157
+            case nsXPTType::T_CHAR: alloc_word(ireg_args, stk, end, s->val.c);   break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   158
+            case nsXPTType::T_WCHAR: alloc_word(ireg_args, stk, end, s->val.wc); break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   159
+            default:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   160
+                // all the others are plain pointer types
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   161
+                alloc_word(ireg_args, stack_args, ireg_end,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   162
+                           reinterpret_cast<uint64_t>(s->val.p));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   163
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   164
+        }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   165
+    }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   166
+}
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   167
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   168
+extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   169
+                                      uint32_t paramCount, nsXPTCVariant* params);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   170
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   171
+EXPORT_XPCOM_API(nsresult)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   172
+NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   173
+                 uint32_t paramCount, nsXPTCVariant* params)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   174
+{
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   175
+    return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   176
+}
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   177
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_aarch64.s b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_aarch64.s
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   178
new file mode 100644
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   179
--- /dev/null
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   180
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_aarch64.s
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   181
@@ -0,0 +1,67 @@
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   182
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   183
+/* This Source Code Form is subject to the terms of the Mozilla Public
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   184
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   185
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   186
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   187
+        .section ".text"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   188
+            .globl _NS_InvokeByIndex
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   189
+            .type  _NS_InvokeByIndex,@function
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   190
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   191
+/*
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   192
+ * _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   193
+ *                   uint32_t paramCount, nsXPTCVariant* params)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   194
+ */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   195
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   196
+_NS_InvokeByIndex:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   197
+            # set up frame
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   198
+            stp         x29, x30, [sp,#-32]!
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   199
+            mov         x29, sp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   200
+            stp         x19, x20, [sp,#16]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   201
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   202
+            # save methodIndex across function calls
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   203
+            mov         w20, w1
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   204
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   205
+            # end of stack area passed to invoke_copy_to_stack
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   206
+            mov         x1, sp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   207
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   208
+            # assume 8 bytes of stack for each argument with 16-byte alignment
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   209
+            add         w19, w2, #1
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   210
+            and         w19, w19, #0xfffffffe
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   211
+            sub         sp, sp, w19, uxth #3
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   212
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   213
+            # temporary place to store args passed in r0-r7,v0-v7
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   214
+            sub         sp, sp, #128
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   215
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   216
+            # save 'that' on stack
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   217
+            str         x0, [sp]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   218
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   219
+            # start of stack area passed to invoke_copy_to_stack
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   220
+            mov         x0, sp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   221
+            bl          invoke_copy_to_stack
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   222
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   223
+            # load arguments passed in r0-r7
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   224
+            ldp         x6, x7, [sp, #48]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   225
+            ldp         x4, x5, [sp, #32]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   226
+            ldp         x2, x3, [sp, #16]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   227
+            ldp         x0, x1, [sp],#64
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   228
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   229
+            # load arguments passed in v0-v7
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   230
+            ldp         d6, d7, [sp, #48]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   231
+            ldp         d4, d5, [sp, #32]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   232
+            ldp         d2, d3, [sp, #16]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   233
+            ldp         d0, d1, [sp],#64
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   234
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   235
+            # call the method
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   236
+            ldr         x16, [x0]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   237
+            add         x16, x16, w20, uxth #3
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   238
+            ldr         x16, [x16]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   239
+            blr         x16
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   240
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   241
+            add         sp, sp, w19, uxth #3
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   242
+            ldp         x19, x20, [sp,#16]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   243
+            ldp         x29, x30, [sp],#32
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   244
+            ret
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   245
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   246
+            .size _NS_InvokeByIndex, . - _NS_InvokeByIndex
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   247
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   248
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   249
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_aarch64.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_aarch64.cpp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   250
new file mode 100644
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   251
--- /dev/null
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   252
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_aarch64.cpp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   253
@@ -0,0 +1,219 @@
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   254
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   255
+/* This Source Code Form is subject to the terms of the Mozilla Public
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   256
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   257
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   258
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   259
+#include "xptcprivate.h"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   260
+#include "xptiprivate.h"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   261
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   262
+#ifndef __AARCH64EL__
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   263
+#error "Only little endian compatibility was tested"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   264
+#endif
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   265
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   266
+/*
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   267
+ * This is for AArch64 ABI
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   268
+ *
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   269
+ * When we're called, the "gp" registers are stored in gprData and
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   270
+ * the "fp" registers are stored in fprData. Each array has 8 regs
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   271
+ * but first reg in gprData is a placeholder for 'self'.
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   272
+ */
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   273
+extern "C" nsresult
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   274
+PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint64_t* args,
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   275
+                   uint64_t *gprData, double *fprData)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   276
+{
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   277
+#define PARAM_BUFFER_COUNT        16
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   278
+#define PARAM_GPR_COUNT            8
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   279
+#define PARAM_FPR_COUNT            8
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   280
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   281
+    nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   282
+    nsXPTCMiniVariant* dispatchParams = NULL;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   283
+    const nsXPTMethodInfo* info;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   284
+    nsresult result = NS_ERROR_FAILURE;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   285
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   286
+    NS_ASSERTION(self,"no self");
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   287
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   288
+    self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   289
+    NS_ASSERTION(info,"no method info");
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   290
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   291
+    uint32_t paramCount = info->GetParamCount();
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   292
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   293
+    // setup variant array pointer
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   294
+    if (paramCount > PARAM_BUFFER_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   295
+        dispatchParams = new nsXPTCMiniVariant[paramCount];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   296
+    } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   297
+        dispatchParams = paramBuffer;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   298
+    }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   299
+    NS_ASSERTION(dispatchParams,"no place for params");
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   300
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   301
+    uint64_t* ap = args;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   302
+    uint32_t next_gpr = 1; // skip first arg which is 'self'
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   303
+    uint32_t next_fpr = 0;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   304
+    for (uint32_t i = 0; i < paramCount; i++) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   305
+        const nsXPTParamInfo& param = info->GetParam(i);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   306
+        const nsXPTType& type = param.GetType();
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   307
+        nsXPTCMiniVariant* dp = &dispatchParams[i];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   308
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   309
+        if (param.IsOut() || !type.IsArithmetic()) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   310
+            if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   311
+                dp->val.p = (void*)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   312
+            } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   313
+                dp->val.p = (void*)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   314
+            }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   315
+            continue;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   316
+        }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   317
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   318
+        switch (type) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   319
+            case nsXPTType::T_I8:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   320
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   321
+                    dp->val.i8  = (int8_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   322
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   323
+                    dp->val.i8  = (int8_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   324
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   325
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   326
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   327
+            case nsXPTType::T_I16:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   328
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   329
+                    dp->val.i16  = (int16_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   330
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   331
+                    dp->val.i16  = (int16_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   332
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   333
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   334
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   335
+            case nsXPTType::T_I32:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   336
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   337
+                    dp->val.i32  = (int32_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   338
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   339
+                    dp->val.i32  = (int32_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   340
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   341
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   342
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   343
+            case nsXPTType::T_I64:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   344
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   345
+                    dp->val.i64  = (int64_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   346
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   347
+                    dp->val.i64  = (int64_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   348
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   349
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   350
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   351
+            case nsXPTType::T_U8:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   352
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   353
+                    dp->val.u8  = (uint8_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   354
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   355
+                    dp->val.u8  = (uint8_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   356
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   357
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   358
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   359
+            case nsXPTType::T_U16:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   360
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   361
+                    dp->val.u16  = (uint16_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   362
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   363
+                    dp->val.u16  = (uint16_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   364
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   365
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   366
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   367
+            case nsXPTType::T_U32:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   368
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   369
+                    dp->val.u32  = (uint32_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   370
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   371
+                    dp->val.u32  = (uint32_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   372
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   373
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   374
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   375
+            case nsXPTType::T_U64:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   376
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   377
+                    dp->val.u64  = (uint64_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   378
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   379
+                    dp->val.u64  = (uint64_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   380
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   381
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   382
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   383
+            case nsXPTType::T_FLOAT:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   384
+                if (next_fpr < PARAM_FPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   385
+                    memcpy(&dp->val.f, &fprData[next_fpr++], sizeof(dp->val.f));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   386
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   387
+                    memcpy(&dp->val.f, ap++, sizeof(dp->val.f));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   388
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   389
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   390
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   391
+            case nsXPTType::T_DOUBLE:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   392
+                if (next_fpr < PARAM_FPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   393
+                    memcpy(&dp->val.d, &fprData[next_fpr++], sizeof(dp->val.d));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   394
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   395
+                    memcpy(&dp->val.d, ap++, sizeof(dp->val.d));
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   396
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   397
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   398
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   399
+            case nsXPTType::T_BOOL:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   400
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   401
+                    dp->val.b  = (bool)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   402
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   403
+                    dp->val.b  = (bool)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   404
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   405
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   406
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   407
+            case nsXPTType::T_CHAR:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   408
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   409
+                    dp->val.c  = (char)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   410
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   411
+                    dp->val.c  = (char)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   412
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   413
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   414
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   415
+            case nsXPTType::T_WCHAR:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   416
+                if (next_gpr < PARAM_GPR_COUNT) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   417
+                    dp->val.wc  = (wchar_t)gprData[next_gpr++];
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   418
+                } else {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   419
+                    dp->val.wc  = (wchar_t)*ap++;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   420
+                }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   421
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   422
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   423
+            default:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   424
+                NS_ASSERTION(0, "bad type");
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   425
+                break;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   426
+        }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   427
+    }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   428
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   429
+    result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   430
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   431
+    if (dispatchParams != paramBuffer) {
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   432
+        delete [] dispatchParams;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   433
+    }
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   434
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   435
+    return result;
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   436
+}
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   437
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   438
+// Load w17 with the constant 'n' and branch to SharedStub().
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   439
+# define STUB_ENTRY(n)                                                  \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   440
+    __asm__ (                                                           \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   441
+            ".section \".text\" \n\t"                                   \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   442
+            ".align 2\n\t"                                              \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   443
+            ".if "#n" < 10 \n\t"                                        \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   444
+            ".globl  _ZN14nsXPTCStubBase5Stub"#n"Ev \n\t"               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   445
+            ".hidden _ZN14nsXPTCStubBase5Stub"#n"Ev \n\t"               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   446
+            ".type   _ZN14nsXPTCStubBase5Stub"#n"Ev,@function \n\n"     \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   447
+            "_ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t"                      \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   448
+            ".elseif "#n" < 100 \n\t"                                   \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   449
+            ".globl  _ZN14nsXPTCStubBase6Stub"#n"Ev \n\t"               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   450
+            ".hidden _ZN14nsXPTCStubBase6Stub"#n"Ev \n\t"               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   451
+            ".type   _ZN14nsXPTCStubBase6Stub"#n"Ev,@function \n\n"     \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   452
+            "_ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t"                      \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   453
+            ".elseif "#n" < 1000 \n\t"                                  \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   454
+            ".globl  _ZN14nsXPTCStubBase7Stub"#n"Ev \n\t"               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   455
+            ".hidden _ZN14nsXPTCStubBase7Stub"#n"Ev \n\t"               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   456
+            ".type   _ZN14nsXPTCStubBase7Stub"#n"Ev,@function \n\n"     \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   457
+            "_ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t"                      \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   458
+            ".else  \n\t"                                               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   459
+            ".err   \"stub number "#n" >= 1000 not yet supported\"\n"   \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   460
+            ".endif \n\t"                                               \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   461
+            "mov    w17,#"#n" \n\t"                                     \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   462
+            "b      SharedStub \n"                                      \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   463
+);
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   464
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   465
+#define SENTINEL_ENTRY(n)                              \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   466
+    nsresult nsXPTCStubBase::Sentinel##n()             \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   467
+{                                                      \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   468
+    NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   469
+    return NS_ERROR_NOT_IMPLEMENTED;                   \
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   470
+}
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   471
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   472
+#include "xptcstubsdef.inc"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   473
diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_aarch64.s b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_aarch64.s
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   474
new file mode 100644
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   475
--- /dev/null
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   476
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_aarch64.s
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   477
@@ -0,0 +1,39 @@
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   478
+# This Source Code Form is subject to the terms of the Mozilla Public
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   479
+# License, v. 2.0. If a copy of the MPL was not distributed with this
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   480
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   481
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   482
+            .set NGPREGS,8
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   483
+            .set NFPREGS,8
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   484
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   485
+            .section ".text"
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   486
+            .globl SharedStub
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   487
+            .hidden SharedStub
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   488
+            .type  SharedStub,@function
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   489
+SharedStub:
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   490
+            stp         x29, x30, [sp,#-16]!
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   491
+            mov         x29, sp
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   492
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   493
+            sub         sp, sp, #8*(NGPREGS+NFPREGS)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   494
+            stp         x0, x1, [sp, #64+(0*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   495
+            stp         x2, x3, [sp, #64+(2*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   496
+            stp         x4, x5, [sp, #64+(4*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   497
+            stp         x6, x7, [sp, #64+(6*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   498
+            stp         d0, d1, [sp, #(0*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   499
+            stp         d2, d3, [sp, #(2*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   500
+            stp         d4, d5, [sp, #(4*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   501
+            stp         d6, d7, [sp, #(6*8)]
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   502
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   503
+            # methodIndex passed from stub
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   504
+            mov         w1, w17
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   505
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   506
+            add         x2, sp, #16+(8*(NGPREGS+NFPREGS))
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   507
+            add         x3, sp, #8*NFPREGS
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   508
+            add         x4, sp, #0
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   509
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   510
+            bl          PrepareAndDispatch
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   511
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   512
+            add         sp, sp, #8*(NGPREGS+NFPREGS)
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   513
+            ldp         x29, x30, [sp],#16
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   514
+            ret
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   515
+
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   516
+            .size SharedStub, . - SharedStub
e1c226a4de34 AArch64 porting
Dirk M?ller <dmueller@suse.com>
parents:
diff changeset
   517