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