xref: /trunk/main/bridges/source/cpp_uno/cc50_solaris_intel/call.s (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1    .align 4
2    .globl privateSnippetExecutorGeneral
3privateSnippetExecutorGeneral:
4    movl    %esp,%ecx
5    pushl   %ebp              / proper stack frame needed for exception handling
6    movl    %esp,%ebp
7    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
8    subl    $0x8,%esp         / 64bit nRegReturn
9    pushl   %ecx              / 32bit pCallStack
10    pushl   %edx              / 32bit nVtableOffset
11    pushl   %eax              / 32bit nFunctionIndex
12    call    cpp_vtable_call
13    movl    12(%esp),%eax     / 64 bit nRegReturn, lower half
14    leave
15    ret
16    .type privateSnippetExecutorGeneral, @function
17    .size privateSnippetExecutorGeneral, .-privateSnippetExecutorGeneral
18
19    .align 4
20    .globl privateSnippetExecutorVoid
21privateSnippetExecutorVoid:
22    movl    %esp,%ecx
23    pushl   %ebp              / proper stack frame needed for exception handling
24    movl    %esp,%ebp
25    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
26    subl    $0x8,%esp         / 64bit nRegReturn
27    pushl   %ecx              / 32bit pCallStack
28    pushl   %edx              / 32bit nVtableOffset
29    pushl   %eax              / 32bit nFunctionIndex
30    call    cpp_vtable_call
31    leave
32    ret
33    .type privateSnippetExecutorVoid, @function
34    .size privateSnippetExecutorVoid, .-privateSnippetExecutorVoid
35
36    .align 4
37    .globl privateSnippetExecutorHyper
38privateSnippetExecutorHyper:
39    movl    %esp,%ecx
40    pushl   %ebp              / proper stack frame needed for exception handling
41    movl    %esp,%ebp
42    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
43    subl    $0x8,%esp         / 64bit nRegReturn
44    pushl   %ecx              / 32bit pCallStack
45    pushl   %edx              / 32bit nVtableOffset
46    pushl   %eax              / 32bit nFunctionIndex
47    call    cpp_vtable_call
48    movl    12(%esp),%eax     / 64 bit nRegReturn, lower half
49    movl    16(%esp),%edx     / 64 bit nRegReturn, upper half
50    leave
51    ret
52    .type privateSnippetExecutorHyper, @function
53    .size privateSnippetExecutorHyper, .-privateSnippetExecutorHyper
54
55    .align 4
56    .globl privateSnippetExecutorFloat
57privateSnippetExecutorFloat:
58    movl    %esp,%ecx
59    pushl   %ebp              / proper stack frame needed for exception handling
60    movl    %esp,%ebp
61    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
62    subl    $0x8,%esp         / 64bit nRegReturn
63    pushl   %ecx              / 32bit pCallStack
64    pushl   %edx              / 32bit nVtableOffset
65    pushl   %eax              / 32bit nFunctionIndex
66    call    cpp_vtable_call
67    flds    12(%esp)          / 64 bit nRegReturn, lower half
68    leave
69    ret
70    .type privateSnippetExecutorFloat, @function
71    .size privateSnippetExecutorFloat, .-privateSnippetExecutorFloat
72
73    .align 4
74    .globl privateSnippetExecutorDouble
75privateSnippetExecutorDouble:
76    movl    %esp,%ecx
77    pushl   %ebp              / proper stack frame needed for exception handling
78    movl    %esp,%ebp
79    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
80    subl    $0x8,%esp         / 64bit nRegReturn
81    pushl   %ecx              / 32bit pCallStack
82    pushl   %edx              / 32bit nVtableOffset
83    pushl   %eax              / 32bit nFunctionIndex
84    call    cpp_vtable_call
85    fldl    12(%esp)          / 64 bit nRegReturn
86    leave
87    ret
88    .type privateSnippetExecutorDouble, @function
89    .size privateSnippetExecutorDouble, .-privateSnippetExecutorDouble
90
91    .align 4
92    .globl privateSnippetExecutorStruct
93privateSnippetExecutorStruct:
94    movl    %esp,%ecx
95    pushl   %ebp              / proper stack frame needed for exception handling
96    movl    %esp,%ebp
97    andl    $0xFFFFFFF8,%esp  / align following 64bit arg
98    subl    $0x8,%esp         / 64bit nRegReturn
99    pushl   %ecx              / 32bit pCallStack
100    pushl   %edx              / 32bit nVtableOffset
101    pushl   %eax              / 32bit nFunctionIndex
102    call    cpp_vtable_call
103    movl    12(%esp),%eax     / 64 bit nRegReturn, lower half
104    leave
105    ret     $4
106    .type privateSnippetExecutorStruct, @function
107    .size privateSnippetExecutorStruct, .-privateSnippetExecutorStruct
108
109    .align 4
110    .globl callVirtualMethod
111callVirtualMethod:
112    pushl   %ebp
113    movl    %esp, %ebp
114    subl    $24, %esp
115    movl    %edx, -4(%ebp)
116    movl    %ecx, -8(%ebp)
117    movl    %eax, -12(%ebp)
118    movl    %esp, -16(%ebp)
119    movl    %ebx, -20(%ebp)
120
121    / set ebx to GOT
122.L_GOT_BEGIN_2:
123    call    .L_GOT_END_2
124.L_GOT_END_2:
125    popl    %ebx
126    addl    $_GLOBAL_OFFSET_TABLE_+[.-.L_GOT_END_2],%ebx
127.callBeginPosition:
128    movl    28(%ebp), %eax
129    movl    %eax, %edx
130    dec     %edx
131    shl     $2, %edx
132    add     24(%ebp), %edx
133.copyLong:
134    movl    0(%edx), %ecx
135    sub     $4, %edx
136    push    %ecx
137    dec     %eax
138    jne     .copyLong
139.doCall:
140    movl    8(%ebp), %edx
141    movl    0(%edx), %edx
142    movl    12(%ebp), %eax
143    add     $2, %eax
144    shl     $2, %eax
145    add     %eax, %edx
146    movl    0(%edx), %edx
147
148    call    *%edx
149
150.callVirtualMethodExceptionPosition:
151    / handle returns
152    movl    20(%ebp), %ecx
153
154    / byte types
155    cmp     $2, %ecx    / typelib_TypeClass_BOOLEAN
156    je      .handleByte
157    cmp     $3, %ecx
158    je      .handleByte / typelib_TypeClass_BYTE
159
160    / half word types
161    cmp    $4, %ecx     / typelib_TypeClass_SHORT
162    je     .handleShort
163    cmp    $5, %ecx     / typelib_TypeClass_UNSIGNED_SHORT
164    je     .handleShort
165
166    / word types
167    cmp    $6, %ecx     / typelib_TypeClass_LONG
168    je     .handleWord
169    cmp    $7, %ecx     / typelib_TypeClass_UNSIGNED_LONG
170    je     .handleWord
171    cmp    $1, %ecx     / typelib_TypeClass_CHAR (wchar_t)
172    je     .handleWord
173    cmp    $15, %ecx    / typelib_TypeClass_ENUM
174    je     .handleWord
175
176    / double word types
177    cmp    $8, %ecx     / typelib_TypeClass_HYPER
178    je     .handleDoubleWord
179    cmp    $9, %ecx     / typelib_TypeClass_UNSIGNED_HYPER
180    je     .handleDoubleWord
181
182    / float
183    cmp    $10, %ecx    / typelib_TypeClass_FLOAT
184    je     .handleFloat
185
186    / double
187    cmp    $11, %ecx    / typelib_TypeClass_DOUBLE
188    je     .handleDouble
189
190    / default: return void
191    jmp    .doRestore
192.handleByte:
193    movl    16(%ebp), %ecx
194    movb    %al, 0(%ecx)
195    jmp     .doRestore
196.handleShort:
197    movl    16(%ebp), %ecx
198    movw    %ax, 0(%ecx)
199    jmp     .doRestore
200.handleWord:
201    movl    16(%ebp), %ecx
202    movl    %eax, 0(%ecx)
203    jmp     .doRestore
204.handleDoubleWord:
205    movl    16(%ebp), %ecx
206    movl    %eax, 0(%ecx)
207    movl    %edx, 4(%ecx)
208    jmp     .doRestore
209.handleFloat:
210    movl    16(%ebp), %ecx
211    fstps   0(%ecx)
212    jmp     .doRestore
213.handleDouble:
214    movl    16(%ebp), %ecx
215    fstpl   0(%ecx)
216    jmp     .doRestore
217.doRestore:
218    movl    -4(%ebp), %edx
219    movl    -8(%ebp), %ecx
220    movl    -12(%ebp), %eax
221    movl    -20(%ebp), %ebx
222    movl    %ebp, %esp
223    popl    %ebp
224    ret
225    .type callVirtualMethod, @function
226    .size callVirtualMethod, .-callVirtualMethod
227
228    .globl callVirtualMethodExceptionHandler
229callVirtualMethodExceptionHandler:
230    movl    -4(%ebp), %edx
231    movl    -8(%ebp), %ecx
232    movl    -12(%ebp), %eax
233    movl    -16(%ebp), %esp
234    movl    -20(%ebp), %ebx
235    call    __1cG__CrunMex_rethrow_q6F_v_@PLT
236    ret
237
238    .type callVirtualMethodExceptionHandler, @function
239    .size callVirtualMethodExceptionHandler, .-callVirtualMethodExceptionHandler
240
241
242    .section    .exception_ranges,"aw"
243    .align      4
244
245    .4byte      .callBeginPosition@rel
246    .4byte      .callVirtualMethodExceptionPosition-.callBeginPosition
247    .4byte      callVirtualMethodExceptionHandler-.callBeginPosition
248    .zero       8
249