xref: /AOO41X/main/bridges/source/cpp_uno/cc50_solaris_intel/call.s (revision d2748020ce41a64ef548fe1dae7ba98cbf99a183)
1//**************************************************************
2/ *
3/ * Licensed to the Apache Software Foundation (ASF) under one
4/ * or more contributor license agreements.  See the NOTICE file
5/ * distributed with this work for additional information
6/ * regarding copyright ownership.  The ASF licenses this file
7/ * to you under the Apache License, Version 2.0 (the
8/ * "License"); you may not use this file except in compliance
9/ * with the License.  You may obtain a copy of the License at
10/ *
11/ *   http://www.apache.org/licenses/LICENSE-2.0
12/ *
13/ * Unless required by applicable law or agreed to in writing,
14/ * software distributed under the License is distributed on an
15/ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16/ * KIND, either express or implied.  See the License for the
17/ * specific language governing permissions and limitations
18/ * under the License.
19/ *
20/ *************************************************************/
21
22    .align 4
23    .globl privateSnippetExecutorGeneral
24privateSnippetExecutorGeneral:
25    movl    %esp,%ecx
26    pushl   %ebp              / proper stack frame needed for exception handling
27    movl    %esp,%ebp
28    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
29    subl    $0x8,%esp         / 64bit nRegReturn
30    pushl   %ecx              / 32bit pCallStack
31    pushl   %edx              / 32bit nVtableOffset
32    pushl   %eax              / 32bit nFunctionIndex
33    call    cpp_vtable_call
34    movl    12(%esp),%eax     / 64 bit nRegReturn, lower half
35    leave
36    ret
37    .type privateSnippetExecutorGeneral, @function
38    .size privateSnippetExecutorGeneral, .-privateSnippetExecutorGeneral
39
40    .align 4
41    .globl privateSnippetExecutorVoid
42privateSnippetExecutorVoid:
43    movl    %esp,%ecx
44    pushl   %ebp              / proper stack frame needed for exception handling
45    movl    %esp,%ebp
46    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
47    subl    $0x8,%esp         / 64bit nRegReturn
48    pushl   %ecx              / 32bit pCallStack
49    pushl   %edx              / 32bit nVtableOffset
50    pushl   %eax              / 32bit nFunctionIndex
51    call    cpp_vtable_call
52    leave
53    ret
54    .type privateSnippetExecutorVoid, @function
55    .size privateSnippetExecutorVoid, .-privateSnippetExecutorVoid
56
57    .align 4
58    .globl privateSnippetExecutorHyper
59privateSnippetExecutorHyper:
60    movl    %esp,%ecx
61    pushl   %ebp              / proper stack frame needed for exception handling
62    movl    %esp,%ebp
63    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
64    subl    $0x8,%esp         / 64bit nRegReturn
65    pushl   %ecx              / 32bit pCallStack
66    pushl   %edx              / 32bit nVtableOffset
67    pushl   %eax              / 32bit nFunctionIndex
68    call    cpp_vtable_call
69    movl    12(%esp),%eax     / 64 bit nRegReturn, lower half
70    movl    16(%esp),%edx     / 64 bit nRegReturn, upper half
71    leave
72    ret
73    .type privateSnippetExecutorHyper, @function
74    .size privateSnippetExecutorHyper, .-privateSnippetExecutorHyper
75
76    .align 4
77    .globl privateSnippetExecutorFloat
78privateSnippetExecutorFloat:
79    movl    %esp,%ecx
80    pushl   %ebp              / proper stack frame needed for exception handling
81    movl    %esp,%ebp
82    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
83    subl    $0x8,%esp         / 64bit nRegReturn
84    pushl   %ecx              / 32bit pCallStack
85    pushl   %edx              / 32bit nVtableOffset
86    pushl   %eax              / 32bit nFunctionIndex
87    call    cpp_vtable_call
88    flds    12(%esp)          / 64 bit nRegReturn, lower half
89    leave
90    ret
91    .type privateSnippetExecutorFloat, @function
92    .size privateSnippetExecutorFloat, .-privateSnippetExecutorFloat
93
94    .align 4
95    .globl privateSnippetExecutorDouble
96privateSnippetExecutorDouble:
97    movl    %esp,%ecx
98    pushl   %ebp              / proper stack frame needed for exception handling
99    movl    %esp,%ebp
100    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
101    subl    $0x8,%esp         / 64bit nRegReturn
102    pushl   %ecx              / 32bit pCallStack
103    pushl   %edx              / 32bit nVtableOffset
104    pushl   %eax              / 32bit nFunctionIndex
105    call    cpp_vtable_call
106    fldl    12(%esp)          / 64 bit nRegReturn
107    leave
108    ret
109    .type privateSnippetExecutorDouble, @function
110    .size privateSnippetExecutorDouble, .-privateSnippetExecutorDouble
111
112    .align 4
113    .globl privateSnippetExecutorStruct
114privateSnippetExecutorStruct:
115    movl    %esp,%ecx
116    pushl   %ebp              / proper stack frame needed for exception handling
117    movl    %esp,%ebp
118    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
119    subl    $0x8,%esp         / 64bit nRegReturn
120    pushl   %ecx              / 32bit pCallStack
121    pushl   %edx              / 32bit nVtableOffset
122    pushl   %eax              / 32bit nFunctionIndex
123    call    cpp_vtable_call
124    movl    12(%esp),%eax     / 64 bit nRegReturn, lower half
125    leave
126    ret     $4
127    .type privateSnippetExecutorStruct, @function
128    .size privateSnippetExecutorStruct, .-privateSnippetExecutorStruct
129
130    .align 4
131    .globl callVirtualMethod
132callVirtualMethod:
133    pushl   %ebp
134    movl    %esp, %ebp
135    subl    $24, %esp
136    movl    %edx, -4(%ebp)
137    movl    %ecx, -8(%ebp)
138    movl    %eax, -12(%ebp)
139    movl    %esp, -16(%ebp)
140    movl    %ebx, -20(%ebp)
141
142    / set ebx to GOT
143.L_GOT_BEGIN_2:
144    call    .L_GOT_END_2
145.L_GOT_END_2:
146    popl    %ebx
147    addl    $_GLOBAL_OFFSET_TABLE_+[.-.L_GOT_END_2],%ebx
148.callBeginPosition:
149    movl    28(%ebp), %eax
150    movl    %eax, %edx
151    dec     %edx
152    shl     $2, %edx
153    add     24(%ebp), %edx
154.copyLong:
155    movl    0(%edx), %ecx
156    sub     $4, %edx
157    push    %ecx
158    dec     %eax
159    jne     .copyLong
160.doCall:
161    movl    8(%ebp), %edx
162    movl    0(%edx), %edx
163    movl    12(%ebp), %eax
164    add     $2, %eax
165    shl     $2, %eax
166    add     %eax, %edx
167    movl    0(%edx), %edx
168
169    call    *%edx
170
171.callVirtualMethodExceptionPosition:
172    / handle returns
173    movl    20(%ebp), %ecx
174
175    / byte types
176    cmp     $2, %ecx    / typelib_TypeClass_BOOLEAN
177    je      .handleByte
178    cmp     $3, %ecx
179    je      .handleByte / typelib_TypeClass_BYTE
180
181    / half word types
182    cmp    $4, %ecx     / typelib_TypeClass_SHORT
183    je     .handleShort
184    cmp    $5, %ecx     / typelib_TypeClass_UNSIGNED_SHORT
185    je     .handleShort
186
187    / word types
188    cmp    $6, %ecx     / typelib_TypeClass_LONG
189    je     .handleWord
190    cmp    $7, %ecx     / typelib_TypeClass_UNSIGNED_LONG
191    je     .handleWord
192    cmp    $1, %ecx     / typelib_TypeClass_CHAR (wchar_t)
193    je     .handleWord
194    cmp    $15, %ecx    / typelib_TypeClass_ENUM
195    je     .handleWord
196
197    / double word types
198    cmp    $8, %ecx     / typelib_TypeClass_HYPER
199    je     .handleDoubleWord
200    cmp    $9, %ecx     / typelib_TypeClass_UNSIGNED_HYPER
201    je     .handleDoubleWord
202
203    / float
204    cmp    $10, %ecx    / typelib_TypeClass_FLOAT
205    je     .handleFloat
206
207    / double
208    cmp    $11, %ecx    / typelib_TypeClass_DOUBLE
209    je     .handleDouble
210
211    / default: return void
212    jmp    .doRestore
213.handleByte:
214    movl    16(%ebp), %ecx
215    movb    %al, 0(%ecx)
216    jmp     .doRestore
217.handleShort:
218    movl    16(%ebp), %ecx
219    movw    %ax, 0(%ecx)
220    jmp     .doRestore
221.handleWord:
222    movl    16(%ebp), %ecx
223    movl    %eax, 0(%ecx)
224    jmp     .doRestore
225.handleDoubleWord:
226    movl    16(%ebp), %ecx
227    movl    %eax, 0(%ecx)
228    movl    %edx, 4(%ecx)
229    jmp     .doRestore
230.handleFloat:
231    movl    16(%ebp), %ecx
232    fstps   0(%ecx)
233    jmp     .doRestore
234.handleDouble:
235    movl    16(%ebp), %ecx
236    fstpl   0(%ecx)
237    jmp     .doRestore
238.doRestore:
239    movl    -4(%ebp), %edx
240    movl    -8(%ebp), %ecx
241    movl    -12(%ebp), %eax
242    movl    -20(%ebp), %ebx
243    movl    %ebp, %esp
244    popl    %ebp
245    ret
246    .type callVirtualMethod, @function
247    .size callVirtualMethod, .-callVirtualMethod
248
249    .globl callVirtualMethodExceptionHandler
250callVirtualMethodExceptionHandler:
251    movl    -4(%ebp), %edx
252    movl    -8(%ebp), %ecx
253    movl    -12(%ebp), %eax
254    movl    -16(%ebp), %esp
255    movl    -20(%ebp), %ebx
256    call    __1cG__CrunMex_rethrow_q6F_v_@PLT
257    ret
258
259    .type callVirtualMethodExceptionHandler, @function
260    .size callVirtualMethodExceptionHandler, .-callVirtualMethodExceptionHandler
261
262
263    .section    .exception_ranges,"aw"
264    .align      4
265
266    .4byte      .callBeginPosition@rel
267    .4byte      .callVirtualMethodExceptionPosition-.callBeginPosition
268    .4byte      callVirtualMethodExceptionHandler-.callBeginPosition
269    .zero       8
270