1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
|
// -*- Mode: Asm; tab-width: 4; tab-stop-list: (4 12 32); comment-column: 30; comment-start: "// "; indent-tabs-mode: nil -*-
//
// 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 .
//
#include "codesnippets.S"
#ifdef(__arm64)
.text
.align 4
_privateSnippetExecutor:
.cfi_startproc
// _privateSnippetExecutor is jumped to from each of the
// codeSnippet_* generated by generate-snippets.pl
// Store potential args in general purpose registers
stp x6, x7, [sp, #-16]!
stp x4, x5, [sp, #-16]!
stp x2, x3, [sp, #-16]!
stp x0, x1, [sp, #-16]!
// Store potential args in floating point/SIMD registers
stp d6, d7, [sp, #-16]!
stp d4, d5, [sp, #-16]!
stp d2, d3, [sp, #-16]!
stp d0, d1, [sp, #-16]!
// First argument to cpp_vtable_call: The x15 set up in the codeSnippet instance
mov x0, x15
// Store x8 (potential pointer to return value storage) and lr
stp x8, lr, [sp, #-16]!
// Second argument: The pointer to all the above
mov x1, sp
bl _cpp_vtable_call
ldp x8, lr, [sp, #0]
add sp, sp, #144
ret lr
.cfi_endproc
#elif defined(__i386)
// i386 code, for the simulator
.text
.align 1, 0x90
_privateSnippetExecutorGeneral:
LFBg:
movl %esp,%ecx
pushl %ebp // proper stack frame needed for exception handling
LCFIg0:
movl %esp,%ebp
LCFIg1:
subl $0x8,%esp // padding + 32bit returnValue
pushl %esp // 32bit &returnValue
pushl %ecx // 32bit pCallStack
pushl %edx // 32bit nVtableOffset
pushl %eax // 32bit nFunctionIndex
call L_cpp_vtable_call$stub
movl 16(%esp),%eax // 32bit returnValue
leave
ret
LFEg:
.long .-_privateSnippetExecutorGeneral
.align 1, 0x90
_privateSnippetExecutorVoid:
LFBv:
movl %esp,%ecx
pushl %ebp // proper stack frame needed for exception handling
LCFIv0:
movl %esp,%ebp
LCFIv1:
sub $8,%esp // padding
pushl $0 // 32bit null pointer (returnValue not used)
pushl %ecx // 32bit pCallStack
pushl %edx // 32bit nVtableOffset
pushl %eax // 32bit nFunctionIndex
call L_cpp_vtable_call$stub
leave
ret
LFEv:
.long .-_privateSnippetExecutorVoid
.align 1, 0x90
_privateSnippetExecutorHyper:
LFBh:
movl %esp,%ecx
pushl %ebp // proper stack frame needed for exception handling
LCFIh0:
movl %esp,%ebp
LCFIh1:
subl $0x8,%esp // 64bit returnValue
pushl %esp // 32bit &returnValue
pushl %ecx // 32bit pCallStack
pushl %edx // 32bit nVtableOffset
pushl %eax // 32bit nFunctionIndex
call L_cpp_vtable_call$stub
movl 16(%esp),%eax // 64bit returnValue, lower half
movl 20(%esp),%edx // 64bit returnValue, upper half
leave
ret
LFEh:
.long .-_privateSnippetExecutorHyper
.align 1, 0x90
_privateSnippetExecutorFloat:
LFBf:
movl %esp,%ecx
pushl %ebp // proper stack frame needed for exception handling
LCFIf0:
movl %esp,%ebp
LCFIf1:
subl $0x8,%esp // padding + 32bit returnValue
pushl %esp // 32bit &returnValue
pushl %ecx // 32bit pCallStack
pushl %edx // 32bit nVtableOffset
pushl %eax // 32bit nFunctionIndex
call L_cpp_vtable_call$stub
flds 16(%esp) // 32bit returnValue
leave
ret
LFEf:
.long .-_privateSnippetExecutorFloat
.align 1, 0x90
_privateSnippetExecutorDouble:
LFBd:
movl %esp,%ecx
pushl %ebp // proper stack frame needed for exception handling
LCFId0:
movl %esp,%ebp
LCFId1:
subl $0x8,%esp // 64bit returnValue
pushl %esp // 32bit &returnValue
pushl %ecx // 32bit pCallStack
pushl %edx // 32bit nVtableOffset
pushl %eax // 32bit nFunctionIndex
call L_cpp_vtable_call$stub
fldl 16(%esp) // 64bit returnValue
leave
ret
LFEd:
.long .-_privateSnippetExecutorDouble
.align 1, 0x90
_privateSnippetExecutorClass:
LFBc:
movl %esp,%ecx
pushl %ebp // proper stack frame needed for exception handling
LCFIc0:
movl %esp,%ebp
LCFIc1:
subl $0x8,%esp // padding + 32bit returnValue
pushl %esp // 32bit &returnValue
pushl %ecx // 32bit pCallStack
pushl %edx // 32bit nVtableOffset
pushl %eax // 32bit nFunctionIndex
call L_cpp_vtable_call$stub
movl 16(%esp),%eax // 32bit returnValue
leave
ret $4
LFEc:
.long .-_privateSnippetExecutorClass
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame1:
.set L$set$frame1,LECIE1-LSCIE1
.long L$set$frame1 // length
LSCIE1:
.long 0 // CIE_ID
.byte 1 // version
.ascii "zPR\0" // augmentation
.byte 1 // code_alignment_factor (.uleb128 1)
.byte 0x7c // data_alignment_factor (.sleb128 -4)
.byte 8 // return_address_register
.byte 0x6 // augmentation size 7:
.byte 0x9b // ???
.long L___gxx_personality_v0$non_lazy_ptr-.
.byte 0x10
// initial_instructions:
.byte 0x0C // DW_CFA_def_cfa %esp, 4
.byte 5
.byte 4
.byte 0x88 // DW_CFA_offset ret, 1
.byte 1
.align 2
LECIE1:
_privateSnippetExecutorGeneral.eh:
LSFDEg:
.set L$set$g1,LEFDEg-LASFDEg
.long L$set$g1 // length
LASFDEg:
.long LASFDEg-EH_frame1 // CIE_pointer
.long LFBg-. // initial_location
.long LFEg-LFBg // address_range
.byte 0 // augmentation size 0
// instructions:
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIg0-LFBg
.byte 0x0E // DW_CFA_def_cfa_offset 8
.byte 8
.byte 0x84 // DW_CFA_offset %ebp, 2
.byte 2
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIg1-LCFIg0
.byte 0x0D // DW_CFA_def_cfa_register %ebp
.byte 4
.align 2
LEFDEg:
_privateSnippetExecutorVoid.eh:
LSFDEv:
.set L$set$v1,LEFDEv-LASFDEv
.long L$set$v1 // length
LASFDEv:
.long LASFDEv-EH_frame1 // CIE_pointer
.long LFBv-. // initial_location
.long LFEv-LFBv // address_range
.byte 0 // augmentation size 0
// instructions:
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIv0-LFBv
.byte 0x0E // DW_CFA_def_cfa_offset 8
.byte 8
.byte 0x84 // DW_CFA_offset %ebp, 2
.byte 2
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIv1-LCFIv0
.byte 0x0D // DW_CFA_def_cfa_register %ebp
.byte 4
.align 2
LEFDEv:
_privateSnippetExecutorHyper.eh:
LSFDEh:
.set L$set$h1,LEFDEh-LASFDEh
.long L$set$h1 // length
LASFDEh:
.long LASFDEh-EH_frame1 // CIE_pointer
.long LFBh-. // initial_location
.long LFEh-LFBh // address_range
.byte 0 // augmentation size 0
// instructions:
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIh0-LFBh
.byte 0x0E // DW_CFA_def_cfa_offset 8
.byte 8
.byte 0x84 // DW_CFA_offset %ebp, 2
.byte 2
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIh1-LCFIh0
.byte 0x0D // DW_CFA_def_cfa_register %ebp
.byte 4
.align 2
LEFDEh:
_privateSnippetExecutorFloat.eh:
LSFDEf:
.set L$set$f1,LEFDEf-LASFDEf
.long L$set$f1 // length
LASFDEf:
.long LASFDEf-EH_frame1 // CIE_pointer
.long LFBf-. // initial_location
.long LFEf-LFBf // address_range
.byte 0 // augmentation size 0
// instructions:
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIf0-LFBf
.byte 0x0E // DW_CFA_def_cfa_offset 8
.byte 8
.byte 0x84 // DW_CFA_offset %ebp, 2
.byte 2
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIf1-LCFIf0
.byte 0x0D // DW_CFA_def_cfa_register %ebp
.byte 4
.align 2
LEFDEf:
_privateSnippetExecutorDouble.eh:
LSFDEd:
.set L$set$d1,LEFDEd-LASFDEd
.long L$set$d1 // length
LASFDEd:
.long LASFDEd-EH_frame1 // CIE_pointer
.long LFBd-. // initial_location
.long LFEd-LFBd // address_range
.byte 0 // augmentation size 0
// instructions:
.byte 0x04 // DW_CFA_advance_loc4
.long LCFId0-LFBd
.byte 0x0E // DW_CFA_def_cfa_offset 8
.byte 8
.byte 0x84 // DW_CFA_offset %ebp, 2
.byte 2
.byte 0x04 // DW_CFA_advance_loc4
.long LCFId1-LCFId0
.byte 0x0D // DW_CFA_def_cfa_register %ebp
.byte 4
.align 2
LEFDEd:
_privateSnippetExecutorClass.eh:
LSFDEc:
.set L$set$c1,LEFDEc-LASFDEc
.long L$set$c1 // length
LASFDEc:
.long LASFDEc-EH_frame1 // CIE_pointer
.long LFBc-. // initial_location
.long LFEc-LFBc // address_range
.byte 0 // augmentation size 0
// instructions:
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIc0-LFBc
.byte 0x0E // DW_CFA_def_cfa_offset 8
.byte 8
.byte 0x84 // DW_CFA_offset %ebp, 2
.byte 2
.byte 0x04 // DW_CFA_advance_loc4
.long LCFIc1-LCFIc0
.byte 0x0D // DW_CFA_def_cfa_register %ebp
.byte 4
.align 2
LEFDEc:
.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5
L_cpp_vtable_call$stub:
.indirect_symbol _cpp_vtable_call
hlt ; hlt ; hlt ; hlt ; hlt
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L___gxx_personality_v0$non_lazy_ptr:
.indirect_symbol ___gxx_personality_v0
.long 0
.constructor
.destructor
.align 1
#else
.text
.align 2
.globl privateSnippetExecutor
_privateSnippetExecutor:
.LFB3:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
subq $160, %rsp
.LCFI2:
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
.LFE3:
# see http://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
# for details of the .eh_frame, the "Common Information Entry" and "Frame Description Entry" formats
# and http://mentorembedded.github.io/cxx-abi/exceptions.pdf for more info
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zR"
.uleb128 0x1
.sleb128 -8
.byte 0x10
.uleb128 0x1
.byte 0x1b
.byte 0xc
.uleb128 0x7
.uleb128 0x8
.byte 0x90
.uleb128 0x1
.align 8
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB3-.
.long .LFE3-.LFB3
.uleb128 0x0
.byte 0x4
.long .LCFI0-.LFB3
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI1-.LCFI0
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE1:
#endif
// vim:set shiftwidth=4 softtabstop=4 expandtab:
|