1 | ; $Id: VBoxREMWrapperA.asm 22528 2009-08-27 14:05:09Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; VBoxREM Wrapper, Assembly routines and wrapper Templates.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | ; Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | ; additional information or have any questions.
|
---|
20 | ;
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 |
|
---|
25 | ;*******************************************************************************
|
---|
26 | ;* Header Files *
|
---|
27 | ;*******************************************************************************
|
---|
28 | %include "iprt/asmdefs.mac"
|
---|
29 |
|
---|
30 | %define REM_FIXUP_32_REAL_STUFF 0deadbeefh
|
---|
31 | %define REM_FIXUP_64_REAL_STUFF 0deadf00df00ddeadh
|
---|
32 | %define REM_FIXUP_64_DESC 0dead00010001deadh
|
---|
33 | %define REM_FIXUP_64_LOG_ENTRY 0dead00020002deadh
|
---|
34 | %define REM_FIXUP_64_LOG_EXIT 0dead00030003deadh
|
---|
35 | %define REM_FIXUP_64_WRAP_GCC_CB 0dead00040004deadh
|
---|
36 |
|
---|
37 | ;%define ENTRY_LOGGING 1
|
---|
38 | ;%define EXIT_LOGGING 1
|
---|
39 |
|
---|
40 |
|
---|
41 | %ifdef RT_ARCH_AMD64
|
---|
42 | ;;
|
---|
43 | ; 64-bit pushad
|
---|
44 | %macro MY_PUSHAQ 0
|
---|
45 | push rax
|
---|
46 | push rbx
|
---|
47 | push rcx
|
---|
48 | push rdx
|
---|
49 | push rsi
|
---|
50 | push rdi
|
---|
51 | push rbp
|
---|
52 | push r8
|
---|
53 | push r9
|
---|
54 | push r10
|
---|
55 | push r11
|
---|
56 | push r12
|
---|
57 | push r13
|
---|
58 | push r14
|
---|
59 | push r15
|
---|
60 | %endmacro
|
---|
61 |
|
---|
62 | ;;
|
---|
63 | ; 64-bit popad
|
---|
64 | %macro MY_POPAQ 0
|
---|
65 | pop r15
|
---|
66 | pop r14
|
---|
67 | pop r13
|
---|
68 | pop r12
|
---|
69 | pop r11
|
---|
70 | pop r10
|
---|
71 | pop r9
|
---|
72 | pop r8
|
---|
73 | pop rbp
|
---|
74 | pop rdi
|
---|
75 | pop rsi
|
---|
76 | pop rdx
|
---|
77 | pop rcx
|
---|
78 | pop rbx
|
---|
79 | pop rax
|
---|
80 | %endmacro
|
---|
81 |
|
---|
82 | ;;
|
---|
83 | ; Entry logging
|
---|
84 | %ifdef ENTRY_LOGGING
|
---|
85 | %macro LOG_ENTRY 0
|
---|
86 | MY_PUSHAQ
|
---|
87 | push rbp
|
---|
88 | mov rbp, rsp
|
---|
89 | and rsp, ~0fh
|
---|
90 | sub rsp, 20h ; shadow space
|
---|
91 |
|
---|
92 | %ifdef RT_OS_WINDOWS
|
---|
93 | mov rcx, REM_FIXUP_64_DESC
|
---|
94 | %else
|
---|
95 | mov rdi, REM_FIXUP_64_DESC
|
---|
96 | %endif
|
---|
97 | mov rax, REM_FIXUP_64_LOG_ENTRY
|
---|
98 | call rax
|
---|
99 |
|
---|
100 | leave
|
---|
101 | MY_POPAQ
|
---|
102 | %endmacro
|
---|
103 | %else
|
---|
104 | %define LOG_ENTRY
|
---|
105 | %endif
|
---|
106 |
|
---|
107 | ;;
|
---|
108 | ; Exit logging
|
---|
109 | %ifdef EXIT_LOGGING
|
---|
110 | %macro LOG_EXIT 0
|
---|
111 | MY_PUSHAQ
|
---|
112 | push rbp
|
---|
113 | mov rbp, rsp
|
---|
114 | and rsp, ~0fh
|
---|
115 | sub rsp, 20h ; shadow space
|
---|
116 |
|
---|
117 | %ifdef RT_OS_WINDOWS
|
---|
118 | mov rdx, rax
|
---|
119 | mov rcx, REM_FIXUP_64_DESC
|
---|
120 | %else
|
---|
121 | mov rsi, eax
|
---|
122 | mov rdi, REM_FIXUP_64_DESC
|
---|
123 | %endif
|
---|
124 | mov rax, REM_FIXUP_64_LOG_EXIT
|
---|
125 | call rax
|
---|
126 |
|
---|
127 | leave
|
---|
128 | MY_POPAQ
|
---|
129 | %endmacro
|
---|
130 | %else
|
---|
131 | %define LOG_EXIT
|
---|
132 | %endif
|
---|
133 |
|
---|
134 | %else
|
---|
135 | %define LOG_ENTRY
|
---|
136 | %define LOG_EXIT
|
---|
137 | %endif
|
---|
138 |
|
---|
139 |
|
---|
140 | BEGINCODE
|
---|
141 |
|
---|
142 | %ifdef RT_OS_WINDOWS
|
---|
143 | %ifdef RT_ARCH_AMD64
|
---|
144 |
|
---|
145 |
|
---|
146 | BEGINPROC WrapGCC2MSC0Int
|
---|
147 | LOG_ENTRY
|
---|
148 | push rbp
|
---|
149 | mov rbp, rsp
|
---|
150 | sub rsp, 20h
|
---|
151 |
|
---|
152 | %ifdef USE_DIRECT_CALLS
|
---|
153 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
154 | %else
|
---|
155 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
156 | call rax
|
---|
157 | %endif
|
---|
158 |
|
---|
159 | leave
|
---|
160 | LOG_EXIT
|
---|
161 | ret
|
---|
162 | ENDPROC WrapGCC2MSC0Int
|
---|
163 |
|
---|
164 |
|
---|
165 | BEGINPROC WrapGCC2MSC1Int
|
---|
166 | LOG_ENTRY
|
---|
167 | push rbp
|
---|
168 | mov rbp, rsp
|
---|
169 | sub rsp, 20h
|
---|
170 |
|
---|
171 | mov rcx, rdi
|
---|
172 | %ifdef USE_DIRECT_CALLS
|
---|
173 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
174 | %else
|
---|
175 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
176 | call rax
|
---|
177 | %endif
|
---|
178 |
|
---|
179 | leave
|
---|
180 | LOG_EXIT
|
---|
181 | ret
|
---|
182 | ENDPROC WrapGCC2MSC1Int
|
---|
183 |
|
---|
184 |
|
---|
185 | BEGINPROC WrapGCC2MSC2Int
|
---|
186 | LOG_ENTRY
|
---|
187 | push rbp
|
---|
188 | mov rbp, rsp
|
---|
189 | sub rsp, 20h
|
---|
190 |
|
---|
191 | mov rdx, rsi
|
---|
192 | mov rcx, rdi
|
---|
193 | %ifdef USE_DIRECT_CALLS
|
---|
194 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
195 | %else
|
---|
196 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
197 | call rax
|
---|
198 | %endif
|
---|
199 |
|
---|
200 | leave
|
---|
201 | LOG_EXIT
|
---|
202 | ret
|
---|
203 | ENDPROC WrapGCC2MSC2Int
|
---|
204 |
|
---|
205 |
|
---|
206 | BEGINPROC WrapGCC2MSC3Int
|
---|
207 | LOG_ENTRY
|
---|
208 | push rbp
|
---|
209 | mov rbp, rsp
|
---|
210 | sub rsp, 20h
|
---|
211 |
|
---|
212 | mov r8, rdx
|
---|
213 | mov rdx, rsi
|
---|
214 | mov rcx, rdi
|
---|
215 | %ifdef USE_DIRECT_CALLS
|
---|
216 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
217 | %else
|
---|
218 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
219 | call rax
|
---|
220 | %endif
|
---|
221 |
|
---|
222 | leave
|
---|
223 | LOG_EXIT
|
---|
224 | ret
|
---|
225 | ENDPROC WrapGCC2MSC3Int
|
---|
226 |
|
---|
227 |
|
---|
228 | BEGINPROC WrapGCC2MSC4Int
|
---|
229 | LOG_ENTRY
|
---|
230 | push rbp
|
---|
231 | mov rbp, rsp
|
---|
232 | sub rsp, 20h
|
---|
233 |
|
---|
234 | mov r9, rcx
|
---|
235 | mov r8, rdx
|
---|
236 | mov rdx, rsi
|
---|
237 | mov rcx, rdi
|
---|
238 | %ifdef USE_DIRECT_CALLS
|
---|
239 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
240 | %else
|
---|
241 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
242 | call rax
|
---|
243 | %endif
|
---|
244 |
|
---|
245 | leave
|
---|
246 | LOG_EXIT
|
---|
247 | ret
|
---|
248 | ENDPROC WrapGCC2MSC4Int
|
---|
249 |
|
---|
250 |
|
---|
251 | BEGINPROC WrapGCC2MSC5Int
|
---|
252 | LOG_ENTRY
|
---|
253 | push rbp
|
---|
254 | mov rbp, rsp
|
---|
255 | sub rsp, 30h
|
---|
256 |
|
---|
257 | mov [rsp + 20h], r8
|
---|
258 | mov r9, rcx
|
---|
259 | mov r8, rdx
|
---|
260 | mov rdx, rsi
|
---|
261 | mov rcx, rdi
|
---|
262 | %ifdef USE_DIRECT_CALLS
|
---|
263 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
264 | %else
|
---|
265 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
266 | call rax
|
---|
267 | %endif
|
---|
268 |
|
---|
269 | leave
|
---|
270 | LOG_EXIT
|
---|
271 | ret
|
---|
272 | ENDPROC WrapGCC2MSC5Int
|
---|
273 |
|
---|
274 |
|
---|
275 | BEGINPROC WrapGCC2MSC6Int
|
---|
276 | LOG_ENTRY
|
---|
277 | push rbp
|
---|
278 | mov rbp, rsp
|
---|
279 | sub rsp, 30h
|
---|
280 |
|
---|
281 | mov [rsp + 28h], r9
|
---|
282 | mov [rsp + 20h], r8
|
---|
283 | mov r9, rcx
|
---|
284 | mov r8, rdx
|
---|
285 | mov rdx, rsi
|
---|
286 | mov rcx, rdi
|
---|
287 | %ifdef USE_DIRECT_CALLS
|
---|
288 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
289 | %else
|
---|
290 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
291 | call rax
|
---|
292 | %endif
|
---|
293 |
|
---|
294 | leave
|
---|
295 | LOG_EXIT
|
---|
296 | ret
|
---|
297 | ENDPROC WrapGCC2MSC6Int
|
---|
298 |
|
---|
299 |
|
---|
300 | BEGINPROC WrapGCC2MSC7Int
|
---|
301 | LOG_ENTRY
|
---|
302 | push rbp
|
---|
303 | mov rbp, rsp
|
---|
304 | sub rsp, 40h
|
---|
305 |
|
---|
306 | mov r11, [rbp + 10h]
|
---|
307 | mov [rsp + 30h], r11
|
---|
308 | mov [rsp + 28h], r9
|
---|
309 | mov [rsp + 20h], r8
|
---|
310 | mov r9, rcx
|
---|
311 | mov r8, rdx
|
---|
312 | mov rdx, rsi
|
---|
313 | mov rcx, rdi
|
---|
314 | %ifdef USE_DIRECT_CALLS
|
---|
315 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
316 | %else
|
---|
317 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
318 | call rax
|
---|
319 | %endif
|
---|
320 |
|
---|
321 | leave
|
---|
322 | LOG_EXIT
|
---|
323 | ret
|
---|
324 | ENDPROC WrapGCC2MSC7Int
|
---|
325 |
|
---|
326 |
|
---|
327 | BEGINPROC WrapGCC2MSC8Int
|
---|
328 | LOG_ENTRY
|
---|
329 | push rbp
|
---|
330 | mov rbp, rsp
|
---|
331 | sub rsp, 40h
|
---|
332 |
|
---|
333 | mov r10, [rbp + 18h]
|
---|
334 | mov [rsp + 38h], r10
|
---|
335 | mov r11, [rbp + 10h]
|
---|
336 | mov [rsp + 30h], r11
|
---|
337 | mov [rsp + 28h], r9
|
---|
338 | mov [rsp + 20h], r8
|
---|
339 | mov r9, rcx
|
---|
340 | mov r8, rdx
|
---|
341 | mov rdx, rsi
|
---|
342 | mov rcx, rdi
|
---|
343 | %ifdef USE_DIRECT_CALLS
|
---|
344 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
345 | %else
|
---|
346 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
347 | call rax
|
---|
348 | %endif
|
---|
349 |
|
---|
350 | leave
|
---|
351 | LOG_EXIT
|
---|
352 | ret
|
---|
353 | ENDPROC WrapGCC2MSC8Int
|
---|
354 |
|
---|
355 |
|
---|
356 | BEGINPROC WrapGCC2MSC9Int
|
---|
357 | LOG_ENTRY
|
---|
358 | push rbp
|
---|
359 | mov rbp, rsp
|
---|
360 | sub rsp, 50h
|
---|
361 |
|
---|
362 | mov rax, [rbp + 20h]
|
---|
363 | mov [rsp + 40h], rax
|
---|
364 | mov r10, [rbp + 18h]
|
---|
365 | mov [rsp + 38h], r10
|
---|
366 | mov r11, [rbp + 10h]
|
---|
367 | mov [rsp + 30h], r11
|
---|
368 | mov [rsp + 28h], r9
|
---|
369 | mov [rsp + 20h], r8
|
---|
370 | mov r9, rcx
|
---|
371 | mov r8, rdx
|
---|
372 | mov rdx, rsi
|
---|
373 | mov rcx, rdi
|
---|
374 | %ifdef USE_DIRECT_CALLS
|
---|
375 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
376 | %else
|
---|
377 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
378 | call rax
|
---|
379 | %endif
|
---|
380 |
|
---|
381 | leave
|
---|
382 | LOG_EXIT
|
---|
383 | ret
|
---|
384 | ENDPROC WrapGCC2MSC9Int
|
---|
385 |
|
---|
386 |
|
---|
387 | BEGINPROC WrapGCC2MSC10Int
|
---|
388 | LOG_ENTRY
|
---|
389 | push rbp
|
---|
390 | mov rbp, rsp
|
---|
391 | sub rsp, 50h
|
---|
392 |
|
---|
393 | mov r11, [rbp + 28h]
|
---|
394 | mov [rsp + 48h], r11
|
---|
395 | mov rax, [rbp + 20h]
|
---|
396 | mov [rsp + 40h], rax
|
---|
397 | mov r10, [rbp + 18h]
|
---|
398 | mov [rsp + 38h], r10
|
---|
399 | mov r11, [rbp + 10h]
|
---|
400 | mov [rsp + 30h], r11
|
---|
401 | mov [rsp + 28h], r9
|
---|
402 | mov [rsp + 20h], r8
|
---|
403 | mov r9, rcx
|
---|
404 | mov r8, rdx
|
---|
405 | mov rdx, rsi
|
---|
406 | mov rcx, rdi
|
---|
407 | %ifdef USE_DIRECT_CALLS
|
---|
408 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
409 | %else
|
---|
410 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
411 | call rax
|
---|
412 | %endif
|
---|
413 |
|
---|
414 | leave
|
---|
415 | LOG_EXIT
|
---|
416 | ret
|
---|
417 | ENDPROC WrapGCC2MSC10Int
|
---|
418 |
|
---|
419 |
|
---|
420 | BEGINPROC WrapGCC2MSC11Int
|
---|
421 | LOG_ENTRY
|
---|
422 | push rbp
|
---|
423 | mov rbp, rsp
|
---|
424 | sub rsp, 60h
|
---|
425 |
|
---|
426 | mov r10, [rbp + 30h]
|
---|
427 | mov [rsp + 50h], r10
|
---|
428 | mov r11, [rbp + 28h]
|
---|
429 | mov [rsp + 48h], r11
|
---|
430 | mov rax, [rbp + 20h]
|
---|
431 | mov [rsp + 40h], rax
|
---|
432 | mov r10, [rbp + 18h]
|
---|
433 | mov [rsp + 38h], r10
|
---|
434 | mov r11, [rbp + 10h]
|
---|
435 | mov [rsp + 30h], r11
|
---|
436 | mov [rsp + 28h], r9
|
---|
437 | mov [rsp + 20h], r8
|
---|
438 | mov r9, rcx
|
---|
439 | mov r8, rdx
|
---|
440 | mov rdx, rsi
|
---|
441 | mov rcx, rdi
|
---|
442 | %ifdef USE_DIRECT_CALLS
|
---|
443 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
444 | %else
|
---|
445 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
446 | call rax
|
---|
447 | %endif
|
---|
448 |
|
---|
449 | leave
|
---|
450 | LOG_EXIT
|
---|
451 | ret
|
---|
452 | ENDPROC WrapGCC2MSC11Int
|
---|
453 |
|
---|
454 |
|
---|
455 | BEGINPROC WrapGCC2MSC12Int
|
---|
456 | LOG_ENTRY
|
---|
457 | push rbp
|
---|
458 | mov rbp, rsp
|
---|
459 | sub rsp, 60h
|
---|
460 |
|
---|
461 | mov rax, [rbp + 28h]
|
---|
462 | mov [rsp + 48h], rax
|
---|
463 | mov r10, [rbp + 30h]
|
---|
464 | mov [rsp + 50h], r10
|
---|
465 | mov r11, [rbp + 28h]
|
---|
466 | mov [rsp + 48h], r11
|
---|
467 | mov rax, [rbp + 20h]
|
---|
468 | mov [rsp + 40h], rax
|
---|
469 | mov r10, [rbp + 18h]
|
---|
470 | mov [rsp + 38h], r10
|
---|
471 | mov r11, [rbp + 10h]
|
---|
472 | mov [rsp + 30h], r11
|
---|
473 | mov [rsp + 28h], r9
|
---|
474 | mov [rsp + 20h], r8
|
---|
475 | mov r9, rcx
|
---|
476 | mov r8, rdx
|
---|
477 | mov rdx, rsi
|
---|
478 | mov rcx, rdi
|
---|
479 | %ifdef USE_DIRECT_CALLS
|
---|
480 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
481 | %else
|
---|
482 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
483 | call rax
|
---|
484 | %endif
|
---|
485 |
|
---|
486 | leave
|
---|
487 | LOG_EXIT
|
---|
488 | ret
|
---|
489 | ENDPROC WrapGCC2MSC12Int
|
---|
490 |
|
---|
491 |
|
---|
492 |
|
---|
493 | BEGINPROC WrapGCC2MSCVariadictInt
|
---|
494 | LOG_ENTRY
|
---|
495 | %ifdef DEBUG
|
---|
496 | ; check that there are NO floting point arguments in XMM registers!
|
---|
497 | or rax, rax
|
---|
498 | jz .ok
|
---|
499 | int3
|
---|
500 | .ok:
|
---|
501 | %endif
|
---|
502 | sub rsp, 28h
|
---|
503 | mov r11, [rsp + 28h] ; r11 = return address.
|
---|
504 | mov [rsp + 28h], r9
|
---|
505 | mov [rsp + 20h], r8
|
---|
506 | mov r9, rcx
|
---|
507 | mov [rsp + 18h], r9 ; (*)
|
---|
508 | mov r8, rdx
|
---|
509 | mov [rsp + 14h], r8 ; (*)
|
---|
510 | mov rdx, rsi
|
---|
511 | mov [rsp + 8h], rdx ; (*)
|
---|
512 | mov rcx, rdi
|
---|
513 | mov [rsp], rcx ; (*)
|
---|
514 | mov rsi, r11 ; rsi is preserved by the callee.
|
---|
515 | %ifdef USE_DIRECT_CALLS
|
---|
516 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
517 | %else
|
---|
518 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
519 | call rax
|
---|
520 | %endif
|
---|
521 |
|
---|
522 | add rsp, 30h
|
---|
523 | LOG_EXIT
|
---|
524 | jmp rsi
|
---|
525 | ; (*) unconditionally spill the registers, just in case '...' implies weird stuff on MSC. Check this out!
|
---|
526 | ENDPROC WrapGCC2MSCVariadictInt
|
---|
527 |
|
---|
528 |
|
---|
529 | ;;
|
---|
530 | ; Custom template for SSMR3RegisterInternal.
|
---|
531 | ;
|
---|
532 | ; (This is based on the WrapGCC2MSC11Int template.)
|
---|
533 | ;
|
---|
534 | ; @cproto
|
---|
535 | ;
|
---|
536 | ; SSMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
|
---|
537 | ; PFNSSMINTLIVEPREP pfnLivePrep, PFNSSMINTLIVEEXEC pfnLiveExec, PFNSSMINTLIVEVOTE pfnLiveVote,
|
---|
538 | ; PFNSSMINTSAVEPREP pfnSavePrep, PFNSSMINTSAVEEXEC pfnSaveExec, PFNSSMINTSAVEDONE pfnSaveDone,
|
---|
539 | ; PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone);
|
---|
540 | ;
|
---|
541 | ; @param pVM rdi 0
|
---|
542 | ; @param pszName rsi 1
|
---|
543 | ; @param u32Instance rdx 2
|
---|
544 | ; @param u32Version rcx 3
|
---|
545 | ; @param cbGuess r8 4
|
---|
546 | ; @param pfnLivePrep r9 5
|
---|
547 | ; @param pfnLiveExec rbp + 10h 6
|
---|
548 | ; @param pfnLiveVote rbp + 18h 7
|
---|
549 | ; @param pfnSavePrep rbp + 20h 8
|
---|
550 | ; @param pfnSaveExec rbp + 28h 9
|
---|
551 | ; @param pfnSaveDone rbp + 30h 10
|
---|
552 | ; @param pfnLoadPrep rbp + 38h 11
|
---|
553 | ; @param pfnLoadExec rbp + 40h 12
|
---|
554 | ; @param pfnLoadDone rbp + 48h 13
|
---|
555 | ;
|
---|
556 | BEGINPROC WrapGCC2MSC_SSMR3RegisterInternal
|
---|
557 | LOG_ENTRY
|
---|
558 | push rbp
|
---|
559 | mov rbp, rsp
|
---|
560 |
|
---|
561 | sub rsp, 80h
|
---|
562 |
|
---|
563 | mov r10, [rbp + 48h]
|
---|
564 | mov [rsp + 68h], r10 ; pfnLiveDone
|
---|
565 | mov r11, [rbp + 40h]
|
---|
566 | mov [rsp + 60h], r11 ; pfnLiveExec
|
---|
567 | mov rax, [rbp + 38h]
|
---|
568 | mov [rsp + 58h], rax ; pfnLivePrep
|
---|
569 | mov r10, [rbp + 30h]
|
---|
570 | mov [rsp + 50h], r10 ; pfnLoadDone
|
---|
571 | mov r11, [rbp + 28h]
|
---|
572 | mov [rsp + 48h], r11 ; pfnLoadExec
|
---|
573 | mov rax, [rbp + 20h]
|
---|
574 | mov [rsp + 40h], rax ; pfnLoadPrep
|
---|
575 | mov r10, [rbp + 18h]
|
---|
576 | mov [rsp + 38h], r10 ; pfnSaveDone
|
---|
577 | mov r11, [rbp + 10h]
|
---|
578 | mov [rsp + 30h], r11 ; pfnSaveExec
|
---|
579 | mov [rsp + 28h], r9 ; pfnSavePrep
|
---|
580 | mov [rsp + 20h], r8
|
---|
581 | mov [rsp + 18h], rcx ; -> r9
|
---|
582 | mov [rsp + 10h], rdx ; -> r8
|
---|
583 | mov [rsp + 08h], rsi ; -> rdx
|
---|
584 | mov [rsp], rdi ; -> rcx
|
---|
585 |
|
---|
586 | ; Now convert the function pointers. Have to setup a new shadow
|
---|
587 | ; space here since the SSMR3RegisterInternal one is already in use.
|
---|
588 | sub rsp, 20h
|
---|
589 |
|
---|
590 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
591 | lea rdx, [rsp + 28h + 20h] ; pValue
|
---|
592 | mov r8d, 5 ; iParam
|
---|
593 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
594 | call rax
|
---|
595 |
|
---|
596 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
597 | lea rdx, [rsp + 30h + 20h] ; pValue
|
---|
598 | mov r8d, 6 ; iParam
|
---|
599 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
600 | call rax
|
---|
601 |
|
---|
602 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
603 | lea rdx, [rsp + 38h + 20h] ; pValue
|
---|
604 | mov r8d, 7 ; iParam
|
---|
605 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
606 | call rax
|
---|
607 |
|
---|
608 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
609 | lea rdx, [rsp + 40h + 20h] ; pValue
|
---|
610 | mov r8d, 8 ; iParam
|
---|
611 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
612 | call rax
|
---|
613 |
|
---|
614 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
615 | lea rdx, [rsp + 48h + 20h] ; pValue
|
---|
616 | mov r8d, 9 ; iParam
|
---|
617 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
618 | call rax
|
---|
619 |
|
---|
620 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
621 | lea rdx, [rsp + 50h + 20h] ; pValue
|
---|
622 | mov r8d, 10 ; iParam
|
---|
623 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
624 | call rax
|
---|
625 |
|
---|
626 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
627 | lea rdx, [rsp + 58h + 20h] ; pValue
|
---|
628 | mov r8d, 11 ; iParam
|
---|
629 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
630 | call rax
|
---|
631 |
|
---|
632 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
633 | lea rdx, [rsp + 60h + 20h] ; pValue
|
---|
634 | mov r8d, 12 ; iParam
|
---|
635 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
636 | call rax
|
---|
637 |
|
---|
638 | mov rcx, REM_FIXUP_64_DESC ; pDesc
|
---|
639 | lea rdx, [rsp + 68h + 20h] ; pValue
|
---|
640 | mov r8d, 13 ; iParam
|
---|
641 | mov rax, REM_FIXUP_64_WRAP_GCC_CB
|
---|
642 | call rax
|
---|
643 |
|
---|
644 | add rsp, 20h
|
---|
645 |
|
---|
646 | ; finally do the call.
|
---|
647 | mov r9, [rsp + 18h]
|
---|
648 | mov r8, [rsp + 10h]
|
---|
649 | mov rdx, [rsp + 08h]
|
---|
650 | mov rcx, [rsp]
|
---|
651 | %ifdef USE_DIRECT_CALLS
|
---|
652 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
653 | %else
|
---|
654 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
655 | call rax
|
---|
656 | %endif
|
---|
657 |
|
---|
658 | leave
|
---|
659 | LOG_EXIT
|
---|
660 | ret
|
---|
661 | ENDPROC WrapGCC2MSC_SSMR3RegisterInternal
|
---|
662 |
|
---|
663 |
|
---|
664 | ;
|
---|
665 | ; The other way around:
|
---|
666 | ;
|
---|
667 |
|
---|
668 |
|
---|
669 | BEGINPROC WrapMSC2GCC0Int
|
---|
670 | LOG_ENTRY
|
---|
671 | push rbp
|
---|
672 | mov rbp, rsp
|
---|
673 | sub rsp, 10h
|
---|
674 | mov [rbp - 10h], rsi
|
---|
675 | mov [rbp - 18h], rdi
|
---|
676 |
|
---|
677 | %ifdef USE_DIRECT_CALLS
|
---|
678 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
679 | %else
|
---|
680 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
681 | call rax
|
---|
682 | %endif
|
---|
683 |
|
---|
684 | mov rdi, [rbp - 18h]
|
---|
685 | mov rsi, [rbp - 10h]
|
---|
686 | leave
|
---|
687 | LOG_EXIT
|
---|
688 | ret
|
---|
689 | ENDPROC WrapMSC2GCC0Int
|
---|
690 |
|
---|
691 |
|
---|
692 | BEGINPROC WrapMSC2GCC1Int
|
---|
693 | LOG_ENTRY
|
---|
694 | push rbp
|
---|
695 | mov rbp, rsp
|
---|
696 | sub rsp, 20h
|
---|
697 | mov [rbp - 10h], rsi
|
---|
698 | mov [rbp - 18h], rdi
|
---|
699 |
|
---|
700 | mov rdi, rcx
|
---|
701 | %ifdef USE_DIRECT_CALLS
|
---|
702 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
703 | %else
|
---|
704 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
705 | call rax
|
---|
706 | %endif
|
---|
707 |
|
---|
708 | mov rdi, [rbp - 18h]
|
---|
709 | mov rsi, [rbp - 10h]
|
---|
710 | leave
|
---|
711 | LOG_EXIT
|
---|
712 | ret
|
---|
713 | ENDPROC WrapMSC2GCC1Int
|
---|
714 |
|
---|
715 |
|
---|
716 | BEGINPROC WrapMSC2GCC2Int
|
---|
717 | LOG_ENTRY
|
---|
718 | push rbp
|
---|
719 | mov rbp, rsp
|
---|
720 | sub rsp, 20h
|
---|
721 | mov [rbp - 10h], rsi
|
---|
722 | mov [rbp - 18h], rdi
|
---|
723 |
|
---|
724 | mov rdi, rcx
|
---|
725 | mov rsi, rdx
|
---|
726 | %ifdef USE_DIRECT_CALLS
|
---|
727 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
728 | %else
|
---|
729 | mov rax, REM_FIXUP_64_REAL_STUFF
|
---|
730 | call rax
|
---|
731 | %endif
|
---|
732 |
|
---|
733 | mov rdi, [rbp - 18h]
|
---|
734 | mov rsi, [rbp - 10h]
|
---|
735 | leave
|
---|
736 | LOG_EXIT
|
---|
737 | ret
|
---|
738 | ENDPROC WrapMSC2GCC2Int
|
---|
739 |
|
---|
740 |
|
---|
741 | BEGINPROC WrapMSC2GCC3Int
|
---|
742 | LOG_ENTRY
|
---|
743 | push rbp
|
---|
744 | mov rbp, rsp
|
---|
745 | sub rsp, 20h
|
---|
746 | mov [rbp - 10h], rsi
|
---|
747 | mov [rbp - 18h], rdi
|
---|
748 |
|
---|
749 | mov rdi, rcx
|
---|
750 | mov rsi, rdx
|
---|
751 | mov rdx, r8
|
---|
752 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
753 |
|
---|
754 | mov rdi, [rbp - 18h]
|
---|
755 | mov rsi, [rbp - 10h]
|
---|
756 | leave
|
---|
757 | LOG_EXIT
|
---|
758 | ret
|
---|
759 | ENDPROC WrapMSC2GCC3Int
|
---|
760 |
|
---|
761 |
|
---|
762 | BEGINPROC WrapMSC2GCC4Int
|
---|
763 | LOG_ENTRY
|
---|
764 | push rbp
|
---|
765 | mov rbp, rsp
|
---|
766 | sub rsp, 20h
|
---|
767 | mov [rbp - 10h], rsi
|
---|
768 | mov [rbp - 18h], rdi
|
---|
769 |
|
---|
770 | mov rdi, rcx
|
---|
771 | mov rsi, rdx
|
---|
772 | mov rdx, r8
|
---|
773 | mov rcx, r9
|
---|
774 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
775 |
|
---|
776 | mov rdi, [rbp - 18h]
|
---|
777 | mov rsi, [rbp - 10h]
|
---|
778 | leave
|
---|
779 | LOG_EXIT
|
---|
780 | ret
|
---|
781 | ENDPROC WrapMSC2GCC4Int
|
---|
782 |
|
---|
783 |
|
---|
784 | BEGINPROC WrapMSC2GCC5Int
|
---|
785 | LOG_ENTRY
|
---|
786 | push rbp
|
---|
787 | mov rbp, rsp
|
---|
788 | sub rsp, 20h
|
---|
789 | mov [rbp - 10h], rsi
|
---|
790 | mov [rbp - 18h], rdi
|
---|
791 |
|
---|
792 | mov rdi, rcx
|
---|
793 | mov rsi, rdx
|
---|
794 | mov rdx, r8
|
---|
795 | mov rcx, r9
|
---|
796 | mov r8, [rbp + 30h]
|
---|
797 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
798 |
|
---|
799 | mov rdi, [rbp - 18h]
|
---|
800 | mov rsi, [rbp - 10h]
|
---|
801 | leave
|
---|
802 | LOG_EXIT
|
---|
803 | ret
|
---|
804 | ENDPROC WrapMSC2GCC5Int
|
---|
805 |
|
---|
806 |
|
---|
807 | BEGINPROC WrapMSC2GCC6Int
|
---|
808 | LOG_ENTRY
|
---|
809 | push rbp
|
---|
810 | mov rbp, rsp
|
---|
811 | sub rsp, 20h
|
---|
812 | mov [rbp - 10h], rsi
|
---|
813 | mov [rbp - 18h], rdi
|
---|
814 |
|
---|
815 | mov rdi, rcx
|
---|
816 | mov rsi, rdx
|
---|
817 | mov rdx, r8
|
---|
818 | mov rcx, r9
|
---|
819 | mov r8, [rbp + 30h]
|
---|
820 | mov r9, [rbp + 38h]
|
---|
821 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
822 |
|
---|
823 | mov rdi, [rbp - 18h]
|
---|
824 | mov rsi, [rbp - 10h]
|
---|
825 | leave
|
---|
826 | LOG_EXIT
|
---|
827 | ret
|
---|
828 | ENDPROC WrapMSC2GCC6Int
|
---|
829 |
|
---|
830 |
|
---|
831 | BEGINPROC WrapMSC2GCC7Int
|
---|
832 | LOG_ENTRY
|
---|
833 | push rbp
|
---|
834 | mov rbp, rsp
|
---|
835 | sub rsp, 30h
|
---|
836 | mov [rbp - 10h], rsi
|
---|
837 | mov [rbp - 18h], rdi
|
---|
838 |
|
---|
839 | mov rdi, rcx
|
---|
840 | mov rsi, rdx
|
---|
841 | mov rdx, r8
|
---|
842 | mov rcx, r9
|
---|
843 | mov r8, [rbp + 30h]
|
---|
844 | mov r9, [rbp + 38h]
|
---|
845 | mov r10, [rbp + 40h]
|
---|
846 | mov [rsp], r10
|
---|
847 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
848 |
|
---|
849 | mov rdi, [rbp - 18h]
|
---|
850 | mov rsi, [rbp - 10h]
|
---|
851 | leave
|
---|
852 | LOG_EXIT
|
---|
853 | ret
|
---|
854 | ENDPROC WrapMSC2GCC7Int
|
---|
855 |
|
---|
856 |
|
---|
857 | BEGINPROC WrapMSC2GCC8Int
|
---|
858 | LOG_ENTRY
|
---|
859 | push rbp
|
---|
860 | mov rbp, rsp
|
---|
861 | sub rsp, 30h
|
---|
862 | mov [rbp - 10h], rsi
|
---|
863 | mov [rbp - 18h], rdi
|
---|
864 |
|
---|
865 | mov rdi, rcx
|
---|
866 | mov rsi, rdx
|
---|
867 | mov rdx, r8
|
---|
868 | mov rcx, r9
|
---|
869 | mov r8, [rbp + 30h]
|
---|
870 | mov r9, [rbp + 38h]
|
---|
871 | mov r10, [rbp + 40h]
|
---|
872 | mov [rsp], r10
|
---|
873 | mov r11, [rbp + 48h]
|
---|
874 | mov [rsp + 8], r11
|
---|
875 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
876 |
|
---|
877 | mov rdi, [rbp - 18h]
|
---|
878 | mov rsi, [rbp - 10h]
|
---|
879 | leave
|
---|
880 | LOG_EXIT
|
---|
881 | ret
|
---|
882 | ENDPROC WrapMSC2GCC8Int
|
---|
883 |
|
---|
884 |
|
---|
885 | BEGINPROC WrapMSC2GCC9Int
|
---|
886 | LOG_ENTRY
|
---|
887 | push rbp
|
---|
888 | mov rbp, rsp
|
---|
889 | sub rsp, 40h
|
---|
890 | mov [rbp - 10h], rsi
|
---|
891 | mov [rbp - 18h], rdi
|
---|
892 |
|
---|
893 | mov rdi, rcx
|
---|
894 | mov rsi, rdx
|
---|
895 | mov rdx, r8
|
---|
896 | mov rcx, r9
|
---|
897 | mov r8, [rbp + 30h]
|
---|
898 | mov r9, [rbp + 38h]
|
---|
899 | mov r10, [rbp + 40h]
|
---|
900 | mov [rsp], r10
|
---|
901 | mov r11, [rbp + 48h]
|
---|
902 | mov [rsp + 8], r11
|
---|
903 | mov rax, [rbp + 50h]
|
---|
904 | mov [rsp + 10h], rax
|
---|
905 | call $+5+REM_FIXUP_32_REAL_STUFF
|
---|
906 |
|
---|
907 | mov rdi, [rbp - 18h]
|
---|
908 | mov rsi, [rbp - 10h]
|
---|
909 | leave
|
---|
910 | LOG_EXIT
|
---|
911 | ret
|
---|
912 | ENDPROC WrapMSC2GCC9Int
|
---|
913 |
|
---|
914 | %endif ; RT_ARCH_AMD64
|
---|
915 | %endif ; RT_OS_WINDOWS
|
---|
916 |
|
---|