VirtualBox

source: vbox/trunk/src/recompiler/VBoxREMWrapperA.asm@ 2870

Last change on this file since 2870 was 2422, checked in by vboxsync, 18 years ago

Removed the old recompiler code.

  • Property svn:keywords set to Id
File size: 11.8 KB
Line 
1; $Id: VBoxREMWrapperA.asm 2422 2007-04-30 12:03:47Z vboxsync $
2;; @file
3;
4; VBoxREM Wrapper, Assembly routines and wrapper Templates.
5;
6; InnoTek Systemberatung GmbH confidential
7;
8; Copyright (c) 2006 InnoTek Systemberatung GmbH
9;
10; Author: knut st. osmundsen <bird@innotek.de>
11;
12; All Rights Reserved
13;
14;
15
16
17
18
19;*******************************************************************************
20;* Header Files *
21;*******************************************************************************
22%include "iprt/asmdefs.mac"
23
24
25
26BEGINCODE
27
28%ifdef __WIN__
29 %ifdef __AMD64__
30
31
32BEGINPROC WrapGCC2MSC0Int
33%ifdef USE_DIRECT_CALLS
34 jmp $+5+0deadbeefh
35%else
36 mov rax, 0xdeadf00df00ddead
37 jmp rax
38%endif
39ENDPROC WrapGCC2MSC0Int
40
41
42BEGINPROC WrapGCC2MSC1Int
43 push rbp
44 mov rbp, rsp
45 sub rsp, 10h
46
47 mov rcx, rdi
48%ifdef USE_DIRECT_CALLS
49 call $+5+0deadbeefh
50%else
51 mov rax, 0xdeadf00df00ddead
52 call rax
53%endif
54
55 leave
56 ret
57ENDPROC WrapGCC2MSC1Int
58
59
60BEGINPROC WrapGCC2MSC2Int
61 push rbp
62 mov rbp, rsp
63 sub rsp, 10h
64
65 mov rdx, rsi
66 mov rcx, rdi
67%ifdef USE_DIRECT_CALLS
68 call $+5+0deadbeefh
69%else
70 mov rax, 0xdeadf00df00ddead
71 call rax
72%endif
73
74 leave
75 ret
76ENDPROC WrapGCC2MSC2Int
77
78
79BEGINPROC WrapGCC2MSC3Int
80 push rbp
81 mov rbp, rsp
82 sub rsp, 20h
83
84 mov r8, rdx
85 mov rdx, rsi
86 mov rcx, rdi
87%ifdef USE_DIRECT_CALLS
88 call $+5+0deadbeefh
89%else
90 mov rax, 0xdeadf00df00ddead
91 call rax
92%endif
93
94 leave
95 ret
96ENDPROC WrapGCC2MSC3Int
97
98
99BEGINPROC WrapGCC2MSC4Int
100 push rbp
101 mov rbp, rsp
102 sub rsp, 20h
103
104 mov r9, rcx
105 mov r8, rdx
106 mov rdx, rsi
107 mov rcx, rdi
108%ifdef USE_DIRECT_CALLS
109 call $+5+0deadbeefh
110%else
111 mov rax, 0xdeadf00df00ddead
112 call rax
113%endif
114
115 leave
116 ret
117ENDPROC WrapGCC2MSC4Int
118
119
120BEGINPROC WrapGCC2MSC5Int
121 push rbp
122 mov rbp, rsp
123 sub rsp, 30h
124
125 mov [rsp + 20h], r8
126 mov r9, rcx
127 mov r8, rdx
128 mov rdx, rsi
129 mov rcx, rdi
130%ifdef USE_DIRECT_CALLS
131 call $+5+0deadbeefh
132%else
133 mov rax, 0xdeadf00df00ddead
134 call rax
135%endif
136
137 leave
138 ret
139ENDPROC WrapGCC2MSC5Int
140
141
142BEGINPROC WrapGCC2MSC6Int
143 push rbp
144 mov rbp, rsp
145 sub rsp, 30h
146
147 mov [rsp + 28h], r9
148 mov [rsp + 20h], r8
149 mov r9, rcx
150 mov r8, rdx
151 mov rdx, rsi
152 mov rcx, rdi
153%ifdef USE_DIRECT_CALLS
154 call $+5+0deadbeefh
155%else
156 mov rax, 0xdeadf00df00ddead
157 call rax
158%endif
159
160 leave
161 ret
162ENDPROC WrapGCC2MSC6Int
163
164
165BEGINPROC WrapGCC2MSC7Int
166 push rbp
167 mov rbp, rsp
168 sub rsp, 40h
169
170 mov r11, [ebp + 10h]
171 mov [rsp + 30h], r11
172 mov [rsp + 28h], r9
173 mov [rsp + 20h], r8
174 mov r9, rcx
175 mov r8, rdx
176 mov rdx, rsi
177 mov rcx, rdi
178%ifdef USE_DIRECT_CALLS
179 call $+5+0deadbeefh
180%else
181 mov rax, 0xdeadf00df00ddead
182 call rax
183%endif
184
185 leave
186 ret
187ENDPROC WrapGCC2MSC7Int
188
189
190BEGINPROC WrapGCC2MSC8Int
191 push rbp
192 mov rbp, rsp
193 sub rsp, 40h
194
195 mov r10, [ebp + 18h]
196 mov [rsp + 38h], r10
197 mov r11, [ebp + 10h]
198 mov [rsp + 30h], r11
199 mov [rsp + 28h], r9
200 mov [rsp + 20h], r8
201 mov r9, rcx
202 mov r8, rdx
203 mov rdx, rsi
204 mov rcx, rdi
205%ifdef USE_DIRECT_CALLS
206 call $+5+0deadbeefh
207%else
208 mov rax, 0xdeadf00df00ddead
209 call rax
210%endif
211
212 leave
213 ret
214ENDPROC WrapGCC2MSC8Int
215
216
217BEGINPROC WrapGCC2MSC9Int
218 push rbp
219 mov rbp, rsp
220 sub rsp, 50h
221
222 mov rax, [ebp + 20h]
223 mov [rsp + 40h], rax
224 mov r10, [ebp + 18h]
225 mov [rsp + 38h], r10
226 mov r11, [ebp + 10h]
227 mov [rsp + 30h], r11
228 mov [rsp + 28h], r9
229 mov [rsp + 20h], r8
230 mov r9, rcx
231 mov r8, rdx
232 mov rdx, rsi
233 mov rcx, rdi
234%ifdef USE_DIRECT_CALLS
235 call $+5+0deadbeefh
236%else
237 mov rax, 0xdeadf00df00ddead
238 call rax
239%endif
240
241 leave
242 ret
243ENDPROC WrapGCC2MSC9Int
244
245
246BEGINPROC WrapGCC2MSC10Int
247 push rbp
248 mov rbp, rsp
249 sub rsp, 50h
250
251 mov r11, [ebp + 28h]
252 mov [rsp + 48h], r11
253 mov rax, [ebp + 20h]
254 mov [rsp + 40h], rax
255 mov r10, [ebp + 18h]
256 mov [rsp + 38h], r10
257 mov r11, [ebp + 10h]
258 mov [rsp + 30h], r11
259 mov [rsp + 28h], r9
260 mov [rsp + 20h], r8
261 mov r9, rcx
262 mov r8, rdx
263 mov rdx, rsi
264 mov rcx, rdi
265%ifdef USE_DIRECT_CALLS
266 call $+5+0deadbeefh
267%else
268 mov rax, 0xdeadf00df00ddead
269 call rax
270%endif
271
272 leave
273 ret
274ENDPROC WrapGCC2MSC10Int
275
276
277BEGINPROC WrapGCC2MSC11Int
278 push rbp
279 mov rbp, rsp
280 sub rsp, 60h
281
282 mov r10, [ebp + 30h]
283 mov [rsp + 50h], r10
284 mov r11, [ebp + 28h]
285 mov [rsp + 48h], r11
286 mov rax, [ebp + 20h]
287 mov [rsp + 40h], rax
288 mov r10, [ebp + 18h]
289 mov [rsp + 38h], r10
290 mov r11, [ebp + 10h]
291 mov [rsp + 30h], r11
292 mov [rsp + 28h], r9
293 mov [rsp + 20h], r8
294 mov r9, rcx
295 mov r8, rdx
296 mov rdx, rsi
297 mov rcx, rdi
298%ifdef USE_DIRECT_CALLS
299 call $+5+0deadbeefh
300%else
301 mov rax, 0xdeadf00df00ddead
302 call rax
303%endif
304
305 leave
306 ret
307ENDPROC WrapGCC2MSC11Int
308
309
310BEGINPROC WrapGCC2MSC12Int
311 push rbp
312 mov rbp, rsp
313 sub rsp, 60h
314
315 mov rax, [ebp + 28h]
316 mov [rsp + 48h], rax
317 mov r10, [ebp + 30h]
318 mov [rsp + 50h], r10
319 mov r11, [ebp + 28h]
320 mov [rsp + 48h], r11
321 mov rax, [ebp + 20h]
322 mov [rsp + 40h], rax
323 mov r10, [ebp + 18h]
324 mov [rsp + 38h], r10
325 mov r11, [ebp + 10h]
326 mov [rsp + 30h], r11
327 mov [rsp + 28h], r9
328 mov [rsp + 20h], r8
329 mov r9, rcx
330 mov r8, rdx
331 mov rdx, rsi
332 mov rcx, rdi
333%ifdef USE_DIRECT_CALLS
334 call $+5+0deadbeefh
335%else
336 mov rax, 0xdeadf00df00ddead
337 call rax
338%endif
339
340 leave
341 ret
342ENDPROC WrapGCC2MSC12Int
343
344
345
346BEGINPROC WrapGCC2MSCVariadictInt
347%ifdef DEBUG
348 ; check that there are NO floting point arguments in XMM registers!
349 or rax, rax
350 jz .ok
351 int3
352.ok:
353%endif
354 sub rsp, 28h
355 mov r11, [rsp + 28h] ; r11 = return address.
356 mov [rsp + 28h], r9
357 mov [rsp + 20h], r8
358 mov r9, rcx
359 mov [rsp + 18h], r9 ; (*)
360 mov r8, rdx
361 mov [rsp + 14h], r8 ; (*)
362 mov rdx, rsi
363 mov [rsp + 8h], rdx ; (*)
364 mov rcx, rdi
365 mov [rsp], rcx ; (*)
366 mov rsi, r11 ; rsi is preserved by the callee.
367%ifdef USE_DIRECT_CALLS
368 call $+5+0deadbeefh
369%else
370 mov rax, 0xdeadf00df00ddead
371 call rax
372%endif
373
374 add rsp, 30h
375 jmp rsi
376 ; (*) unconditionally spill the registers, just in case '...' implies weird stuff on MSC. Check this out!
377ENDPROC WrapGCC2MSCVariadictInt
378
379
380
381;
382; The other way around:
383;
384
385
386BEGINPROC WrapMSC2GCC0Int
387 push rbp
388 mov rbp, rsp
389 sub rsp, 10h
390 mov [ebp - 10h], rsi
391 mov [ebp - 18h], rdi
392
393%ifdef USE_DIRECT_CALLS
394 call $+5+0deadbeefh
395%else
396 mov rax, 0xdeadf00df00ddead
397 call rax
398%endif
399
400 mov rdi, [ebp - 18h]
401 mov rsi, [ebp - 10h]
402 leave
403 ret
404ENDPROC WrapMSC2GCC0Int
405
406
407BEGINPROC WrapMSC2GCC1Int
408 push rbp
409 mov rbp, rsp
410 sub rsp, 20h
411 mov [ebp - 10h], rsi
412 mov [ebp - 18h], rdi
413
414 mov rdi, rcx
415%ifdef USE_DIRECT_CALLS
416 call $+5+0deadbeefh
417%else
418 mov rax, 0xdeadf00df00ddead
419 call rax
420%endif
421
422 mov rdi, [ebp - 18h]
423 mov rsi, [ebp - 10h]
424 leave
425 ret
426ENDPROC WrapMSC2GCC1Int
427
428
429BEGINPROC WrapMSC2GCC2Int
430 push rbp
431 mov rbp, rsp
432 sub rsp, 20h
433 mov [ebp - 10h], rsi
434 mov [ebp - 18h], rdi
435
436 mov rdi, rcx
437 mov rsi, rdx
438%ifdef USE_DIRECT_CALLS
439 call $+5+0deadbeefh
440%else
441 mov rax, 0xdeadf00df00ddead
442 call rax
443%endif
444
445 mov rdi, [ebp - 18h]
446 mov rsi, [ebp - 10h]
447 leave
448 ret
449ENDPROC WrapMSC2GCC2Int
450
451
452BEGINPROC WrapMSC2GCC3Int
453 push rbp
454 mov rbp, rsp
455 sub rsp, 20h
456 mov [ebp - 10h], rsi
457 mov [ebp - 18h], rdi
458
459 mov rdi, rcx
460 mov rsi, rdx
461 mov rdx, r8
462 call $+5+0deadbeefh
463
464 mov rdi, [ebp - 18h]
465 mov rsi, [ebp - 10h]
466 leave
467 ret
468ENDPROC WrapMSC2GCC3Int
469
470
471BEGINPROC WrapMSC2GCC4Int
472 push rbp
473 mov rbp, rsp
474 sub rsp, 20h
475 mov [ebp - 10h], rsi
476 mov [ebp - 18h], rdi
477
478 mov rdi, rcx
479 mov rsi, rdx
480 mov rdx, r8
481 mov rcx, r9
482 call $+5+0deadbeefh
483
484 mov rdi, [ebp - 18h]
485 mov rsi, [ebp - 10h]
486 leave
487 ret
488ENDPROC WrapMSC2GCC4Int
489
490
491BEGINPROC WrapMSC2GCC5Int
492 push rbp
493 mov rbp, rsp
494 sub rsp, 20h
495 mov [ebp - 10h], rsi
496 mov [ebp - 18h], rdi
497
498 mov rdi, rcx
499 mov rsi, rdx
500 mov rdx, r8
501 mov rcx, r9
502 mov r8, [ebp + 30h]
503 call $+5+0deadbeefh
504
505 mov rdi, [ebp - 18h]
506 mov rsi, [ebp - 10h]
507 leave
508 ret
509ENDPROC WrapMSC2GCC5Int
510
511
512BEGINPROC WrapMSC2GCC6Int
513 push rbp
514 mov rbp, rsp
515 sub rsp, 20h
516 mov [ebp - 10h], rsi
517 mov [ebp - 18h], rdi
518
519 mov rdi, rcx
520 mov rsi, rdx
521 mov rdx, r8
522 mov rcx, r9
523 mov r8, [ebp + 30h]
524 mov r9, [ebp + 38h]
525 call $+5+0deadbeefh
526
527 mov rdi, [ebp - 18h]
528 mov rsi, [ebp - 10h]
529 leave
530 ret
531ENDPROC WrapMSC2GCC6Int
532
533
534BEGINPROC WrapMSC2GCC7Int
535 push rbp
536 mov rbp, rsp
537 sub rsp, 30h
538 mov [ebp - 10h], rsi
539 mov [ebp - 18h], rdi
540
541 mov rdi, rcx
542 mov rsi, rdx
543 mov rdx, r8
544 mov rcx, r9
545 mov r8, [ebp + 30h]
546 mov r9, [ebp + 38h]
547 mov r10, [ebp + 40h]
548 mov [esp], r10
549 call $+5+0deadbeefh
550
551 mov rdi, [ebp - 18h]
552 mov rsi, [ebp - 10h]
553 leave
554 ret
555ENDPROC WrapMSC2GCC7Int
556
557
558BEGINPROC WrapMSC2GCC8Int
559 push rbp
560 mov rbp, rsp
561 sub rsp, 30h
562 mov [ebp - 10h], rsi
563 mov [ebp - 18h], rdi
564
565 mov rdi, rcx
566 mov rsi, rdx
567 mov rdx, r8
568 mov rcx, r9
569 mov r8, [ebp + 30h]
570 mov r9, [ebp + 38h]
571 mov r10, [ebp + 40h]
572 mov [esp], r10
573 mov r11, [ebp + 48h]
574 mov [esp + 8], r11
575 call $+5+0deadbeefh
576
577 mov rdi, [ebp - 18h]
578 mov rsi, [ebp - 10h]
579 leave
580 ret
581ENDPROC WrapMSC2GCC8Int
582
583
584BEGINPROC WrapMSC2GCC9Int
585 push rbp
586 mov rbp, rsp
587 sub rsp, 40h
588 mov [ebp - 10h], rsi
589 mov [ebp - 18h], rdi
590
591 mov rdi, rcx
592 mov rsi, rdx
593 mov rdx, r8
594 mov rcx, r9
595 mov r8, [ebp + 30h]
596 mov r9, [ebp + 38h]
597 mov r10, [ebp + 40h]
598 mov [esp], r10
599 mov r11, [ebp + 48h]
600 mov [esp + 8], r11
601 mov rax, [ebp + 50h]
602 mov [esp + 10h], rax
603 call $+5+0deadbeefh
604
605 mov rdi, [ebp - 18h]
606 mov rsi, [ebp - 10h]
607 leave
608 ret
609ENDPROC WrapMSC2GCC9Int
610
611 %endif ; __AMD64__
612%endif ; __WIN__
613
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette