VirtualBox

source: vbox/trunk/src/recompiler/new/VBoxREMWrapper.cpp@ 1117

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

Missing wrapper for PGM3PhysGrowRange

  • Property svn:keywords set to Id
File size: 95.3 KB
Line 
1/* $Id: VBoxREMWrapper.cpp 1117 2007-02-28 16:39:16Z vboxsync $ */
2/** @file
3 *
4 * VBoxREM Win64 DLL Wrapper.
5 *
6 * InnoTek Systemberatung GmbH confidential
7 *
8 * Copyright (c) 2006 InnoTek Systemberatung GmbH
9 *
10 * Author: knut st. osmundsen <[email protected]>
11 *
12 * All Rights Reserved
13 *
14 */
15
16
17/** @page pg_vboxrem_amd64 VBoxREM Hacks on AMD64
18 *
19 * There are problems with building BoxREM both on WIN64 and 64-bit linux.
20 *
21 * On linux binutils refuses to link shared objects without -fPIC compiled code
22 * (bitches about some fixup types). But when trying to build with -fPIC dyngen
23 * doesn't like the code anymore. Sweet. The current solution is to build the
24 * VBoxREM code as a relocatable module and use our ELF loader to load it.
25 *
26 * On WIN64 we're not aware of any GCC port which can emit code using the MSC
27 * calling convention. So, we're in for some real fun here. The choice is between
28 * porting GCC to AMD64 WIN64 and comming up with some kind of wrapper around
29 * either the win32 build or the 64-bit linux build.
30 *
31 * -# Porting GCC will be a lot of work. For one thing the calling convention differs
32 * and messing with such stuff can easily create ugly bugs. We would also have to
33 * do some binutils changes, but I think those are rather small compared to GCC.
34 * (That said, the MSC calling convention is far simpler than the linux one, it
35 * reminds me of _Optlink which we have working already.)
36 * -# Wrapping win32 code will work, but addresses outside the first 4GB are
37 * inaccessible and we will have to create 32-64 thunks for all imported functions.
38 * (To switch between 32-bit and 64-bit is load the right CS using far jmps (32->64)
39 * or far returns (both).)
40 * -# Wrapping 64-bit linux code might be the easier solution. The requirements here
41 * are:
42 * - Remove all CRT references we possibly, either by using intrinsics or using
43 * IPRT. Part of IPRT will be linked into VBoxREM2.rel, this will be yet another
44 * IPRT mode which I've dubbed 'no-crt'. The no-crt mode provide basic non-system
45 * dependent stuff.
46 * - Compile and link it into a relocatable object (include the gcc intrinsics
47 * in libgcc). Call this VBoxREM2.rel.
48 * - Write a wrapper dll, VBoxREM.dll, for which during REMR3Init() will load
49 * VBoxREM2.rel (using IPRT) and generate calling convention wrappers
50 * for all IPRT functions and VBoxVMM functions that it uses. All exports
51 * will be wrapped vice versa.
52 * - For building on windows hosts, we will use a mingw32 hosted cross compiler.
53 * and add a 'no-crt' mode to IPRT where it provides the necessary CRT headers
54 * and function implementations.
55 *
56 * The 3rd solution will be tried out first since it requires the least effort and
57 * will let us make use of the full 64-bit register set.
58 *
59 *
60 *
61 * @section sec_vboxrem_amd64_compare Comparing the GCC and MSC calling conventions
62 *
63 * GCC expects the following (cut & past from page 20 in the ABI draft 0.96):
64 *
65 * %rax temporary register; with variable arguments passes information about the
66 * number of SSE registers used; 1st return register.
67 * [Not preserved]
68 * %rbx callee-saved register; optionally used as base pointer.
69 * [Preserved]
70 * %rcx used to pass 4th integer argument to functions.
71 * [Not preserved]
72 * %rdx used to pass 3rd argument to functions; 2nd return register
73 * [Not preserved]
74 * %rsp stack pointer
75 * [Preserved]
76 * %rbp callee-saved register; optionally used as frame pointer
77 * [Preserved]
78 * %rsi used to pass 2nd argument to functions
79 * [Not preserved]
80 * %rdi used to pass 1st argument to functions
81 * [Not preserved]
82 * %r8 used to pass 5th argument to functions
83 * [Not preserved]
84 * %r9 used to pass 6th argument to functions
85 * [Not preserved]
86 * %r10 temporary register, used for passing a function’s static chain pointer
87 * [Not preserved]
88 * %r11 temporary register
89 * [Not preserved]
90 * %r12-r15 callee-saved registers
91 * [Preserved]
92 * %xmm0–%xmm1 used to pass and return floating point arguments
93 * [Not preserved]
94 * %xmm2–%xmm7 used to pass floating point arguments
95 * [Not preserved]
96 * %xmm8–%xmm15 temporary registers
97 * [Not preserved]
98 * %mmx0–%mmx7 temporary registers
99 * [Not preserved]
100 * %st0 temporary register; used to return long double arguments
101 * [Not preserved]
102 * %st1 temporary registers; used to return long double arguments
103 * [Not preserved]
104 * %st2–%st7 temporary registers
105 * [Not preserved]
106 * %fs Reserved for system use (as thread specific data register)
107 * [Not preserved]
108 *
109 * Direction flag is preserved as cleared.
110 * The stack must be aligned on a 16-byte boundrary before the 'call/jmp' instruction.
111 *
112 *
113 *
114 * MSC expects the following:
115 * rax return value, not preserved.
116 * rbx preserved.
117 * rcx 1st argument, integer, not preserved.
118 * rdx 2nd argument, integer, not preserved.
119 * rbp preserved.
120 * rsp preserved.
121 * rsi preserved.
122 * rdi preserved.
123 * r8 3rd argument, integer, not preserved.
124 * r9 4th argument, integer, not preserved.
125 * r10 scratch register, not preserved.
126 * r11 scratch register, not preserved.
127 * r12-r15 preserved.
128 * xmm0 1st argument, fp, return value, not preserved.
129 * xmm1 2st argument, fp, not preserved.
130 * xmm2 3st argument, fp, not preserved.
131 * xmm3 4st argument, fp, not preserved.
132 * xmm4-xmm5 scratch, not preserved.
133 * xmm6-xmm15 preserved.
134 *
135 * Dunno what the direction flag is...
136 * The stack must be aligned on a 16-byte boundrary before the 'call/jmp' instruction.
137 *
138 *
139 * Thus, When GCC code is calling MSC code we don't really have to preserve
140 * anything. But but MSC code is calling GCC code, we'll have to save esi and edi.
141 *
142 */
143
144
145/*******************************************************************************
146* Defined Constants And Macros *
147*******************************************************************************/
148/** @def USE_REM_STUBS
149 * Define USE_REM_STUBS to stub the entire REM stuff. This is useful during
150 * early porting (before we start running stuff).
151 */
152#if defined(__DOXYGEN__)
153# define USE_REM_STUBS
154#endif
155
156/** @def USE_REM_CALLING_CONVENTION_GLUE
157 * Define USE_REM_CALLING_CONVENTION_GLUE for platforms where it's necessary to
158 * use calling convention wrappers.
159 */
160#if (defined(__AMD64__) && defined(__WIN__)) || defined(__DOXYGEN__)
161# define USE_REM_CALLING_CONVENTION_GLUE
162#endif
163
164/** @def USE_REM_IMPORT_JUMP_GLUE
165 * Define USE_REM_IMPORT_JUMP_GLUE for platforms where we need to
166 * emit some jump glue to deal with big addresses.
167 */
168#if (defined(__AMD64__) && !defined(USE_REM_CALLING_CONVENTION_GLUE) && !defined(__DARWIN__)) || defined(__DOXYGEN__)
169# define USE_REM_IMPORT_JUMP_GLUE
170#endif
171
172
173/*******************************************************************************
174* Header Files *
175*******************************************************************************/
176#define LOG_GROUP LOG_GROUP_REM
177#include <VBox/rem.h>
178#include <VBox/vmm.h>
179#include <VBox/dbgf.h>
180#include <VBox/dbg.h>
181#include <VBox/csam.h>
182#include <VBox/mm.h>
183#include <VBox/em.h>
184#include <VBox/ssm.h>
185#include <VBox/hwaccm.h>
186#include <VBox/patm.h>
187#include <VBox/pdm.h>
188#include <VBox/pgm.h>
189#include <VBox/iom.h>
190#include <VBox/vm.h>
191#include <VBox/err.h>
192#include <VBox/log.h>
193#include <VBox/dis.h>
194
195#include <iprt/alloc.h>
196#include <iprt/assert.h>
197#include <iprt/ldr.h>
198#include <iprt/param.h>
199#include <iprt/path.h>
200#include <iprt/string.h>
201#include <iprt/stream.h>
202
203
204/*******************************************************************************
205* Structures and Typedefs *
206*******************************************************************************/
207/**
208 * Parameter descriptor.
209 */
210typedef struct REMPARMDESC
211{
212 /** Parameter flags (REMPARMDESC_FLAGS_*). */
213 uint8_t fFlags;
214 /** The parameter size if REMPARMDESC_FLAGS_SIZE is set. */
215 uint8_t cb;
216} REMPARMDESC, *PREMPARMDESC;
217/** Pointer to a constant parameter descriptor. */
218typedef const REMPARMDESC *PCREMPARMDESC;
219
220/** @name Parameter descriptor flags.
221 * @{ */
222/** The parameter type is a kind of integer which could fit in a register. This includes pointers. */
223#define REMPARMDESC_FLAGS_INT 0
224/** The parameter is a GC pointer. */
225#define REMPARMDESC_FLAGS_GCPTR 1
226/** The parameter is a GC physical address. */
227#define REMPARMDESC_FLAGS_GCPHYS 2
228/** The parameter is a HC physical address. */
229#define REMPARMDESC_FLAGS_HCPHYS 3
230/** The parameter type is a kind of floating point. */
231#define REMPARMDESC_FLAGS_FLOAT 4
232/** The parameter value is a struct. This type takes a size. */
233#define REMPARMDESC_FLAGS_STRUCT 5
234/** The parameter is an elipsis. */
235#define REMPARMDESC_FLAGS_ELLIPSIS 6
236/** The parameter is a va_list. */
237#define REMPARMDESC_FLAGS_VALIST 7
238/** The parameter type mask. */
239#define REMPARMDESC_FLAGS_TYPE_MASK 7
240/** The parameter size field is valid. */
241#define REMPARMDESC_FLAGS_SIZE BIT(7)
242/** @} */
243
244/**
245 * Function descriptor.
246 */
247typedef struct REMFNDESC
248{
249 /** The function name. */
250 const char *pszName;
251 /** Exports: Pointer to the function pointer.
252 * Imports: Pointer to the function. */
253 void *pv;
254 /** Array of parameter descriptors. */
255 PCREMPARMDESC paParams;
256 /** The number of parameter descriptors pointed to by paParams. */
257 uint8_t cParams;
258 /** Function flags (REMFNDESC_FLAGS_*). */
259 uint8_t fFlags;
260 /** The size of the return value. */
261 uint8_t cbReturn;
262 /** Pointer to the wrapper code for imports. */
263 void *pvWrapper;
264} REMFNDESC, *PREMFNDESC;
265/** Pointer to a constant function descriptor. */
266typedef const REMFNDESC *PCREMFNDESC;
267
268/** @name Function descriptor flags.
269 * @{ */
270/** The return type is void. */
271#define REMFNDESC_FLAGS_RET_VOID 0
272/** The return type is a kind of integer passed in rax/eax. This includes pointers. */
273#define REMFNDESC_FLAGS_RET_INT 1
274/** The return type is a kind of floating point. */
275#define REMFNDESC_FLAGS_RET_FLOAT 2
276/** The return value is a struct. This type take a size. */
277#define REMFNDESC_FLAGS_RET_STRUCT 3
278/** The return type mask. */
279#define REMFNDESC_FLAGS_RET_TYPE_MASK 7
280/** The argument list contains one or more va_list arguments (i.e. problems). */
281#define REMFNDESC_FLAGS_VALIST BIT(6)
282/** The function has an ellipsis (i.e. a problem). */
283#define REMFNDESC_FLAGS_ELLIPSIS BIT(7)
284/** @} */
285
286/**
287 * Chunk of read-write-executable memory.
288 */
289typedef struct REMEXECMEM
290{
291 /** The number of bytes left. */
292 struct REMEXECMEM *pNext;
293 /** The size of this chunk. */
294 uint32_t cb;
295 /** The offset of the next code block. */
296 uint32_t off;
297#if ARCH_BITS == 32
298 uint32_t padding;
299#endif
300} REMEXECMEM, *PREMEXECMEM;
301
302
303/*******************************************************************************
304* Global Variables *
305*******************************************************************************/
306#ifndef USE_REM_STUBS
307/** Loader handle of the REM object/DLL. */
308static RTLDRMOD g_ModREM2;
309/** Pointer to the memory containing the loaded REM2 object/DLL. */
310static void *g_pvREM2;
311
312/** Linux object export addresses.
313 * These are references from the assembly wrapper code.
314 * @{ */
315static DECLCALLBACKPTR(int, pfnREMR3Init)(PVM);
316static DECLCALLBACKPTR(int, pfnREMR3Term)(PVM);
317static DECLCALLBACKPTR(void, pfnREMR3Reset)(PVM);
318static DECLCALLBACKPTR(int, pfnREMR3Step)(PVM);
319static DECLCALLBACKPTR(int, pfnREMR3BreakpointSet)(PVM, RTGCUINTPTR);
320static DECLCALLBACKPTR(int, pfnREMR3BreakpointClear)(PVM, RTGCUINTPTR);
321static DECLCALLBACKPTR(int, pfnREMR3EmulateInstruction)(PVM);
322static DECLCALLBACKPTR(int, pfnREMR3Run)(PVM);
323static DECLCALLBACKPTR(int, pfnREMR3State)(PVM);
324static DECLCALLBACKPTR(int, pfnREMR3StateBack)(PVM);
325static DECLCALLBACKPTR(void, pfnREMR3StateUpdate)(PVM);
326static DECLCALLBACKPTR(void, pfnREMR3A20Set)(PVM, bool);
327static DECLCALLBACKPTR(void, pfnREMR3ReplayInvalidatedPages)(PVM);
328static DECLCALLBACKPTR(void, pfnREMR3ReplayHandlerNotifications)(PVM pVM);
329static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamRegister)(PVM, RTGCPHYS, RTUINT, void *, unsigned);
330static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamChunkRegister)(PVM, RTGCPHYS, RTUINT, RTHCUINTPTR, unsigned);
331static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysReserve)(PVM, RTGCPHYS, RTUINT);
332static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRomRegister)(PVM, RTGCPHYS, RTUINT, void *);
333static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalModify)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, RTGCPHYS, bool, void *);
334static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalRegister)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, bool);
335static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalDeregister)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, bool, void *);
336static DECLCALLBACKPTR(void, pfnREMR3NotifyInterruptSet)(PVM);
337static DECLCALLBACKPTR(void, pfnREMR3NotifyInterruptClear)(PVM);
338static DECLCALLBACKPTR(void, pfnREMR3NotifyTimerPending)(PVM);
339static DECLCALLBACKPTR(void, pfnREMR3NotifyDmaPending)(PVM);
340static DECLCALLBACKPTR(void, pfnREMR3NotifyQueuePending)(PVM);
341static DECLCALLBACKPTR(void, pfnREMR3NotifyFF)(PVM);
342static DECLCALLBACKPTR(int, pfnREMR3NotifyCodePageChanged)(PVM, RTGCPTR);
343static DECLCALLBACKPTR(void, pfnREMR3NotifyPendingInterrupt)(PVM, uint8_t);
344static DECLCALLBACKPTR(uint32_t, pfnREMR3QueryPendingInterrupt)(PVM);
345static DECLCALLBACKPTR(int, pfnREMR3DisasEnableStepping)(PVM, bool);
346static DECLCALLBACKPTR(bool, pfnREMR3IsPageAccessHandled)(PVM, RTGCPHYS);
347/** @} */
348
349/** Export and import parameter descriptors.
350 * @{
351 */
352/* Common args. */
353static const REMPARMDESC g_aArgsSIZE_T[] =
354{
355 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
356};
357static const REMPARMDESC g_aArgsPTR[] =
358{
359 { REMPARMDESC_FLAGS_INT, sizeof(void *) }
360};
361static const REMPARMDESC g_aArgsVM[] =
362{
363 { REMPARMDESC_FLAGS_INT, sizeof(PVM) }
364};
365
366/* REM args */
367static const REMPARMDESC g_aArgsBreakpoint[] =
368{
369 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
370 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINTPTR) }
371};
372static const REMPARMDESC g_aArgsA20Set[] =
373{
374 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
375 { REMPARMDESC_FLAGS_INT, sizeof(bool) }
376};
377static const REMPARMDESC g_aArgsNotifyPhysRamRegister[] =
378{
379 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
380 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
381 { REMPARMDESC_FLAGS_INT, sizeof(RTUINT) },
382 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
383 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) }
384};
385static const REMPARMDESC g_aArgsNotifyPhysRamChunkRegister[] =
386{
387 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
388 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
389 { REMPARMDESC_FLAGS_INT, sizeof(RTUINT) },
390 { REMPARMDESC_FLAGS_INT, sizeof(RTHCUINTPTR) },
391 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) }
392};
393static const REMPARMDESC g_aArgsNotifyPhysReserve[] =
394{
395 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
396 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
397 { REMPARMDESC_FLAGS_INT, sizeof(RTUINT) }
398};
399static const REMPARMDESC g_aArgsNotifyPhysRomRegister[] =
400{
401 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
402 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
403 { REMPARMDESC_FLAGS_INT, sizeof(RTUINT) },
404 { REMPARMDESC_FLAGS_INT, sizeof(void *) }
405};
406static const REMPARMDESC g_aArgsNotifyHandlerPhysicalModify[] =
407{
408 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
409 { REMPARMDESC_FLAGS_INT, sizeof(PGMPHYSHANDLERTYPE) },
410 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
411 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
412 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
413 { REMPARMDESC_FLAGS_INT, sizeof(bool) },
414 { REMPARMDESC_FLAGS_INT, sizeof(void *) }
415};
416static const REMPARMDESC g_aArgsNotifyHandlerPhysicalRegister[] =
417{
418 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
419 { REMPARMDESC_FLAGS_INT, sizeof(PGMPHYSHANDLERTYPE) },
420 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
421 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
422 { REMPARMDESC_FLAGS_INT, sizeof(bool) }
423};
424static const REMPARMDESC g_aArgsNotifyHandlerPhysicalDeregister[] =
425{
426 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
427 { REMPARMDESC_FLAGS_INT, sizeof(PGMPHYSHANDLERTYPE) },
428 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
429 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
430 { REMPARMDESC_FLAGS_INT, sizeof(bool) },
431 { REMPARMDESC_FLAGS_INT, sizeof(void *) }
432};
433static const REMPARMDESC g_aArgsNotifyCodePageChanged[] =
434{
435 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
436 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINTPTR) }
437};
438static const REMPARMDESC g_aArgsNotifyPendingInterrupt[] =
439{
440 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
441 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t) }
442};
443static const REMPARMDESC g_aArgsDisasEnableStepping[] =
444{
445 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
446 { REMPARMDESC_FLAGS_INT, sizeof(bool) }
447};
448static const REMPARMDESC g_aArgsIsPageAccessHandled[] =
449{
450 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
451 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) }
452};
453
454
455/* VMM args */
456static const REMPARMDESC g_aArgsCPUMGetGuestCpuId[] =
457{
458 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
459 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
460 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) },
461 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) },
462 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) },
463 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) }
464};
465static const REMPARMDESC g_aArgsCPUMQueryGuestCtxPtr[] =
466{
467 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
468 { REMPARMDESC_FLAGS_INT, sizeof(PCPUMCTX *) }
469};
470static const REMPARMDESC g_aArgsCSAMR3MonitorPage[] =
471{
472 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
473 { REMPARMDESC_FLAGS_INT, sizeof(RTGCPTR) },
474 { REMPARMDESC_FLAGS_INT, sizeof(CSAMTAG) }
475};
476static const REMPARMDESC g_aArgsDBGCRegisterCommands[] =
477{
478 { REMPARMDESC_FLAGS_INT, sizeof(PCDBGCCMD) },
479 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) }
480};
481static const REMPARMDESC g_aArgsDBGFR3DisasInstrEx[] =
482{
483 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
484 { REMPARMDESC_FLAGS_INT, sizeof(RTSEL) },
485 { REMPARMDESC_FLAGS_INT, sizeof(RTGCPTR) },
486 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
487 { REMPARMDESC_FLAGS_INT, sizeof(char *) },
488 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
489 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) }
490};
491static const REMPARMDESC g_aArgsDBGFR3Info[] =
492{
493 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
494 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
495 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
496 { REMPARMDESC_FLAGS_INT, sizeof(PCDBGFINFOHLP) }
497};
498static const REMPARMDESC g_aArgsDBGFR3SymbolByAddr[] =
499{
500 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
501 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINTPTR) },
502 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCINTPTR) },
503 { REMPARMDESC_FLAGS_INT, sizeof(PDBGFSYMBOL) }
504};
505static const REMPARMDESC g_aArgsDISInstr[] =
506{
507 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
508 { REMPARMDESC_FLAGS_INT, sizeof(RTUINTPTR) },
509 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
510 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) },
511 { REMPARMDESC_FLAGS_INT, sizeof(char *) }
512};
513static const REMPARMDESC g_aArgsEMR3FatalError[] =
514{
515 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
516 { REMPARMDESC_FLAGS_INT, sizeof(int) }
517};
518static const REMPARMDESC g_aArgsHWACCMR3CanExecuteGuest[] =
519{
520 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
521 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
522 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
523 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) }
524};
525static const REMPARMDESC g_aArgsIOMIOPortRead[] =
526{
527 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
528 { REMPARMDESC_FLAGS_INT, sizeof(RTIOPORT) },
529 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) },
530 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) }
531};
532static const REMPARMDESC g_aArgsIOMIOPortWrite[] =
533{
534 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
535 { REMPARMDESC_FLAGS_INT, sizeof(RTIOPORT) },
536 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
537 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) }
538};
539static const REMPARMDESC g_aArgsIOMMMIORead[] =
540{
541 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
542 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
543 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) },
544 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) }
545};
546static const REMPARMDESC g_aArgsIOMMMIOWrite[] =
547{
548 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
549 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
550 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
551 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) }
552};
553static const REMPARMDESC g_aArgsMMR3HeapAlloc[] =
554{
555 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
556 { REMPARMDESC_FLAGS_INT, sizeof(MMTAG) },
557 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) }
558};
559static const REMPARMDESC g_aArgsPATMIsPatchGCAddr[] =
560{
561 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
562 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR) }
563};
564static const REMPARMDESC g_aArgsPATMR3QueryOpcode[] =
565{
566 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
567 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR) },
568 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *) }
569};
570static const REMPARMDESC g_aArgsPATMR3QueryPatchMem[] =
571{
572 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
573 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) }
574};
575static const REMPARMDESC g_aArgsPDMApicGetBase[] =
576{
577 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
578 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t *) }
579};
580static const REMPARMDESC g_aArgsPDMApicGetTPR[] =
581{
582 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
583 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *) }
584};
585static const REMPARMDESC g_aArgsPDMApicSetBase[] =
586{
587 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
588 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t) }
589};
590static const REMPARMDESC g_aArgsPDMApicSetTPR[] =
591{
592 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
593 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t) }
594};
595static const REMPARMDESC g_aArgsPDMGetInterrupt[] =
596{
597 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
598 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *) }
599};
600static const REMPARMDESC g_aArgsPDMIsaSetIrq[] =
601{
602 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
603 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t) },
604 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t) }
605};
606static const REMPARMDESC g_aArgsPGMGstGetPage[] =
607{
608 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
609 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR) },
610 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t *) },
611 { REMPARMDESC_FLAGS_INT, sizeof(PRTGCPHYS) }
612};
613static const REMPARMDESC g_aArgsPGMInvalidatePage[] =
614{
615 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
616 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR) }
617};
618static const REMPARMDESC g_aArgsPGMPhysGCPhys2HCPtr[] =
619{
620 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
621 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
622 { REMPARMDESC_FLAGS_INT, sizeof(RTUINT) },
623 { REMPARMDESC_FLAGS_INT, sizeof(PRTHCPTR) }
624};
625static const REMPARMDESC g_aArgsPGMPhysGCPtr2HCPtrByGstCR3[] =
626{
627 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
628 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
629 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
630 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
631 { REMPARMDESC_FLAGS_INT, sizeof(PRTHCPTR) }
632};
633static const REMPARMDESC g_aArgsPGM3PhysGrowRange[] =
634{
635 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
636 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) }
637};
638static const REMPARMDESC g_aArgsPGMPhysRead[] =
639{
640 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
641 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
642 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
643 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
644};
645static const REMPARMDESC g_aArgsPGMPhysReadGCPtr[] =
646{
647 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
648 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
649 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR) },
650 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
651};
652static const REMPARMDESC g_aArgsPGMPhysWrite[] =
653{
654 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
655 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
656 { REMPARMDESC_FLAGS_INT, sizeof(const void *) },
657 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
658};
659static const REMPARMDESC g_aArgsPGMChangeMode[] =
660{
661 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
662 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
663 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
664 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t) }
665};
666static const REMPARMDESC g_aArgsPGMFlushTLB[] =
667{
668 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
669 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
670 { REMPARMDESC_FLAGS_INT, sizeof(bool) }
671};
672static const REMPARMDESC g_aArgsPGMR3PhysReadUxx[] =
673{
674 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
675 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) }
676};
677static const REMPARMDESC g_aArgsPGMR3PhysWriteU8[] =
678{
679 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
680 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
681 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t) }
682};
683static const REMPARMDESC g_aArgsPGMR3PhysWriteU16[] =
684{
685 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
686 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
687 { REMPARMDESC_FLAGS_INT, sizeof(uint16_t) }
688};
689static const REMPARMDESC g_aArgsPGMR3PhysWriteU32[] =
690{
691 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
692 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
693 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) }
694};
695static const REMPARMDESC g_aArgsPGMR3PhysWriteU64[] =
696{
697 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
698 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) },
699 { REMPARMDESC_FLAGS_INT, sizeof(uint64_t) }
700};
701static const REMPARMDESC g_aArgsSSMR3GetGCPtr[] =
702{
703 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
704 { REMPARMDESC_FLAGS_INT, sizeof(PRTGCPTR) }
705};
706static const REMPARMDESC g_aArgsSSMR3GetMem[] =
707{
708 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
709 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
710 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
711};
712static const REMPARMDESC g_aArgsSSMR3GetU32[] =
713{
714 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
715 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *) }
716};
717static const REMPARMDESC g_aArgsSSMR3GetUInt[] =
718{
719 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
720 { REMPARMDESC_FLAGS_INT, sizeof(PRTUINT) }
721};
722static const REMPARMDESC g_aArgsSSMR3PutGCPtr[] =
723{
724 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
725 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR) }
726};
727static const REMPARMDESC g_aArgsSSMR3PutMem[] =
728{
729 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
730 { REMPARMDESC_FLAGS_INT, sizeof(const void *) },
731 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
732};
733static const REMPARMDESC g_aArgsSSMR3PutU32[] =
734{
735 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
736 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
737};
738static const REMPARMDESC g_aArgsSSMR3PutUInt[] =
739{
740 { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE) },
741 { REMPARMDESC_FLAGS_INT, sizeof(RTUINT) },
742};
743static const REMPARMDESC g_aArgsSSMR3RegisterInternal[] =
744{
745 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
746 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
747 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
748 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t) },
749 { REMPARMDESC_FLAGS_INT, sizeof(size_t) },
750 { REMPARMDESC_FLAGS_INT, sizeof(PFNSSMINTSAVEPREP) },
751 { REMPARMDESC_FLAGS_INT, sizeof(PFNSSMINTSAVEEXEC) },
752 { REMPARMDESC_FLAGS_INT, sizeof(PFNSSMINTSAVEDONE) },
753 { REMPARMDESC_FLAGS_INT, sizeof(PFNSSMINTLOADPREP) },
754 { REMPARMDESC_FLAGS_INT, sizeof(PFNSSMINTLOADEXEC) },
755 { REMPARMDESC_FLAGS_INT, sizeof(PFNSSMINTLOADDONE) },
756};
757static const REMPARMDESC g_aArgsSTAMR3Register[] =
758{
759 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
760 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
761 { REMPARMDESC_FLAGS_INT, sizeof(STAMTYPE) },
762 { REMPARMDESC_FLAGS_INT, sizeof(STAMVISIBILITY) },
763 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
764 { REMPARMDESC_FLAGS_INT, sizeof(STAMUNIT) },
765 { REMPARMDESC_FLAGS_INT, sizeof(const char *) }
766};
767static const REMPARMDESC g_aArgsTRPMAssertTrap[] =
768{
769 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
770 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t) },
771 { REMPARMDESC_FLAGS_INT, sizeof(bool) }
772};
773static const REMPARMDESC g_aArgsTRPMQueryTrap[] =
774{
775 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
776 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *) },
777 { REMPARMDESC_FLAGS_INT, sizeof(bool *) }
778};
779static const REMPARMDESC g_aArgsTRPMSetErrorCode[] =
780{
781 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
782 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINT) }
783};
784static const REMPARMDESC g_aArgsTRPMSetFaultAddress[] =
785{
786 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
787 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINT) }
788};
789static const REMPARMDESC g_aArgsVMR3ReqCall[] =
790{
791 { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
792 { REMPARMDESC_FLAGS_INT, sizeof(PVMREQ *) },
793 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
794 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
795 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
796 { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
797};
798static const REMPARMDESC g_aArgsVMR3ReqFree[] =
799{
800 { REMPARMDESC_FLAGS_INT, sizeof(PVMREQ) }
801};
802
803
804/* IPRT args */
805static const REMPARMDESC g_aArgsAssertMsg1[] =
806{
807 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
808 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
809 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
810 { REMPARMDESC_FLAGS_INT, sizeof(const char *) }
811};
812static const REMPARMDESC g_aArgsAssertMsg2[] =
813{
814 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
815 { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
816};
817static const REMPARMDESC g_aArgsRTLogFlags[] =
818{
819 { REMPARMDESC_FLAGS_INT, sizeof(PRTLOGGER) },
820 { REMPARMDESC_FLAGS_INT, sizeof(const char *) }
821};
822static const REMPARMDESC g_aArgsRTLogLoggerEx[] =
823{
824 { REMPARMDESC_FLAGS_INT, sizeof(PRTLOGGER) },
825 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
826 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
827 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
828 { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
829};
830static const REMPARMDESC g_aArgsRTLogLoggerExV[] =
831{
832 { REMPARMDESC_FLAGS_INT, sizeof(PRTLOGGER) },
833 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
834 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) },
835 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
836 { REMPARMDESC_FLAGS_VALIST, 0 }
837};
838static const REMPARMDESC g_aArgsRTLogPrintf[] =
839{
840 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
841 { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
842};
843static const REMPARMDESC g_aArgsRTMemProtect[] =
844{
845 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
846 { REMPARMDESC_FLAGS_INT, sizeof(size_t) },
847 { REMPARMDESC_FLAGS_INT, sizeof(unsigned) }
848};
849static const REMPARMDESC g_aArgsRTStrPrintf[] =
850{
851 { REMPARMDESC_FLAGS_INT, sizeof(char *) },
852 { REMPARMDESC_FLAGS_INT, sizeof(size_t) },
853 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
854 { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
855};
856static const REMPARMDESC g_aArgsRTStrPrintfV[] =
857{
858 { REMPARMDESC_FLAGS_INT, sizeof(char *) },
859 { REMPARMDESC_FLAGS_INT, sizeof(size_t) },
860 { REMPARMDESC_FLAGS_INT, sizeof(const char *) },
861 { REMPARMDESC_FLAGS_VALIST, 0 }
862};
863
864
865/* CRT args */
866static const REMPARMDESC g_aArgsmemcpy[] =
867{
868 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
869 { REMPARMDESC_FLAGS_INT, sizeof(const void *) },
870 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
871};
872static const REMPARMDESC g_aArgsmemset[] =
873{
874 { REMPARMDESC_FLAGS_INT, sizeof(void *) },
875 { REMPARMDESC_FLAGS_INT, sizeof(int) },
876 { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
877};
878
879
880/** @} */
881
882/**
883 * Descriptors for the exported functions.
884 */
885static const REMFNDESC g_aExports[] =
886{ /* pszName, (void *)pv, pParams, cParams, fFlags, cb, pvWrapper. */
887 { "REMR3Init", (void *)&pfnREMR3Init, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
888 { "REMR3Term", (void *)&pfnREMR3Term, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
889 { "REMR3Reset", (void *)&pfnREMR3Reset, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
890 { "REMR3Step", (void *)&pfnREMR3Step, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
891 { "REMR3BreakpointSet", (void *)&pfnREMR3BreakpointSet, &g_aArgsBreakpoint[0], ELEMENTS(g_aArgsBreakpoint), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
892 { "REMR3BreakpointClear", (void *)&pfnREMR3BreakpointClear, &g_aArgsBreakpoint[0], ELEMENTS(g_aArgsBreakpoint), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
893 { "REMR3EmulateInstruction", (void *)&pfnREMR3EmulateInstruction, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
894 { "REMR3Run", (void *)&pfnREMR3Run, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
895 { "REMR3State", (void *)&pfnREMR3State, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
896 { "REMR3StateBack", (void *)&pfnREMR3StateBack, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
897 { "REMR3StateUpdate", (void *)&pfnREMR3StateUpdate, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
898 { "REMR3A20Set", (void *)&pfnREMR3A20Set, &g_aArgsA20Set[0], ELEMENTS(g_aArgsA20Set), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
899 { "REMR3ReplayInvalidatedPages", (void *)&pfnREMR3ReplayInvalidatedPages, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
900 { "REMR3ReplayHandlerNotifications", (void *)&pfnREMR3ReplayHandlerNotifications, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
901 { "REMR3NotifyPhysRamRegister", (void *)&pfnREMR3NotifyPhysRamRegister, &g_aArgsNotifyPhysRamRegister[0], ELEMENTS(g_aArgsNotifyPhysRamRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
902 { "REMR3NotifyPhysRamChunkRegister", (void *)&pfnREMR3NotifyPhysRamChunkRegister, &g_aArgsNotifyPhysRamChunkRegister[0], ELEMENTS(g_aArgsNotifyPhysRamChunkRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
903 { "REMR3NotifyPhysReserve", (void *)&pfnREMR3NotifyPhysReserve, &g_aArgsNotifyPhysReserve[0], ELEMENTS(g_aArgsNotifyPhysReserve), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
904 { "REMR3NotifyPhysRomRegister", (void *)&pfnREMR3NotifyPhysRomRegister, &g_aArgsNotifyPhysRomRegister[0], ELEMENTS(g_aArgsNotifyPhysRomRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
905 { "REMR3NotifyHandlerPhysicalModify", (void *)&pfnREMR3NotifyHandlerPhysicalModify, &g_aArgsNotifyHandlerPhysicalModify[0], ELEMENTS(g_aArgsNotifyHandlerPhysicalModify), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
906 { "REMR3NotifyHandlerPhysicalRegister", (void *)&pfnREMR3NotifyHandlerPhysicalRegister, &g_aArgsNotifyHandlerPhysicalRegister[0], ELEMENTS(g_aArgsNotifyHandlerPhysicalRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
907 { "REMR3NotifyHandlerPhysicalDeregister", (void *)&pfnREMR3NotifyHandlerPhysicalDeregister, &g_aArgsNotifyHandlerPhysicalDeregister[0], ELEMENTS(g_aArgsNotifyHandlerPhysicalDeregister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
908 { "REMR3NotifyInterruptSet", (void *)&pfnREMR3NotifyInterruptSet, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
909 { "REMR3NotifyInterruptClear", (void *)&pfnREMR3NotifyInterruptClear, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
910 { "REMR3NotifyTimerPending", (void *)&pfnREMR3NotifyTimerPending, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
911 { "REMR3NotifyDmaPending", (void *)&pfnREMR3NotifyDmaPending, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
912 { "REMR3NotifyQueuePending", (void *)&pfnREMR3NotifyQueuePending, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
913 { "REMR3NotifyFF", (void *)&pfnREMR3NotifyFF, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
914 { "REMR3NotifyCodePageChanged", (void *)&pfnREMR3NotifyCodePageChanged, &g_aArgsNotifyCodePageChanged[0], ELEMENTS(g_aArgsNotifyCodePageChanged), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
915 { "REMR3NotifyPendingInterrupt", (void *)&pfnREMR3NotifyPendingInterrupt, &g_aArgsNotifyPendingInterrupt[0], ELEMENTS(g_aArgsNotifyPendingInterrupt), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
916 { "REMR3QueryPendingInterrupt", (void *)&pfnREMR3QueryPendingInterrupt, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
917 { "REMR3DisasEnableStepping", (void *)&pfnREMR3DisasEnableStepping, &g_aArgsDisasEnableStepping[0], ELEMENTS(g_aArgsDisasEnableStepping), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
918 { "REMR3IsPageAccessHandled", (void *)&pfnREMR3IsPageAccessHandled, &g_aArgsIsPageAccessHandled[0], ELEMENTS(g_aArgsIsPageAccessHandled), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }
919};
920
921
922/**
923 * Descriptors for the functions imported from VBoxVMM.
924 */
925static REMFNDESC g_aVMMImports[] =
926{
927 { "CPUMGetAndClearChangedFlagsREM", (void *)(uintptr_t)&CPUMGetAndClearChangedFlagsREM, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(unsigned), NULL },
928 { "CPUMGetGuestCpuId", (void *)(uintptr_t)&CPUMGetGuestCpuId, &g_aArgsCPUMGetGuestCpuId[0], ELEMENTS(g_aArgsCPUMGetGuestCpuId), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
929 { "CPUMGetGuestEAX", (void *)(uintptr_t)&CPUMGetGuestEAX, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
930 { "CPUMGetGuestEBP", (void *)(uintptr_t)&CPUMGetGuestEBP, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
931 { "CPUMGetGuestEBX", (void *)(uintptr_t)&CPUMGetGuestEBX, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
932 { "CPUMGetGuestECX", (void *)(uintptr_t)&CPUMGetGuestECX, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
933 { "CPUMGetGuestEDI", (void *)(uintptr_t)&CPUMGetGuestEDI, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
934 { "CPUMGetGuestEDX", (void *)(uintptr_t)&CPUMGetGuestEDX, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
935 { "CPUMGetGuestEIP", (void *)(uintptr_t)&CPUMGetGuestEIP, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
936 { "CPUMGetGuestESI", (void *)(uintptr_t)&CPUMGetGuestESI, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
937 { "CPUMGetGuestESP", (void *)(uintptr_t)&CPUMGetGuestESP, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
938 { "CPUMQueryGuestCtxPtr", (void *)(uintptr_t)&CPUMQueryGuestCtxPtr, &g_aArgsCPUMQueryGuestCtxPtr[0], ELEMENTS(g_aArgsCPUMQueryGuestCtxPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
939 { "CSAMR3MonitorPage", (void *)(uintptr_t)&CSAMR3MonitorPage, &g_aArgsCSAMR3MonitorPage[0], ELEMENTS(g_aArgsCSAMR3MonitorPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
940 { "DBGCRegisterCommands", (void *)(uintptr_t)&DBGCRegisterCommands, &g_aArgsDBGCRegisterCommands[0], ELEMENTS(g_aArgsDBGCRegisterCommands), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
941 { "DBGFR3DisasInstrEx", (void *)(uintptr_t)&DBGFR3DisasInstrEx, &g_aArgsDBGFR3DisasInstrEx[0], ELEMENTS(g_aArgsDBGFR3DisasInstrEx), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
942 { "DBGFR3Info", (void *)(uintptr_t)&DBGFR3Info, &g_aArgsDBGFR3Info[0], ELEMENTS(g_aArgsDBGFR3Info), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
943 { "DBGFR3InfoLogRelHlp", (void *)(uintptr_t)&DBGFR3InfoLogRelHlp, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
944 { "DBGFR3SymbolByAddr", (void *)(uintptr_t)&DBGFR3SymbolByAddr, &g_aArgsDBGFR3SymbolByAddr[0], ELEMENTS(g_aArgsDBGFR3SymbolByAddr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
945 { "DISInstr", (void *)(uintptr_t)&DISInstr, &g_aArgsDISInstr[0], ELEMENTS(g_aArgsDISInstr), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
946 { "EMR3FatalError", (void *)(uintptr_t)&EMR3FatalError, &g_aArgsEMR3FatalError[0], ELEMENTS(g_aArgsEMR3FatalError), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
947 { "HWACCMR3CanExecuteGuest", (void *)(uintptr_t)&HWACCMR3CanExecuteGuest, &g_aArgsHWACCMR3CanExecuteGuest[0], ELEMENTS(g_aArgsHWACCMR3CanExecuteGuest), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
948 { "IOMIOPortRead", (void *)(uintptr_t)&IOMIOPortRead, &g_aArgsIOMIOPortRead[0], ELEMENTS(g_aArgsIOMIOPortRead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
949 { "IOMIOPortWrite", (void *)(uintptr_t)&IOMIOPortWrite, &g_aArgsIOMIOPortWrite[0], ELEMENTS(g_aArgsIOMIOPortWrite), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
950 { "IOMMMIORead", (void *)(uintptr_t)&IOMMMIORead, &g_aArgsIOMMMIORead[0], ELEMENTS(g_aArgsIOMMMIORead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
951 { "IOMMMIOWrite", (void *)(uintptr_t)&IOMMMIOWrite, &g_aArgsIOMMMIOWrite[0], ELEMENTS(g_aArgsIOMMMIOWrite), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
952 { "MMR3HeapAlloc", (void *)(uintptr_t)&MMR3HeapAlloc, &g_aArgsMMR3HeapAlloc[0], ELEMENTS(g_aArgsMMR3HeapAlloc), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
953 { "MMR3PhysGetRamSize", (void *)(uintptr_t)&MMR3PhysGetRamSize, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t), NULL },
954 { "PATMIsPatchGCAddr", (void *)(uintptr_t)&PATMIsPatchGCAddr, &g_aArgsPATMIsPatchGCAddr[0], ELEMENTS(g_aArgsPATMIsPatchGCAddr), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
955 { "PATMR3QueryOpcode", (void *)(uintptr_t)&PATMR3QueryOpcode, &g_aArgsPATMR3QueryOpcode[0], ELEMENTS(g_aArgsPATMR3QueryOpcode), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
956 { "PATMR3QueryPatchMemGC", (void *)(uintptr_t)&PATMR3QueryPatchMemGC, &g_aArgsPATMR3QueryPatchMem[0], ELEMENTS(g_aArgsPATMR3QueryPatchMem), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCPTR), NULL },
957 { "PATMR3QueryPatchMemHC", (void *)(uintptr_t)&PATMR3QueryPatchMemHC, &g_aArgsPATMR3QueryPatchMem[0], ELEMENTS(g_aArgsPATMR3QueryPatchMem), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
958 { "PDMApicGetBase", (void *)(uintptr_t)&PDMApicGetBase, &g_aArgsPDMApicGetBase[0], ELEMENTS(g_aArgsPDMApicGetBase), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
959 { "PDMApicGetTPR", (void *)(uintptr_t)&PDMApicGetTPR, &g_aArgsPDMApicGetTPR[0], ELEMENTS(g_aArgsPDMApicGetTPR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
960 { "PDMApicSetBase", (void *)(uintptr_t)&PDMApicSetBase, &g_aArgsPDMApicSetBase[0], ELEMENTS(g_aArgsPDMApicSetBase), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
961 { "PDMApicSetTPR", (void *)(uintptr_t)&PDMApicSetTPR, &g_aArgsPDMApicSetTPR[0], ELEMENTS(g_aArgsPDMApicSetTPR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
962 { "PDMR3DmaRun", (void *)(uintptr_t)&PDMR3DmaRun, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
963 { "PDMGetInterrupt", (void *)(uintptr_t)&PDMGetInterrupt, &g_aArgsPDMGetInterrupt[0], ELEMENTS(g_aArgsPDMGetInterrupt), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
964 { "PDMIsaSetIrq", (void *)(uintptr_t)&PDMIsaSetIrq, &g_aArgsPDMIsaSetIrq[0], ELEMENTS(g_aArgsPDMIsaSetIrq), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
965 { "PGMGstGetPage", (void *)(uintptr_t)&PGMGstGetPage, &g_aArgsPGMGstGetPage[0], ELEMENTS(g_aArgsPGMGstGetPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
966 { "PGMInvalidatePage", (void *)(uintptr_t)&PGMInvalidatePage, &g_aArgsPGMInvalidatePage[0], ELEMENTS(g_aArgsPGMInvalidatePage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
967 { "PGMPhysGCPhys2HCPtr", (void *)(uintptr_t)&PGMPhysGCPhys2HCPtr, &g_aArgsPGMPhysGCPhys2HCPtr[0], ELEMENTS(g_aArgsPGMPhysGCPhys2HCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
968 { "PGMPhysGCPtr2HCPtrByGstCR3", (void *)(uintptr_t)&PGMPhysGCPtr2HCPtrByGstCR3, &g_aArgsPGMPhysGCPtr2HCPtrByGstCR3[0], ELEMENTS(g_aArgsPGMPhysGCPtr2HCPtrByGstCR3), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
969 { "PGM3PhysGrowRange", (void *)(uintptr_t)&PGM3PhysGrowRange, &g_aArgsPGM3PhysGrowRange[0], ELEMENTS(g_aArgsPGM3PhysGrowRange), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
970 { "PGMPhysIsA20Enabled", (void *)(uintptr_t)&PGMPhysIsA20Enabled, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
971 { "PGMPhysRead", (void *)(uintptr_t)&PGMPhysRead, &g_aArgsPGMPhysRead[0], ELEMENTS(g_aArgsPGMPhysRead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
972 { "PGMPhysReadGCPtr", (void *)(uintptr_t)&PGMPhysReadGCPtr, &g_aArgsPGMPhysReadGCPtr[0], ELEMENTS(g_aArgsPGMPhysReadGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
973 { "PGMPhysReadGCPtr", (void *)(uintptr_t)&PGMPhysReadGCPtr, &g_aArgsPGMPhysReadGCPtr[0], ELEMENTS(g_aArgsPGMPhysReadGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
974 { "PGMPhysWrite", (void *)(uintptr_t)&PGMPhysWrite, &g_aArgsPGMPhysWrite[0], ELEMENTS(g_aArgsPGMPhysWrite), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
975 { "PGMChangeMode", (void *)(uintptr_t)&PGMChangeMode, &g_aArgsPGMChangeMode[0], ELEMENTS(g_aArgsPGMChangeMode), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
976 { "PGMFlushTLB", (void *)(uintptr_t)&PGMFlushTLB, &g_aArgsPGMFlushTLB[0], ELEMENTS(g_aArgsPGMFlushTLB), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
977 { "PGMR3PhysReadByte", (void *)(uintptr_t)&PGMR3PhysReadByte, &g_aArgsPGMR3PhysReadUxx[0], ELEMENTS(g_aArgsPGMR3PhysReadUxx), REMFNDESC_FLAGS_RET_INT, sizeof(uint8_t), NULL },
978 { "PGMR3PhysReadDword", (void *)(uintptr_t)&PGMR3PhysReadDword, &g_aArgsPGMR3PhysReadUxx[0], ELEMENTS(g_aArgsPGMR3PhysReadUxx), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
979 { "PGMR3PhysReadWord", (void *)(uintptr_t)&PGMR3PhysReadWord, &g_aArgsPGMR3PhysReadUxx[0], ELEMENTS(g_aArgsPGMR3PhysReadUxx), REMFNDESC_FLAGS_RET_INT, sizeof(uint16_t), NULL },
980 { "PGMR3PhysWriteByte", (void *)(uintptr_t)&PGMR3PhysWriteByte, &g_aArgsPGMR3PhysWriteU8[0], ELEMENTS(g_aArgsPGMR3PhysWriteU8), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
981 { "PGMR3PhysWriteDword", (void *)(uintptr_t)&PGMR3PhysWriteDword, &g_aArgsPGMR3PhysWriteU32[0], ELEMENTS(g_aArgsPGMR3PhysWriteU32), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
982 { "PGMR3PhysWriteWord", (void *)(uintptr_t)&PGMR3PhysWriteWord, &g_aArgsPGMR3PhysWriteU16[0], ELEMENTS(g_aArgsPGMR3PhysWriteU16), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
983 { "SSMR3GetGCPtr", (void *)(uintptr_t)&SSMR3GetGCPtr, &g_aArgsSSMR3GetGCPtr[0], ELEMENTS(g_aArgsSSMR3GetGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
984 { "SSMR3GetMem", (void *)(uintptr_t)&SSMR3GetMem, &g_aArgsSSMR3GetMem[0], ELEMENTS(g_aArgsSSMR3GetMem), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
985 { "SSMR3GetU32", (void *)(uintptr_t)&SSMR3GetU32, &g_aArgsSSMR3GetU32[0], ELEMENTS(g_aArgsSSMR3GetU32), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
986 { "SSMR3GetUInt", (void *)(uintptr_t)&SSMR3GetUInt, &g_aArgsSSMR3GetUInt[0], ELEMENTS(g_aArgsSSMR3GetUInt), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
987 { "SSMR3PutGCPtr", (void *)(uintptr_t)&SSMR3PutGCPtr, &g_aArgsSSMR3PutGCPtr[0], ELEMENTS(g_aArgsSSMR3PutGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
988 { "SSMR3PutMem", (void *)(uintptr_t)&SSMR3PutMem, &g_aArgsSSMR3PutMem[0], ELEMENTS(g_aArgsSSMR3PutMem), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
989 { "SSMR3PutU32", (void *)(uintptr_t)&SSMR3PutU32, &g_aArgsSSMR3PutU32[0], ELEMENTS(g_aArgsSSMR3PutU32), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
990 { "SSMR3PutUInt", (void *)(uintptr_t)&SSMR3PutUInt, &g_aArgsSSMR3PutUInt[0], ELEMENTS(g_aArgsSSMR3PutUInt), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
991 { "SSMR3RegisterInternal", (void *)(uintptr_t)&SSMR3RegisterInternal, &g_aArgsSSMR3RegisterInternal[0], ELEMENTS(g_aArgsSSMR3RegisterInternal), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
992 { "STAMR3Register", (void *)(uintptr_t)&STAMR3Register, &g_aArgsSTAMR3Register[0], ELEMENTS(g_aArgsSTAMR3Register), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
993 { "TMCpuTickGet", (void *)(uintptr_t)&TMCpuTickGet, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t), NULL },
994 { "TMCpuTickPause", (void *)(uintptr_t)&TMCpuTickPause, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
995 { "TMCpuTickResume", (void *)(uintptr_t)&TMCpuTickResume, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
996 { "TMTimerPoll", (void *)(uintptr_t)&TMTimerPoll, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t), NULL },
997 { "TMR3TimerQueuesDo", (void *)(uintptr_t)&TMR3TimerQueuesDo, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
998 { "TMVirtualPause", (void *)(uintptr_t)&TMVirtualPause, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
999 { "TMVirtualResume", (void *)(uintptr_t)&TMVirtualResume, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1000 { "TRPMAssertTrap", (void *)(uintptr_t)&TRPMAssertTrap, &g_aArgsTRPMAssertTrap[0], ELEMENTS(g_aArgsTRPMAssertTrap), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1001 { "TRPMGetErrorCode", (void *)(uintptr_t)&TRPMGetErrorCode, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINT), NULL },
1002 { "TRPMGetFaultAddress", (void *)(uintptr_t)&TRPMGetFaultAddress, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINTPTR),NULL },
1003 { "TRPMQueryTrap", (void *)(uintptr_t)&TRPMQueryTrap, &g_aArgsTRPMQueryTrap[0], ELEMENTS(g_aArgsTRPMQueryTrap), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1004 { "TRPMResetTrap", (void *)(uintptr_t)&TRPMResetTrap, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1005 { "TRPMSetErrorCode", (void *)(uintptr_t)&TRPMSetErrorCode, &g_aArgsTRPMSetErrorCode[0], ELEMENTS(g_aArgsTRPMSetErrorCode), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
1006 { "TRPMSetFaultAddress", (void *)(uintptr_t)&TRPMSetFaultAddress, &g_aArgsTRPMSetFaultAddress[0], ELEMENTS(g_aArgsTRPMSetFaultAddress), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
1007 { "VMMR3Lock", (void *)(uintptr_t)&VMMR3Lock, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1008 { "VMMR3Unlock", (void *)(uintptr_t)&VMMR3Unlock, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1009 { "VMR3ReqCall", (void *)(uintptr_t)&VMR3ReqCall, &g_aArgsVMR3ReqCall[0], ELEMENTS(g_aArgsVMR3ReqCall), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1010 { "VMR3ReqFree", (void *)(uintptr_t)&VMR3ReqFree, &g_aArgsVMR3ReqFree[0], ELEMENTS(g_aArgsVMR3ReqFree), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(int), NULL },
1011// { "", (void *)(uintptr_t)&, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1012};
1013
1014
1015/**
1016 * Descriptors for the functions imported from VBoxRT.
1017 */
1018static REMFNDESC g_aRTImports[] =
1019{
1020 { "AssertMsg1", (void *)(uintptr_t)&AssertMsg1, &g_aArgsAssertMsg1[0], ELEMENTS(g_aArgsAssertMsg1), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
1021 { "AssertMsg2", (void *)(uintptr_t)&AssertMsg2, &g_aArgsAssertMsg2[0], ELEMENTS(g_aArgsAssertMsg2), REMFNDESC_FLAGS_RET_VOID | REMFNDESC_FLAGS_ELLIPSIS, 0, NULL },
1022 { "RTAssertDoBreakpoint", (void *)(uintptr_t)&RTAssertDoBreakpoint, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
1023 { "RTLogDefaultInstance", (void *)(uintptr_t)&RTLogDefaultInstance, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(PRTLOGGER), NULL },
1024 { "RTLogRelDefaultInstance", (void *)(uintptr_t)&RTLogRelDefaultInstance, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(PRTLOGGER), NULL },
1025 { "RTLogFlags", (void *)(uintptr_t)&RTLogFlags, &g_aArgsRTLogFlags[0], ELEMENTS(g_aArgsRTLogFlags), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1026 { "RTLogLoggerEx", (void *)(uintptr_t)&RTLogLoggerEx, &g_aArgsRTLogLoggerEx[0], ELEMENTS(g_aArgsRTLogLoggerEx), REMFNDESC_FLAGS_RET_VOID | REMFNDESC_FLAGS_ELLIPSIS, 0, NULL },
1027 { "RTLogLoggerExV", (void *)(uintptr_t)&RTLogLoggerExV, &g_aArgsRTLogLoggerExV[0], ELEMENTS(g_aArgsRTLogLoggerExV), REMFNDESC_FLAGS_RET_VOID | REMFNDESC_FLAGS_VALIST, 0, NULL },
1028 { "RTLogPrintf", (void *)(uintptr_t)&RTLogPrintf, &g_aArgsRTLogPrintf[0], ELEMENTS(g_aArgsRTLogPrintf), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
1029 { "RTMemAlloc", (void *)(uintptr_t)&RTMemAlloc, &g_aArgsSIZE_T[0], ELEMENTS(g_aArgsSIZE_T), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
1030 { "RTMemExecAlloc", (void *)(uintptr_t)&RTMemExecAlloc, &g_aArgsSIZE_T[0], ELEMENTS(g_aArgsSIZE_T), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
1031 { "RTMemExecFree", (void *)(uintptr_t)&RTMemExecFree, &g_aArgsPTR[0], ELEMENTS(g_aArgsPTR), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
1032 { "RTMemFree", (void *)(uintptr_t)&RTMemFree, &g_aArgsPTR[0], ELEMENTS(g_aArgsPTR), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
1033 { "RTMemPageAlloc", (void *)(uintptr_t)&RTMemPageAlloc, &g_aArgsSIZE_T[0], ELEMENTS(g_aArgsSIZE_T), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
1034 { "RTMemPageFree", (void *)(uintptr_t)&RTMemPageFree, &g_aArgsPTR[0], ELEMENTS(g_aArgsPTR), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
1035 { "RTMemProtect", (void *)(uintptr_t)&RTMemProtect, &g_aArgsRTMemProtect[0], ELEMENTS(g_aArgsRTMemProtect), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
1036 { "RTStrPrintf", (void *)(uintptr_t)&RTStrPrintf, &g_aArgsRTStrPrintf[0], ELEMENTS(g_aArgsRTStrPrintf), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(size_t), NULL },
1037 { "RTStrPrintfV", (void *)(uintptr_t)&RTStrPrintfV, &g_aArgsRTStrPrintfV[0], ELEMENTS(g_aArgsRTStrPrintfV), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_VALIST, sizeof(size_t), NULL },
1038 { "RTThreadNativeSelf", (void *)(uintptr_t)&RTThreadNativeSelf, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(RTNATIVETHREAD), NULL },
1039};
1040
1041
1042/**
1043 * Descriptors for the functions imported from VBoxRT.
1044 */
1045static REMFNDESC g_aCRTImports[] =
1046{
1047 { "memcpy", (void *)(uintptr_t)&memcpy, &g_aArgsmemcpy[0], ELEMENTS(g_aArgsmemcpy), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
1048 { "memset", (void *)(uintptr_t)&memset, &g_aArgsmemset[0], ELEMENTS(g_aArgsmemset), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL }
1049/*
1050floor floor
1051memcpy memcpy
1052sqrt sqrt
1053sqrtf sqrtf
1054*/
1055};
1056
1057
1058# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
1059/** LIFO of read-write-executable memory chunks used for wrappers. */
1060static PREMEXECMEM g_pExecMemHead;
1061# endif
1062
1063
1064/*******************************************************************************
1065* Internal Functions *
1066*******************************************************************************/
1067# ifdef USE_REM_CALLING_CONVENTION_GLUE
1068DECLASM(int) WrapGCC2MSC0Int(void); DECLASM(int) WrapGCC2MSC0Int_EndProc(void);
1069DECLASM(int) WrapGCC2MSC1Int(void); DECLASM(int) WrapGCC2MSC1Int_EndProc(void);
1070DECLASM(int) WrapGCC2MSC2Int(void); DECLASM(int) WrapGCC2MSC2Int_EndProc(void);
1071DECLASM(int) WrapGCC2MSC3Int(void); DECLASM(int) WrapGCC2MSC3Int_EndProc(void);
1072DECLASM(int) WrapGCC2MSC4Int(void); DECLASM(int) WrapGCC2MSC4Int_EndProc(void);
1073DECLASM(int) WrapGCC2MSC5Int(void); DECLASM(int) WrapGCC2MSC5Int_EndProc(void);
1074DECLASM(int) WrapGCC2MSC6Int(void); DECLASM(int) WrapGCC2MSC6Int_EndProc(void);
1075DECLASM(int) WrapGCC2MSC7Int(void); DECLASM(int) WrapGCC2MSC7Int_EndProc(void);
1076DECLASM(int) WrapGCC2MSC8Int(void); DECLASM(int) WrapGCC2MSC8Int_EndProc(void);
1077DECLASM(int) WrapGCC2MSC9Int(void); DECLASM(int) WrapGCC2MSC9Int_EndProc(void);
1078DECLASM(int) WrapGCC2MSC10Int(void); DECLASM(int) WrapGCC2MSC10Int_EndProc(void);
1079DECLASM(int) WrapGCC2MSC11Int(void); DECLASM(int) WrapGCC2MSC11Int_EndProc(void);
1080DECLASM(int) WrapGCC2MSC12Int(void); DECLASM(int) WrapGCC2MSC12Int_EndProc(void);
1081DECLASM(int) WrapGCC2MSCVariadictInt(void); DECLASM(int) WrapGCC2MSCVariadictInt_EndProc(void);
1082
1083DECLASM(int) WrapMSC2GCC0Int(void); DECLASM(int) WrapMSC2GCC0Int_EndProc(void);
1084DECLASM(int) WrapMSC2GCC1Int(void); DECLASM(int) WrapMSC2GCC1Int_EndProc(void);
1085DECLASM(int) WrapMSC2GCC2Int(void); DECLASM(int) WrapMSC2GCC2Int_EndProc(void);
1086DECLASM(int) WrapMSC2GCC3Int(void); DECLASM(int) WrapMSC2GCC3Int_EndProc(void);
1087DECLASM(int) WrapMSC2GCC4Int(void); DECLASM(int) WrapMSC2GCC4Int_EndProc(void);
1088DECLASM(int) WrapMSC2GCC5Int(void); DECLASM(int) WrapMSC2GCC5Int_EndProc(void);
1089DECLASM(int) WrapMSC2GCC6Int(void); DECLASM(int) WrapMSC2GCC6Int_EndProc(void);
1090DECLASM(int) WrapMSC2GCC7Int(void); DECLASM(int) WrapMSC2GCC7Int_EndProc(void);
1091DECLASM(int) WrapMSC2GCC8Int(void); DECLASM(int) WrapMSC2GCC8Int_EndProc(void);
1092DECLASM(int) WrapMSC2GCC9Int(void); DECLASM(int) WrapMSC2GCC9Int_EndProc(void);
1093# endif
1094
1095
1096# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
1097/**
1098 * Allocates a block of memory for glue code.
1099 *
1100 * The returned memory is padded with INT3s.
1101 *
1102 * @returns Pointer to the allocated memory.
1103 * @param The amount of memory to allocate.
1104 */
1105static void *remAllocGlue(size_t cb)
1106{
1107 PREMEXECMEM pCur = g_pExecMemHead;
1108 uint32_t cbAligned = (uint32_t)RT_ALIGN_32(cb, 32);
1109 while (pCur)
1110 {
1111 if (pCur->cb - pCur->off >= cbAligned)
1112 {
1113 void *pv = (uint8_t *)pCur + pCur->off;
1114 pCur->off += cbAligned;
1115 return memset(pv, 0xcc, cbAligned);
1116 }
1117 pCur = pCur->pNext;
1118 }
1119
1120 /* add a new chunk */
1121 AssertReturn(_64K - RT_ALIGN_Z(sizeof(*pCur), 32) > cbAligned, NULL);
1122 pCur = (PREMEXECMEM)RTMemExecAlloc(_64K);
1123 AssertReturn(pCur, NULL);
1124 pCur->cb = _64K;
1125 pCur->off = RT_ALIGN_32(sizeof(*pCur), 32) + cbAligned;
1126 pCur->pNext = g_pExecMemHead;
1127 g_pExecMemHead = pCur;
1128 return memset((uint8_t *)pCur + RT_ALIGN_Z(sizeof(*pCur), 32), 0xcc, cbAligned);
1129}
1130# endif /* USE_REM_CALLING_CONVENTION_GLUE || USE_REM_IMPORT_JUMP_GLUE */
1131
1132
1133# ifdef USE_REM_CALLING_CONVENTION_GLUE
1134/**
1135 * Checks if a function is all straight forward integers.
1136 *
1137 * @returns True if it's simple, false if it's bothersome.
1138 * @param pDesc The function descriptor.
1139 */
1140static bool remIsFunctionAllInts(PCREMFNDESC pDesc)
1141{
1142 if ( ( (pDesc->fFlags & REMFNDESC_FLAGS_RET_TYPE_MASK) != REMFNDESC_FLAGS_RET_INT
1143 || pDesc->cbReturn > sizeof(uint64_t))
1144 && (pDesc->fFlags & REMFNDESC_FLAGS_RET_TYPE_MASK) != REMFNDESC_FLAGS_RET_VOID)
1145 return false;
1146 unsigned i = pDesc->cParams;
1147 while (i-- > 0)
1148 switch (pDesc->paParams[i].fFlags & REMPARMDESC_FLAGS_TYPE_MASK)
1149 {
1150 case REMPARMDESC_FLAGS_INT:
1151 case REMPARMDESC_FLAGS_GCPTR:
1152 case REMPARMDESC_FLAGS_GCPHYS:
1153 case REMPARMDESC_FLAGS_HCPHYS:
1154 break;
1155
1156 default:
1157 AssertReleaseMsgFailed(("Invalid param flags %#x for #%d of %s!\n", pDesc->paParams[i].fFlags, i, pDesc->pszName));
1158 case REMPARMDESC_FLAGS_VALIST:
1159 case REMPARMDESC_FLAGS_ELLIPSIS:
1160 case REMPARMDESC_FLAGS_FLOAT:
1161 case REMPARMDESC_FLAGS_STRUCT:
1162 return false;
1163 }
1164 return true;
1165}
1166
1167
1168/**
1169 * Checks if the function has an ellipsis (...) argument.
1170 *
1171 * @returns true if it has an ellipsis, otherwise false.
1172 * @param pDesc The function descriptor.
1173 */
1174static bool remHasFunctionEllipsis(PCREMFNDESC pDesc)
1175{
1176 unsigned i = pDesc->cParams;
1177 while (i-- > 0)
1178 if ((pDesc->paParams[i].fFlags & REMPARMDESC_FLAGS_TYPE_MASK) == REMPARMDESC_FLAGS_ELLIPSIS)
1179 return true;
1180 return false;
1181}
1182
1183
1184/**
1185 * Checks if the function uses floating point (FP) arguments or return value.
1186 *
1187 * @returns true if it uses floating point, otherwise false.
1188 * @param pDesc The function descriptor.
1189 */
1190static bool remIsFunctionUsingFP(PCREMFNDESC pDesc)
1191{
1192 if ((pDesc->fFlags & REMFNDESC_FLAGS_RET_TYPE_MASK) == REMFNDESC_FLAGS_RET_FLOAT)
1193 return true;
1194 unsigned i = pDesc->cParams;
1195 while (i-- > 0)
1196 if ((pDesc->paParams[i].fFlags & REMPARMDESC_FLAGS_TYPE_MASK) == REMPARMDESC_FLAGS_FLOAT)
1197 return true;
1198 return false;
1199}
1200
1201
1202/**
1203 * Fixes export glue.
1204 *
1205 * @param pvGlue The glue code.
1206 * @param cb The size of the glue code.
1207 * @param pvExport The address of the export we're wrapping.
1208 * @param pDesc The export descriptor.
1209 */
1210static void remGenerateExportGlueFixup(void *pvGlue, size_t cb, uintptr_t uExport, PCREMFNDESC pDesc)
1211{
1212 union
1213 {
1214 uint8_t *pu8;
1215 int32_t *pi32;
1216 uint32_t *pu32;
1217 uint64_t *pu64;
1218 void *pv;
1219 } u;
1220 u.pv = pvGlue;
1221
1222 while (cb >= 4)
1223 {
1224 if (*u.pu32 == 0xdeadbeef)
1225 {
1226 /* 32-bit rel jmp/call to real export. */
1227 *u.pi32 = uExport - (uintptr_t)(u.pi32 + 1);
1228 Assert((uintptr_t)(u.pi32 + 1) + *u.pi32 == uExport);
1229 u.pi32++;
1230 cb -= 4;
1231 continue;
1232 }
1233 if (cb >= 8 && *u.pu64 == UINT64_C(0xdeadf00df00ddead))
1234 {
1235 /* 64-bit address to the real export. */
1236 *u.pu64++ = uExport;
1237 cb -= 8;
1238 continue;
1239 }
1240
1241 /* move on. */
1242 u.pu8++;
1243 cb--;
1244 }
1245}
1246
1247
1248/**
1249 * Fixes import glue.
1250 *
1251 * @param pvGlue The glue code.
1252 * @param cb The size of the glue code.
1253 * @param pDesc The import descriptor.
1254 */
1255static void remGenerateImportGlueFixup(void *pvGlue, size_t cb, PCREMFNDESC pDesc)
1256{
1257 union
1258 {
1259 uint8_t *pu8;
1260 int32_t *pi32;
1261 uint32_t *pu32;
1262 uint64_t *pu64;
1263 void *pv;
1264 } u;
1265 u.pv = pvGlue;
1266
1267 while (cb >= 4)
1268 {
1269 if (*u.pu32 == 0xdeadbeef)
1270 {
1271 /* 32-bit rel jmp/call to real function. */
1272 *u.pi32 = (uintptr_t)pDesc->pv - (uintptr_t)(u.pi32 + 1);
1273 Assert((uintptr_t)(u.pi32 + 1) + *u.pi32 == (uintptr_t)pDesc->pv);
1274 u.pi32++;
1275 cb -= 4;
1276 continue;
1277 }
1278 if (cb >= 8 && *u.pu64 == UINT64_C(0xdeadf00df00ddead))
1279 {
1280 /* 64-bit address to the real function. */
1281 *u.pu64++ = (uintptr_t)pDesc->pv;
1282 cb -= 8;
1283 continue;
1284 }
1285
1286 /* move on. */
1287 u.pu8++;
1288 cb--;
1289 }
1290}
1291
1292# endif /* USE_REM_CALLING_CONVENTION_GLUE */
1293
1294
1295/**
1296 * Generate wrapper glue code for an export.
1297 *
1298 * This is only used on win64 when loading a 64-bit linux module. So, on other
1299 * platforms it will not do anything.
1300 *
1301 * @returns VBox status code.
1302 * @param pValue IN: Where to get the address of the function to wrap.
1303 * OUT: Where to store the glue address.
1304 * @param pDesc The export descriptor.
1305 */
1306static int remGenerateExportGlue(PRTUINTPTR pValue, PCREMFNDESC pDesc)
1307{
1308# ifdef USE_REM_CALLING_CONVENTION_GLUE
1309 uintptr_t *ppfn = (uintptr_t *)pDesc->pv;
1310 if (!*ppfn)
1311 {
1312 if (remIsFunctionAllInts(pDesc))
1313 {
1314 static const struct { void *pvStart, *pvEnd; } s_aTemplates[] =
1315 {
1316 { (void *)&WrapMSC2GCC0Int, (void *)&WrapMSC2GCC0Int_EndProc },
1317 { (void *)&WrapMSC2GCC1Int, (void *)&WrapMSC2GCC1Int_EndProc },
1318 { (void *)&WrapMSC2GCC2Int, (void *)&WrapMSC2GCC2Int_EndProc },
1319 { (void *)&WrapMSC2GCC3Int, (void *)&WrapMSC2GCC3Int_EndProc },
1320 { (void *)&WrapMSC2GCC4Int, (void *)&WrapMSC2GCC4Int_EndProc },
1321 { (void *)&WrapMSC2GCC5Int, (void *)&WrapMSC2GCC5Int_EndProc },
1322 { (void *)&WrapMSC2GCC6Int, (void *)&WrapMSC2GCC6Int_EndProc },
1323 { (void *)&WrapMSC2GCC7Int, (void *)&WrapMSC2GCC7Int_EndProc },
1324 { (void *)&WrapMSC2GCC8Int, (void *)&WrapMSC2GCC8Int_EndProc },
1325 { (void *)&WrapMSC2GCC9Int, (void *)&WrapMSC2GCC9Int_EndProc },
1326 };
1327 const unsigned i = pDesc->cParams;
1328 AssertReleaseMsg(i < ELEMENTS(s_aTemplates), ("%d (%s)\n", i, pDesc->pszName));
1329
1330 /* duplicate the patch. */
1331 const size_t cb = (uintptr_t)s_aTemplates[i].pvEnd - (uintptr_t)s_aTemplates[i].pvStart;
1332 uint8_t *pb = (uint8_t *)remAllocGlue(cb);
1333 AssertReturn(pb, VERR_NO_MEMORY);
1334 memcpy(pb, s_aTemplates[i].pvStart, cb);
1335
1336 /* fix it up. */
1337 remGenerateExportGlueFixup(pb, cb, *pValue, pDesc);
1338 *ppfn = (uintptr_t)pb;
1339 }
1340 else
1341 {
1342 /* annoying stuff, later. */
1343#if 1
1344 AssertReleaseMsgFailed(("Not implemented! %s\n", pDesc->pszName));
1345 return VERR_NOT_IMPLEMENTED;
1346#else
1347 AssertMsg2("annoying: %s\n", pDesc->pszName);
1348 uint8_t *pb;
1349 pb = (uint8_t *)remAllocGlue(3);
1350 AssertReturn(pb, VERR_NO_MEMORY);
1351 *pb++ = 0xcc;
1352 *pb++ = 0x90;
1353 *pb++ = 0xc3;
1354 *ppfn = (uintptr_t)pb;
1355#endif
1356 }
1357 }
1358 *pValue = *ppfn;
1359 return VINF_SUCCESS;
1360# else /* !USE_REM_CALLING_CONVENTION_GLUE */
1361 return VINF_SUCCESS;
1362# endif /* !USE_REM_CALLING_CONVENTION_GLUE */
1363}
1364
1365
1366/**
1367 * Generate wrapper glue code for an import.
1368 *
1369 * This is only used on win64 when loading a 64-bit linux module. So, on other
1370 * platforms it will simply return the address of the imported function
1371 * without generating any glue code.
1372 *
1373 * @returns VBox status code.
1374 * @param pValue Where to store the glue address.
1375 * @param pDesc The export descriptor.
1376 */
1377static int remGenerateImportGlue(PRTUINTPTR pValue, PREMFNDESC pDesc)
1378{
1379# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
1380 if (!pDesc->pvWrapper)
1381 {
1382# ifdef USE_REM_CALLING_CONVENTION_GLUE
1383 if (remIsFunctionAllInts(pDesc))
1384 {
1385 static const struct { void *pvStart, *pvEnd; } s_aTemplates[] =
1386 {
1387 { (void *)&WrapGCC2MSC0Int, (void *)&WrapGCC2MSC0Int_EndProc },
1388 { (void *)&WrapGCC2MSC1Int, (void *)&WrapGCC2MSC1Int_EndProc },
1389 { (void *)&WrapGCC2MSC2Int, (void *)&WrapGCC2MSC2Int_EndProc },
1390 { (void *)&WrapGCC2MSC3Int, (void *)&WrapGCC2MSC3Int_EndProc },
1391 { (void *)&WrapGCC2MSC4Int, (void *)&WrapGCC2MSC4Int_EndProc },
1392 { (void *)&WrapGCC2MSC5Int, (void *)&WrapGCC2MSC5Int_EndProc },
1393 { (void *)&WrapGCC2MSC6Int, (void *)&WrapGCC2MSC6Int_EndProc },
1394 { (void *)&WrapGCC2MSC7Int, (void *)&WrapGCC2MSC7Int_EndProc },
1395 { (void *)&WrapGCC2MSC8Int, (void *)&WrapGCC2MSC8Int_EndProc },
1396 { (void *)&WrapGCC2MSC9Int, (void *)&WrapGCC2MSC9Int_EndProc },
1397 { (void *)&WrapGCC2MSC10Int, (void *)&WrapGCC2MSC10Int_EndProc },
1398 { (void *)&WrapGCC2MSC11Int, (void *)&WrapGCC2MSC11Int_EndProc },
1399 { (void *)&WrapGCC2MSC12Int, (void *)&WrapGCC2MSC12Int_EndProc }
1400 };
1401 const unsigned i = pDesc->cParams;
1402 AssertReleaseMsg(i < ELEMENTS(s_aTemplates), ("%d (%s)\n", i, pDesc->pszName));
1403
1404 /* duplicate the patch. */
1405 const size_t cb = (uintptr_t)s_aTemplates[i].pvEnd - (uintptr_t)s_aTemplates[i].pvStart;
1406 pDesc->pvWrapper = remAllocGlue(cb);
1407 AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
1408 memcpy(pDesc->pvWrapper, s_aTemplates[i].pvStart, cb);
1409
1410 /* fix it up. */
1411 remGenerateImportGlueFixup((uint8_t *)pDesc->pvWrapper, cb, pDesc);
1412 }
1413 else if ( remHasFunctionEllipsis(pDesc)
1414 && !remIsFunctionUsingFP(pDesc))
1415 {
1416 /* duplicate the patch. */
1417 const size_t cb = (uintptr_t)&WrapGCC2MSCVariadictInt_EndProc - (uintptr_t)&WrapGCC2MSCVariadictInt;
1418 pDesc->pvWrapper = remAllocGlue(cb);
1419 AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
1420 memcpy(pDesc->pvWrapper, (void *)&WrapGCC2MSCVariadictInt, cb);
1421
1422 /* fix it up. */
1423 remGenerateImportGlueFixup((uint8_t *)pDesc->pvWrapper, cb, pDesc);
1424 }
1425 else
1426 {
1427 /* annoying stuff, later. */
1428#if 0
1429 AssertReleaseMsgFailed(("Not implemented! %s\n", pDesc->pszName));
1430 return VERR_NOT_IMPLEMENTED;
1431#else
1432 AssertMsg2("annoying: %s\n", pDesc->pszName);
1433 uint8_t *pb;
1434 pDesc->pvWrapper = pb = (uint8_t *)remAllocGlue(3);
1435 AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
1436 *pb++ = 0xcc;
1437 *pb++ = 0x90;
1438 *pb++ = 0xc3;
1439#endif
1440 }
1441# else /* !USE_REM_CALLING_CONVENTION_GLUE */
1442
1443 /*
1444 * Generate a jump patch.
1445 */
1446 uint8_t *pb;
1447# ifdef __AMD64__
1448 pDesc->pvWrapper = pb = (uint8_t *)remAllocGlue(32);
1449 AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
1450 /**pb++ = 0xcc;*/
1451 *pb++ = 0xff;
1452 *pb++ = 0x24;
1453 *pb++ = 0x25;
1454 *(uint32_t *)pb = (uintptr_t)pb + 5;
1455 pb += 5;
1456 *(uint64_t *)pb = (uint64_t)pDesc->pv;
1457# else
1458 pDesc->pvWrapper = pb = (uint8_t *)remAllocGlue(8);
1459 AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
1460 *pb++ = 0xea;
1461 *(uint32_t *)pb = (uint32_t)pDesc->pv;
1462# endif
1463# endif /* !USE_REM_CALLING_CONVENTION_GLUE */
1464 }
1465 *pValue = (uintptr_t)pDesc->pvWrapper;
1466# else /* !USE_REM_CALLING_CONVENTION_GLUE */
1467 *pValue = (uintptr_t)pDesc->pv;
1468# endif /* !USE_REM_CALLING_CONVENTION_GLUE */
1469 return VINF_SUCCESS;
1470}
1471
1472
1473/**
1474 * Resolve an external symbol during RTLdrGetBits().
1475 *
1476 * @returns iprt status code.
1477 * @param hLdrMod The loader module handle.
1478 * @param pszModule Module name.
1479 * @param pszSymbol Symbol name, NULL if uSymbol should be used.
1480 * @param uSymbol Symbol ordinal, ~0 if pszSymbol should be used.
1481 * @param pValue Where to store the symbol value (address).
1482 * @param pvUser User argument.
1483 */
1484static DECLCALLBACK(int) remGetImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser)
1485{
1486 unsigned i;
1487 for (i = 0; i < ELEMENTS(g_aVMMImports); i++)
1488 if (!strcmp(g_aVMMImports[i].pszName, pszSymbol))
1489 return remGenerateImportGlue(pValue, &g_aVMMImports[i]);
1490 for (i = 0; i < ELEMENTS(g_aRTImports); i++)
1491 if (!strcmp(g_aRTImports[i].pszName, pszSymbol))
1492 return remGenerateImportGlue(pValue, &g_aRTImports[i]);
1493 for (i = 0; i < ELEMENTS(g_aCRTImports); i++)
1494 if (!strcmp(g_aCRTImports[i].pszName, pszSymbol))
1495 return remGenerateImportGlue(pValue, &g_aCRTImports[i]);
1496#if 1
1497 AssertMsg2("missing: %s\n", pszSymbol);
1498 return remGenerateImportGlue(pValue, &g_aCRTImports[0]);
1499#else
1500 *pValue = 0;
1501 AssertMsgFailed(("%s.%s\n", pszModule, pszSymbol));
1502 return VERR_SYMBOL_NOT_FOUND;
1503#endif
1504}
1505
1506/**
1507 * Loads the linux object, resolves all imports and exports.
1508 *
1509 * @returns VBox status code.
1510 */
1511static int remLoadLinuxObj(void)
1512{
1513 size_t offFilename;
1514 char szPath[RTPATH_MAX];
1515 int rc = RTPathProgram(szPath, sizeof(szPath) - 32);
1516 AssertRCReturn(rc, rc);
1517 offFilename = strlen(szPath);
1518
1519 /*
1520 * Load the VBoxREM2.rel object/DLL.
1521 */
1522 strcpy(&szPath[offFilename], "/VBoxREM2.rel");
1523 rc = RTLdrOpen(szPath, &g_ModREM2);
1524 if (VBOX_SUCCESS(rc))
1525 {
1526 g_pvREM2 = RTMemExecAlloc(RTLdrSize(g_ModREM2));
1527 if (g_pvREM2)
1528 {
1529#ifdef DEBUG /* How to load the VBoxREM2.rel symbols into the GNU debugger. */
1530 RTPrintf("VBoxREMWrapper: (gdb) add-symbol-file %s 0x%p\n", szPath, g_pvREM2);
1531#endif
1532 Log(("Loading %s at 0x%p (%d bytes)\n"
1533 "(gdb) add-symbol-file %s 0x%p\n",
1534 szPath, g_pvREM2, RTLdrSize(g_ModREM2), szPath, g_pvREM2));
1535 rc = RTLdrGetBits(g_ModREM2, g_pvREM2, (RTUINTPTR)g_pvREM2, remGetImport, NULL);
1536 if (VBOX_SUCCESS(rc))
1537 {
1538 /*
1539 * Resolve exports.
1540 */
1541 unsigned i;
1542 for (i = 0; i < ELEMENTS(g_aExports); i++)
1543 {
1544 RTUINTPTR Value;
1545 rc = RTLdrGetSymbolEx(g_ModREM2, g_pvREM2, (RTUINTPTR)g_pvREM2, g_aExports[i].pszName, &Value);
1546 AssertMsgRC(rc, ("%s rc=%VRc\n", g_aExports[i].pszName, rc));
1547 if (VBOX_FAILURE(rc))
1548 break;
1549 rc = remGenerateExportGlue(&Value, &g_aExports[i]);
1550 if (VBOX_FAILURE(rc))
1551 break;
1552 *(void **)g_aExports[i].pv = (void *)(uintptr_t)Value;
1553 }
1554 return rc;
1555 }
1556 RTMemExecFree(g_pvREM2);
1557 }
1558 RTLdrClose(g_ModREM2);
1559 g_ModREM2 = NIL_RTLDRMOD;
1560 }
1561 return rc;
1562}
1563
1564
1565/**
1566 * Unloads the linux object, freeing up all resources (dlls and
1567 * import glue) we allocated during remLoadLinuxObj().
1568 */
1569static void remUnloadLinuxObj(void)
1570{
1571 unsigned i;
1572
1573 /* close modules. */
1574 RTLdrClose(g_ModREM2);
1575 g_ModREM2 = NIL_RTLDRMOD;
1576 RTMemExecFree(g_pvREM2);
1577 g_pvREM2 = NULL;
1578
1579 /* clear the pointers. */
1580 for (i = 0; i < ELEMENTS(g_aExports); i++)
1581 *(void **)g_aExports[i].pv = NULL;
1582# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
1583 for (i = 0; i < ELEMENTS(g_aVMMImports); i++)
1584 g_aVMMImports[i].pvWrapper = NULL;
1585 for (i = 0; i < ELEMENTS(g_aRTImports); i++)
1586 g_aRTImports[i].pvWrapper = NULL;
1587 for (i = 0; i < ELEMENTS(g_aCRTImports); i++)
1588 g_aCRTImports[i].pvWrapper = NULL;
1589
1590 /* free wrapper memory. */
1591 while (g_pExecMemHead)
1592 {
1593 PREMEXECMEM pCur = g_pExecMemHead;
1594 g_pExecMemHead = pCur->pNext;
1595 memset(pCur, 0xcc, pCur->cb);
1596 RTMemExecFree(pCur);
1597 }
1598# endif
1599}
1600#endif
1601
1602
1603REMR3DECL(int) REMR3Init(PVM pVM)
1604{
1605#ifdef USE_REM_STUBS
1606 return VINF_SUCCESS;
1607#else
1608 if (!pfnREMR3Init)
1609 {
1610 int rc = remLoadLinuxObj();
1611 if (VBOX_FAILURE(rc))
1612 return rc;
1613 }
1614 return pfnREMR3Init(pVM);
1615#endif
1616}
1617
1618REMR3DECL(int) REMR3Term(PVM pVM)
1619{
1620#ifdef USE_REM_STUBS
1621 return VINF_SUCCESS;
1622#else
1623 int rc;
1624 Assert(VALID_PTR(pfnREMR3Term));
1625 rc = pfnREMR3Term(pVM);
1626 remUnloadLinuxObj();
1627 return rc;
1628#endif
1629}
1630
1631REMR3DECL(void) REMR3Reset(PVM pVM)
1632{
1633#ifndef USE_REM_STUBS
1634 Assert(VALID_PTR(pfnREMR3Reset));
1635 pfnREMR3Reset(pVM);
1636#endif
1637}
1638
1639REMR3DECL(int) REMR3Step(PVM pVM)
1640{
1641#ifdef USE_REM_STUBS
1642 return VERR_NOT_IMPLEMENTED;
1643#else
1644 Assert(VALID_PTR(pfnREMR3Step));
1645 return pfnREMR3Step(pVM);
1646#endif
1647}
1648
1649REMR3DECL(int) REMR3BreakpointSet(PVM pVM, RTGCUINTPTR Address)
1650{
1651#ifdef USE_REM_STUBS
1652 return VERR_REM_NO_MORE_BP_SLOTS;
1653#else
1654 Assert(VALID_PTR(pfnREMR3BreakpointSet));
1655 return pfnREMR3BreakpointSet(pVM, Address);
1656#endif
1657}
1658
1659REMR3DECL(int) REMR3BreakpointClear(PVM pVM, RTGCUINTPTR Address)
1660{
1661#ifdef USE_REM_STUBS
1662 return VERR_NOT_IMPLEMENTED;
1663#else
1664 Assert(VALID_PTR(pfnREMR3BreakpointClear));
1665 return pfnREMR3BreakpointClear(pVM, Address);
1666#endif
1667}
1668
1669REMR3DECL(int) REMR3EmulateInstruction(PVM pVM)
1670{
1671#ifdef USE_REM_STUBS
1672 return VERR_NOT_IMPLEMENTED;
1673#else
1674 Assert(VALID_PTR(pfnREMR3EmulateInstruction));
1675 return pfnREMR3EmulateInstruction(pVM);
1676#endif
1677}
1678
1679REMR3DECL(int) REMR3Run(PVM pVM)
1680{
1681#ifdef USE_REM_STUBS
1682 return VERR_NOT_IMPLEMENTED;
1683#else
1684 Assert(VALID_PTR(pfnREMR3Run));
1685 return pfnREMR3Run(pVM);
1686#endif
1687}
1688
1689REMR3DECL(int) REMR3State(PVM pVM)
1690{
1691#ifdef USE_REM_STUBS
1692 return VERR_NOT_IMPLEMENTED;
1693#else
1694 Assert(VALID_PTR(pfnREMR3State));
1695 return pfnREMR3State(pVM);
1696#endif
1697}
1698
1699REMR3DECL(int) REMR3StateBack(PVM pVM)
1700{
1701#ifdef USE_REM_STUBS
1702 return VERR_NOT_IMPLEMENTED;
1703#else
1704 Assert(VALID_PTR(pfnREMR3StateBack));
1705 return pfnREMR3StateBack(pVM);
1706#endif
1707}
1708
1709REMR3DECL(void) REMR3StateUpdate(PVM pVM)
1710{
1711#ifndef USE_REM_STUBS
1712 Assert(VALID_PTR(pfnREMR3StateUpdate));
1713 pfnREMR3StateUpdate(pVM);
1714#endif
1715}
1716
1717REMR3DECL(void) REMR3A20Set(PVM pVM, bool fEnable)
1718{
1719#ifndef USE_REM_STUBS
1720 Assert(VALID_PTR(pfnREMR3A20Set));
1721 pfnREMR3A20Set(pVM, fEnable);
1722#endif
1723}
1724
1725REMR3DECL(void) REMR3ReplayInvalidatedPages(PVM pVM)
1726{
1727#ifndef USE_REM_STUBS
1728 Assert(VALID_PTR(pfnREMR3ReplayInvalidatedPages));
1729 pfnREMR3ReplayInvalidatedPages(pVM);
1730#endif
1731}
1732
1733REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM)
1734{
1735#ifndef USE_REM_STUBS
1736 Assert(VALID_PTR(pfnREMR3ReplayHandlerNotifications));
1737 pfnREMR3ReplayHandlerNotifications(pVM);
1738#endif
1739}
1740
1741REMR3DECL(int) REMR3NotifyCodePageChanged(PVM pVM, RTGCPTR pvCodePage)
1742{
1743#ifdef USE_REM_STUBS
1744 return VINF_SUCCESS;
1745#else
1746 Assert(VALID_PTR(pfnREMR3NotifyCodePageChanged));
1747 return pfnREMR3NotifyCodePageChanged(pVM, pvCodePage);
1748#endif
1749}
1750
1751REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvRam, unsigned fFlags)
1752{
1753#ifndef USE_REM_STUBS
1754 Assert(VALID_PTR(pfnREMR3NotifyPhysRamRegister));
1755 pfnREMR3NotifyPhysRamRegister(pVM, GCPhys, cb, pvRam, fFlags);
1756#endif
1757}
1758
1759REMR3DECL(void) REMR3NotifyPhysRamChunkRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, RTHCUINTPTR pvRam, unsigned fFlags)
1760{
1761#ifndef USE_REM_STUBS
1762 Assert(VALID_PTR(pfnREMR3NotifyPhysRamChunkRegister));
1763 pfnREMR3NotifyPhysRamChunkRegister(pVM, GCPhys, cb, pvRam, fFlags);
1764#endif
1765}
1766
1767REMR3DECL(void) REMR3NotifyPhysRomRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvCopy)
1768{
1769#ifndef USE_REM_STUBS
1770 Assert(VALID_PTR(pfnREMR3NotifyPhysRomRegister));
1771 pfnREMR3NotifyPhysRomRegister(pVM, GCPhys, cb, pvCopy);
1772#endif
1773}
1774
1775REMR3DECL(void) REMR3NotifyPhysReserve(PVM pVM, RTGCPHYS GCPhys, RTUINT cb)
1776{
1777#ifndef USE_REM_STUBS
1778 Assert(VALID_PTR(pfnREMR3NotifyPhysReserve));
1779 pfnREMR3NotifyPhysReserve(pVM, GCPhys, cb);
1780#endif
1781}
1782
1783REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
1784{
1785#ifndef USE_REM_STUBS
1786 Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalRegister));
1787 pfnREMR3NotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, cb, fHasHCHandler);
1788#endif
1789}
1790
1791REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, void *pvHCPtr)
1792{
1793#ifndef USE_REM_STUBS
1794 Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalDeregister));
1795 pfnREMR3NotifyHandlerPhysicalDeregister(pVM, enmType, GCPhys, cb, fHasHCHandler, pvHCPtr);
1796#endif
1797}
1798
1799REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, void *pvHCPtr)
1800{
1801#ifndef USE_REM_STUBS
1802 Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalModify));
1803 pfnREMR3NotifyHandlerPhysicalModify(pVM, enmType, GCPhysOld, GCPhysNew, cb, fHasHCHandler, pvHCPtr);
1804#endif
1805}
1806
1807REMDECL(bool) REMR3IsPageAccessHandled(PVM pVM, RTGCPHYS GCPhys)
1808{
1809#ifdef USE_REM_STUBS
1810 return false;
1811#else
1812 Assert(VALID_PTR(pfnREMR3IsPageAccessHandled));
1813 return pfnREMR3IsPageAccessHandled(pVM, GCPhys);
1814#endif
1815}
1816
1817REMR3DECL(int) REMR3DisasEnableStepping(PVM pVM, bool fEnable)
1818{
1819#ifdef USE_REM_STUBS
1820 return VERR_NOT_IMPLEMENTED;
1821#else
1822 Assert(VALID_PTR(pfnREMR3DisasEnableStepping));
1823 return pfnREMR3DisasEnableStepping(pVM, fEnable);
1824#endif
1825}
1826
1827REMR3DECL(void) REMR3NotifyPendingInterrupt(PVM pVM, uint8_t u8Interrupt)
1828{
1829#ifndef USE_REM_STUBS
1830 Assert(VALID_PTR(pfnREMR3NotifyPendingInterrupt));
1831 pfnREMR3NotifyPendingInterrupt(pVM, u8Interrupt);
1832#endif
1833}
1834
1835REMR3DECL(uint32_t) REMR3QueryPendingInterrupt(PVM pVM)
1836{
1837#ifdef USE_REM_STUBS
1838 return REM_NO_PENDING_IRQ;
1839#else
1840 Assert(VALID_PTR(pfnREMR3QueryPendingInterrupt));
1841 return pfnREMR3QueryPendingInterrupt(pVM);
1842#endif
1843}
1844
1845REMR3DECL(void) REMR3NotifyInterruptSet(PVM pVM)
1846{
1847#ifndef USE_REM_STUBS
1848 Assert(VALID_PTR(pfnREMR3NotifyInterruptSet));
1849 pfnREMR3NotifyInterruptSet(pVM);
1850#endif
1851}
1852
1853REMR3DECL(void) REMR3NotifyInterruptClear(PVM pVM)
1854{
1855#ifndef USE_REM_STUBS
1856 Assert(VALID_PTR(pfnREMR3NotifyInterruptClear));
1857 pfnREMR3NotifyInterruptClear(pVM);
1858#endif
1859}
1860
1861REMR3DECL(void) REMR3NotifyTimerPending(PVM pVM)
1862{
1863#ifndef USE_REM_STUBS
1864 Assert(VALID_PTR(pfnREMR3NotifyTimerPending));
1865 pfnREMR3NotifyTimerPending(pVM);
1866#endif
1867}
1868
1869REMR3DECL(void) REMR3NotifyDmaPending(PVM pVM)
1870{
1871#ifndef USE_REM_STUBS
1872 Assert(VALID_PTR(pfnREMR3NotifyDmaPending));
1873 pfnREMR3NotifyDmaPending(pVM);
1874#endif
1875}
1876
1877REMR3DECL(void) REMR3NotifyQueuePending(PVM pVM)
1878{
1879#ifndef USE_REM_STUBS
1880 Assert(VALID_PTR(pfnREMR3NotifyQueuePending));
1881 pfnREMR3NotifyQueuePending(pVM);
1882#endif
1883}
1884
1885REMR3DECL(void) REMR3NotifyFF(PVM pVM)
1886{
1887#ifndef USE_REM_STUBS
1888 /* the timer can call this early on, so don't be picky. */
1889 if (pfnREMR3NotifyFF)
1890 pfnREMR3NotifyFF(pVM);
1891#endif
1892}
1893
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