1 | /* $Id: VBoxREMWrapper.cpp 20408 2009-06-08 13:50:06Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBoxREM Win64 DLL Wrapper.
|
---|
5 | */
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 |
|
---|
23 | /** @page pg_vboxrem_amd64 VBoxREM Hacks on AMD64
|
---|
24 | *
|
---|
25 | * There are problems with building BoxREM both on WIN64 and 64-bit linux.
|
---|
26 | *
|
---|
27 | * On linux binutils refuses to link shared objects without -fPIC compiled code
|
---|
28 | * (bitches about some fixup types). But when trying to build with -fPIC dyngen
|
---|
29 | * doesn't like the code anymore. Sweet. The current solution is to build the
|
---|
30 | * VBoxREM code as a relocatable module and use our ELF loader to load it.
|
---|
31 | *
|
---|
32 | * On WIN64 we're not aware of any GCC port which can emit code using the MSC
|
---|
33 | * calling convention. So, we're in for some real fun here. The choice is between
|
---|
34 | * porting GCC to AMD64 WIN64 and comming up with some kind of wrapper around
|
---|
35 | * either the win32 build or the 64-bit linux build.
|
---|
36 | *
|
---|
37 | * -# Porting GCC will be a lot of work. For one thing the calling convention differs
|
---|
38 | * and messing with such stuff can easily create ugly bugs. We would also have to
|
---|
39 | * do some binutils changes, but I think those are rather small compared to GCC.
|
---|
40 | * (That said, the MSC calling convention is far simpler than the linux one, it
|
---|
41 | * reminds me of _Optlink which we have working already.)
|
---|
42 | * -# Wrapping win32 code will work, but addresses outside the first 4GB are
|
---|
43 | * inaccessible and we will have to create 32-64 thunks for all imported functions.
|
---|
44 | * (To switch between 32-bit and 64-bit is load the right CS using far jmps (32->64)
|
---|
45 | * or far returns (both).)
|
---|
46 | * -# Wrapping 64-bit linux code might be the easier solution. The requirements here
|
---|
47 | * are:
|
---|
48 | * - Remove all CRT references we possibly, either by using intrinsics or using
|
---|
49 | * IPRT. Part of IPRT will be linked into VBoxREM2.rel, this will be yet another
|
---|
50 | * IPRT mode which I've dubbed 'no-crt'. The no-crt mode provide basic non-system
|
---|
51 | * dependent stuff.
|
---|
52 | * - Compile and link it into a relocatable object (include the gcc intrinsics
|
---|
53 | * in libgcc). Call this VBoxREM2.rel.
|
---|
54 | * - Write a wrapper dll, VBoxREM.dll, for which during REMR3Init() will load
|
---|
55 | * VBoxREM2.rel (using IPRT) and generate calling convention wrappers
|
---|
56 | * for all IPRT functions and VBoxVMM functions that it uses. All exports
|
---|
57 | * will be wrapped vice versa.
|
---|
58 | * - For building on windows hosts, we will use a mingw32 hosted cross compiler.
|
---|
59 | * and add a 'no-crt' mode to IPRT where it provides the necessary CRT headers
|
---|
60 | * and function implementations.
|
---|
61 | *
|
---|
62 | * The 3rd solution will be tried out first since it requires the least effort and
|
---|
63 | * will let us make use of the full 64-bit register set.
|
---|
64 | *
|
---|
65 | *
|
---|
66 | *
|
---|
67 | * @section sec_vboxrem_amd64_compare Comparing the GCC and MSC calling conventions
|
---|
68 | *
|
---|
69 | * GCC expects the following (cut & past from page 20 in the ABI draft 0.96):
|
---|
70 | *
|
---|
71 | * @verbatim
|
---|
72 | %rax temporary register; with variable arguments passes information about the
|
---|
73 | number of SSE registers used; 1st return register.
|
---|
74 | [Not preserved]
|
---|
75 | %rbx callee-saved register; optionally used as base pointer.
|
---|
76 | [Preserved]
|
---|
77 | %rcx used to pass 4th integer argument to functions.
|
---|
78 | [Not preserved]
|
---|
79 | %rdx used to pass 3rd argument to functions; 2nd return register
|
---|
80 | [Not preserved]
|
---|
81 | %rsp stack pointer
|
---|
82 | [Preserved]
|
---|
83 | %rbp callee-saved register; optionally used as frame pointer
|
---|
84 | [Preserved]
|
---|
85 | %rsi used to pass 2nd argument to functions
|
---|
86 | [Not preserved]
|
---|
87 | %rdi used to pass 1st argument to functions
|
---|
88 | [Not preserved]
|
---|
89 | %r8 used to pass 5th argument to functions
|
---|
90 | [Not preserved]
|
---|
91 | %r9 used to pass 6th argument to functions
|
---|
92 | [Not preserved]
|
---|
93 | %r10 temporary register, used for passing a function's static chain
|
---|
94 | pointer [Not preserved]
|
---|
95 | %r11 temporary register
|
---|
96 | [Not preserved]
|
---|
97 | %r12-r15 callee-saved registers
|
---|
98 | [Preserved]
|
---|
99 | %xmm0-%xmm1 used to pass and return floating point arguments
|
---|
100 | [Not preserved]
|
---|
101 | %xmm2-%xmm7 used to pass floating point arguments
|
---|
102 | [Not preserved]
|
---|
103 | %xmm8-%xmm15 temporary registers
|
---|
104 | [Not preserved]
|
---|
105 | %mmx0-%mmx7 temporary registers
|
---|
106 | [Not preserved]
|
---|
107 | %st0 temporary register; used to return long double arguments
|
---|
108 | [Not preserved]
|
---|
109 | %st1 temporary registers; used to return long double arguments
|
---|
110 | [Not preserved]
|
---|
111 | %st2-%st7 temporary registers
|
---|
112 | [Not preserved]
|
---|
113 | %fs Reserved for system use (as thread specific data register)
|
---|
114 | [Not preserved]
|
---|
115 | @endverbatim
|
---|
116 | *
|
---|
117 | * Direction flag is preserved as cleared.
|
---|
118 | * The stack must be aligned on a 16-byte boundrary before the 'call/jmp' instruction.
|
---|
119 | *
|
---|
120 | *
|
---|
121 | *
|
---|
122 | * MSC expects the following:
|
---|
123 | * @verbatim
|
---|
124 | rax return value, not preserved.
|
---|
125 | rbx preserved.
|
---|
126 | rcx 1st argument, integer, not preserved.
|
---|
127 | rdx 2nd argument, integer, not preserved.
|
---|
128 | rbp preserved.
|
---|
129 | rsp preserved.
|
---|
130 | rsi preserved.
|
---|
131 | rdi preserved.
|
---|
132 | r8 3rd argument, integer, not preserved.
|
---|
133 | r9 4th argument, integer, not preserved.
|
---|
134 | r10 scratch register, not preserved.
|
---|
135 | r11 scratch register, not preserved.
|
---|
136 | r12-r15 preserved.
|
---|
137 | xmm0 1st argument, fp, return value, not preserved.
|
---|
138 | xmm1 2st argument, fp, not preserved.
|
---|
139 | xmm2 3st argument, fp, not preserved.
|
---|
140 | xmm3 4st argument, fp, not preserved.
|
---|
141 | xmm4-xmm5 scratch, not preserved.
|
---|
142 | xmm6-xmm15 preserved.
|
---|
143 | @endverbatim
|
---|
144 | *
|
---|
145 | * Dunno what the direction flag is...
|
---|
146 | * The stack must be aligned on a 16-byte boundrary before the 'call/jmp' instruction.
|
---|
147 | *
|
---|
148 | *
|
---|
149 | * Thus, When GCC code is calling MSC code we don't really have to preserve
|
---|
150 | * anything. But but MSC code is calling GCC code, we'll have to save esi and edi.
|
---|
151 | *
|
---|
152 | */
|
---|
153 |
|
---|
154 |
|
---|
155 | /*******************************************************************************
|
---|
156 | * Defined Constants And Macros *
|
---|
157 | *******************************************************************************/
|
---|
158 | /** @def USE_REM_STUBS
|
---|
159 | * Define USE_REM_STUBS to stub the entire REM stuff. This is useful during
|
---|
160 | * early porting (before we start running stuff).
|
---|
161 | */
|
---|
162 | #if defined(__DOXYGEN__)
|
---|
163 | # define USE_REM_STUBS
|
---|
164 | #endif
|
---|
165 |
|
---|
166 | /** @def USE_REM_CALLING_CONVENTION_GLUE
|
---|
167 | * Define USE_REM_CALLING_CONVENTION_GLUE for platforms where it's necessary to
|
---|
168 | * use calling convention wrappers.
|
---|
169 | */
|
---|
170 | #if (defined(RT_ARCH_AMD64) && defined(RT_OS_WINDOWS)) || defined(__DOXYGEN__)
|
---|
171 | # define USE_REM_CALLING_CONVENTION_GLUE
|
---|
172 | #endif
|
---|
173 |
|
---|
174 | /** @def USE_REM_IMPORT_JUMP_GLUE
|
---|
175 | * Define USE_REM_IMPORT_JUMP_GLUE for platforms where we need to
|
---|
176 | * emit some jump glue to deal with big addresses.
|
---|
177 | */
|
---|
178 | #if (defined(RT_ARCH_AMD64) && !defined(USE_REM_CALLING_CONVENTION_GLUE) && !defined(RT_OS_DARWIN)) || defined(__DOXYGEN__)
|
---|
179 | # define USE_REM_IMPORT_JUMP_GLUE
|
---|
180 | #endif
|
---|
181 |
|
---|
182 |
|
---|
183 | /*******************************************************************************
|
---|
184 | * Header Files *
|
---|
185 | *******************************************************************************/
|
---|
186 | #define LOG_GROUP LOG_GROUP_REM
|
---|
187 | #include <VBox/rem.h>
|
---|
188 | #include <VBox/vmm.h>
|
---|
189 | #include <VBox/dbgf.h>
|
---|
190 | #include <VBox/dbg.h>
|
---|
191 | #include <VBox/csam.h>
|
---|
192 | #include <VBox/mm.h>
|
---|
193 | #include <VBox/em.h>
|
---|
194 | #include <VBox/ssm.h>
|
---|
195 | #include <VBox/hwaccm.h>
|
---|
196 | #include <VBox/patm.h>
|
---|
197 | #ifdef VBOX_WITH_VMI
|
---|
198 | # include <VBox/parav.h>
|
---|
199 | #endif
|
---|
200 | #include <VBox/pdm.h>
|
---|
201 | #include <VBox/pgm.h>
|
---|
202 | #include <VBox/iom.h>
|
---|
203 | #include <VBox/vm.h>
|
---|
204 | #include <VBox/err.h>
|
---|
205 | #include <VBox/log.h>
|
---|
206 | #include <VBox/dis.h>
|
---|
207 |
|
---|
208 | #include <iprt/alloc.h>
|
---|
209 | #include <iprt/assert.h>
|
---|
210 | #include <iprt/ldr.h>
|
---|
211 | #include <iprt/param.h>
|
---|
212 | #include <iprt/path.h>
|
---|
213 | #include <iprt/string.h>
|
---|
214 | #include <iprt/stream.h>
|
---|
215 |
|
---|
216 |
|
---|
217 | /*******************************************************************************
|
---|
218 | * Structures and Typedefs *
|
---|
219 | *******************************************************************************/
|
---|
220 | /**
|
---|
221 | * Parameter descriptor.
|
---|
222 | */
|
---|
223 | typedef struct REMPARMDESC
|
---|
224 | {
|
---|
225 | /** Parameter flags (REMPARMDESC_FLAGS_*). */
|
---|
226 | uint8_t fFlags;
|
---|
227 | /** The parameter size if REMPARMDESC_FLAGS_SIZE is set. */
|
---|
228 | uint8_t cb;
|
---|
229 | /** Pointer to additional data.
|
---|
230 | * For REMPARMDESC_FLAGS_PFN this is a PREMFNDESC. */
|
---|
231 | void *pvExtra;
|
---|
232 |
|
---|
233 | } REMPARMDESC, *PREMPARMDESC;
|
---|
234 | /** Pointer to a constant parameter descriptor. */
|
---|
235 | typedef const REMPARMDESC *PCREMPARMDESC;
|
---|
236 |
|
---|
237 | /** @name Parameter descriptor flags.
|
---|
238 | * @{ */
|
---|
239 | /** The parameter type is a kind of integer which could fit in a register. This includes pointers. */
|
---|
240 | #define REMPARMDESC_FLAGS_INT 0
|
---|
241 | /** The parameter is a GC pointer. */
|
---|
242 | #define REMPARMDESC_FLAGS_GCPTR 1
|
---|
243 | /** The parameter is a GC physical address. */
|
---|
244 | #define REMPARMDESC_FLAGS_GCPHYS 2
|
---|
245 | /** The parameter is a HC physical address. */
|
---|
246 | #define REMPARMDESC_FLAGS_HCPHYS 3
|
---|
247 | /** The parameter type is a kind of floating point. */
|
---|
248 | #define REMPARMDESC_FLAGS_FLOAT 4
|
---|
249 | /** The parameter value is a struct. This type takes a size. */
|
---|
250 | #define REMPARMDESC_FLAGS_STRUCT 5
|
---|
251 | /** The parameter is an elipsis. */
|
---|
252 | #define REMPARMDESC_FLAGS_ELLIPSIS 6
|
---|
253 | /** The parameter is a va_list. */
|
---|
254 | #define REMPARMDESC_FLAGS_VALIST 7
|
---|
255 | /** The parameter is a function pointer. pvExtra is a PREMFNDESC. */
|
---|
256 | #define REMPARMDESC_FLAGS_PFN 8
|
---|
257 | /** The parameter type mask. */
|
---|
258 | #define REMPARMDESC_FLAGS_TYPE_MASK 15
|
---|
259 | /** The parameter size field is valid. */
|
---|
260 | #define REMPARMDESC_FLAGS_SIZE RT_BIT(7)
|
---|
261 | /** @} */
|
---|
262 |
|
---|
263 | /**
|
---|
264 | * Function descriptor.
|
---|
265 | */
|
---|
266 | typedef struct REMFNDESC
|
---|
267 | {
|
---|
268 | /** The function name. */
|
---|
269 | const char *pszName;
|
---|
270 | /** Exports: Pointer to the function pointer.
|
---|
271 | * Imports: Pointer to the function. */
|
---|
272 | void *pv;
|
---|
273 | /** Array of parameter descriptors. */
|
---|
274 | PCREMPARMDESC paParams;
|
---|
275 | /** The number of parameter descriptors pointed to by paParams. */
|
---|
276 | uint8_t cParams;
|
---|
277 | /** Function flags (REMFNDESC_FLAGS_*). */
|
---|
278 | uint8_t fFlags;
|
---|
279 | /** The size of the return value. */
|
---|
280 | uint8_t cbReturn;
|
---|
281 | /** Pointer to the wrapper code for imports. */
|
---|
282 | void *pvWrapper;
|
---|
283 | } REMFNDESC, *PREMFNDESC;
|
---|
284 | /** Pointer to a constant function descriptor. */
|
---|
285 | typedef const REMFNDESC *PCREMFNDESC;
|
---|
286 |
|
---|
287 | /** @name Function descriptor flags.
|
---|
288 | * @{ */
|
---|
289 | /** The return type is void. */
|
---|
290 | #define REMFNDESC_FLAGS_RET_VOID 0
|
---|
291 | /** The return type is a kind of integer passed in rax/eax. This includes pointers. */
|
---|
292 | #define REMFNDESC_FLAGS_RET_INT 1
|
---|
293 | /** The return type is a kind of floating point. */
|
---|
294 | #define REMFNDESC_FLAGS_RET_FLOAT 2
|
---|
295 | /** The return value is a struct. This type take a size. */
|
---|
296 | #define REMFNDESC_FLAGS_RET_STRUCT 3
|
---|
297 | /** The return type mask. */
|
---|
298 | #define REMFNDESC_FLAGS_RET_TYPE_MASK 7
|
---|
299 | /** The argument list contains one or more va_list arguments (i.e. problems). */
|
---|
300 | #define REMFNDESC_FLAGS_VALIST RT_BIT(6)
|
---|
301 | /** The function has an ellipsis (i.e. a problem). */
|
---|
302 | #define REMFNDESC_FLAGS_ELLIPSIS RT_BIT(7)
|
---|
303 | /** @} */
|
---|
304 |
|
---|
305 | /**
|
---|
306 | * Chunk of read-write-executable memory.
|
---|
307 | */
|
---|
308 | typedef struct REMEXECMEM
|
---|
309 | {
|
---|
310 | /** The number of bytes left. */
|
---|
311 | struct REMEXECMEM *pNext;
|
---|
312 | /** The size of this chunk. */
|
---|
313 | uint32_t cb;
|
---|
314 | /** The offset of the next code block. */
|
---|
315 | uint32_t off;
|
---|
316 | #if ARCH_BITS == 32
|
---|
317 | uint32_t padding;
|
---|
318 | #endif
|
---|
319 | } REMEXECMEM, *PREMEXECMEM;
|
---|
320 |
|
---|
321 |
|
---|
322 | /*******************************************************************************
|
---|
323 | * Global Variables *
|
---|
324 | *******************************************************************************/
|
---|
325 | #ifndef USE_REM_STUBS
|
---|
326 | /** Loader handle of the REM object/DLL. */
|
---|
327 | static RTLDRMOD g_ModREM2;
|
---|
328 | /** Pointer to the memory containing the loaded REM2 object/DLL. */
|
---|
329 | static void *g_pvREM2;
|
---|
330 |
|
---|
331 | /** Linux object export addresses.
|
---|
332 | * These are references from the assembly wrapper code.
|
---|
333 | * @{ */
|
---|
334 | static DECLCALLBACKPTR(int, pfnREMR3Init)(PVM);
|
---|
335 | static DECLCALLBACKPTR(int, pfnREMR3InitFinalize)(PVM);
|
---|
336 | static DECLCALLBACKPTR(int, pfnREMR3Term)(PVM);
|
---|
337 | static DECLCALLBACKPTR(void, pfnREMR3Reset)(PVM);
|
---|
338 | static DECLCALLBACKPTR(int, pfnREMR3Step)(PVM, PVMCPU);
|
---|
339 | static DECLCALLBACKPTR(int, pfnREMR3BreakpointSet)(PVM, RTGCUINTPTR);
|
---|
340 | static DECLCALLBACKPTR(int, pfnREMR3BreakpointClear)(PVM, RTGCUINTPTR);
|
---|
341 | static DECLCALLBACKPTR(int, pfnREMR3EmulateInstruction)(PVM, PVMCPU);
|
---|
342 | static DECLCALLBACKPTR(int, pfnREMR3Run)(PVM, PVMCPU);
|
---|
343 | static DECLCALLBACKPTR(int, pfnREMR3State)(PVM, PVMCPU);
|
---|
344 | static DECLCALLBACKPTR(int, pfnREMR3StateBack)(PVM, PVMCPU);
|
---|
345 | static DECLCALLBACKPTR(void, pfnREMR3StateUpdate)(PVM, PVMCPU);
|
---|
346 | static DECLCALLBACKPTR(void, pfnREMR3A20Set)(PVM, PVMCPU, bool);
|
---|
347 | static DECLCALLBACKPTR(void, pfnREMR3ReplayHandlerNotifications)(PVM pVM);
|
---|
348 | static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamRegister)(PVM, RTGCPHYS, RTGCPHYS, unsigned);
|
---|
349 | static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamDeregister)(PVM, RTGCPHYS, RTUINT);
|
---|
350 | static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRomRegister)(PVM, RTGCPHYS, RTUINT, void *, bool);
|
---|
351 | static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalModify)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, RTGCPHYS, bool, bool);
|
---|
352 | static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalRegister)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, bool);
|
---|
353 | static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalDeregister)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, bool, bool);
|
---|
354 | static DECLCALLBACKPTR(void, pfnREMR3NotifyInterruptSet)(PVM, PVMCPU);
|
---|
355 | static DECLCALLBACKPTR(void, pfnREMR3NotifyInterruptClear)(PVM, PVMCPU);
|
---|
356 | static DECLCALLBACKPTR(void, pfnREMR3NotifyTimerPending)(PVM, PVMCPU);
|
---|
357 | static DECLCALLBACKPTR(void, pfnREMR3NotifyDmaPending)(PVM);
|
---|
358 | static DECLCALLBACKPTR(void, pfnREMR3NotifyQueuePending)(PVM);
|
---|
359 | static DECLCALLBACKPTR(void, pfnREMR3NotifyFF)(PVM);
|
---|
360 | static DECLCALLBACKPTR(int, pfnREMR3NotifyCodePageChanged)(PVM, PVMCPU, RTGCPTR);
|
---|
361 | static DECLCALLBACKPTR(void, pfnREMR3NotifyPendingInterrupt)(PVM, PVMCPU, uint8_t);
|
---|
362 | static DECLCALLBACKPTR(uint32_t, pfnREMR3QueryPendingInterrupt)(PVM, PVMCPU);
|
---|
363 | static DECLCALLBACKPTR(int, pfnREMR3DisasEnableStepping)(PVM, bool);
|
---|
364 | static DECLCALLBACKPTR(bool, pfnREMR3IsPageAccessHandled)(PVM, RTGCPHYS);
|
---|
365 | /** @} */
|
---|
366 |
|
---|
367 | /** Export and import parameter descriptors.
|
---|
368 | * @{
|
---|
369 | */
|
---|
370 | /* Common args. */
|
---|
371 | static const REMPARMDESC g_aArgsSIZE_T[] =
|
---|
372 | {
|
---|
373 | { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
|
---|
374 | };
|
---|
375 | static const REMPARMDESC g_aArgsPTR[] =
|
---|
376 | {
|
---|
377 | { REMPARMDESC_FLAGS_INT, sizeof(void *) }
|
---|
378 | };
|
---|
379 | static const REMPARMDESC g_aArgsVM[] =
|
---|
380 | {
|
---|
381 | { REMPARMDESC_FLAGS_INT, sizeof(PVM) }
|
---|
382 | };
|
---|
383 | static const REMPARMDESC g_aArgsVMCPU[] =
|
---|
384 | {
|
---|
385 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU) }
|
---|
386 | };
|
---|
387 |
|
---|
388 | static const REMPARMDESC g_aArgsVMandVMCPU[] =
|
---|
389 | {
|
---|
390 | { REMPARMDESC_FLAGS_INT, sizeof(PVM) },
|
---|
391 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU) }
|
---|
392 | };
|
---|
393 |
|
---|
394 | /* REM args */
|
---|
395 | static const REMPARMDESC g_aArgsBreakpoint[] =
|
---|
396 | {
|
---|
397 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
398 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINTPTR), NULL }
|
---|
399 | };
|
---|
400 | static const REMPARMDESC g_aArgsA20Set[] =
|
---|
401 | {
|
---|
402 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
403 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
404 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }
|
---|
405 | };
|
---|
406 | static const REMPARMDESC g_aArgsNotifyPhysRamRegister[] =
|
---|
407 | {
|
---|
408 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
409 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
410 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
411 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
412 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL }
|
---|
413 | };
|
---|
414 | static const REMPARMDESC g_aArgsNotifyPhysRamChunkRegister[] =
|
---|
415 | {
|
---|
416 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
417 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
418 | { REMPARMDESC_FLAGS_INT, sizeof(RTUINT), NULL },
|
---|
419 | { REMPARMDESC_FLAGS_INT, sizeof(RTHCUINTPTR), NULL },
|
---|
420 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL }
|
---|
421 | };
|
---|
422 | static const REMPARMDESC g_aArgsNotifyPhysRamDeregister[] =
|
---|
423 | {
|
---|
424 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
425 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
426 | { REMPARMDESC_FLAGS_INT, sizeof(RTUINT), NULL }
|
---|
427 | };
|
---|
428 | static const REMPARMDESC g_aArgsNotifyPhysRomRegister[] =
|
---|
429 | {
|
---|
430 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
431 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
432 | { REMPARMDESC_FLAGS_INT, sizeof(RTUINT), NULL },
|
---|
433 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
434 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }
|
---|
435 | };
|
---|
436 | static const REMPARMDESC g_aArgsNotifyHandlerPhysicalModify[] =
|
---|
437 | {
|
---|
438 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
439 | { REMPARMDESC_FLAGS_INT, sizeof(PGMPHYSHANDLERTYPE), NULL },
|
---|
440 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
441 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
442 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
443 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL },
|
---|
444 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }
|
---|
445 | };
|
---|
446 | static const REMPARMDESC g_aArgsNotifyHandlerPhysicalRegister[] =
|
---|
447 | {
|
---|
448 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
449 | { REMPARMDESC_FLAGS_INT, sizeof(PGMPHYSHANDLERTYPE), NULL },
|
---|
450 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
451 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
452 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }
|
---|
453 | };
|
---|
454 | static const REMPARMDESC g_aArgsNotifyHandlerPhysicalDeregister[] =
|
---|
455 | {
|
---|
456 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
457 | { REMPARMDESC_FLAGS_INT, sizeof(PGMPHYSHANDLERTYPE), NULL },
|
---|
458 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
459 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
460 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL },
|
---|
461 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }
|
---|
462 | };
|
---|
463 | static const REMPARMDESC g_aArgsNotifyCodePageChanged[] =
|
---|
464 | {
|
---|
465 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
466 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
467 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINTPTR), NULL }
|
---|
468 | };
|
---|
469 | static const REMPARMDESC g_aArgsNotifyPendingInterrupt[] =
|
---|
470 | {
|
---|
471 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
472 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
473 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL }
|
---|
474 | };
|
---|
475 | static const REMPARMDESC g_aArgsDisasEnableStepping[] =
|
---|
476 | {
|
---|
477 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
478 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }
|
---|
479 | };
|
---|
480 | static const REMPARMDESC g_aArgsIsPageAccessHandled[] =
|
---|
481 | {
|
---|
482 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
483 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL }
|
---|
484 | };
|
---|
485 |
|
---|
486 |
|
---|
487 | /* VMM args */
|
---|
488 | static const REMPARMDESC g_aArgsCPUMGetGuestCpl[] =
|
---|
489 | {
|
---|
490 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
491 | { REMPARMDESC_FLAGS_INT, sizeof(PCPUMCTXCORE), NULL },
|
---|
492 | };
|
---|
493 |
|
---|
494 | /* CPUMGetGuestMsr args */
|
---|
495 | static const REMPARMDESC g_aArgsCPUMGetGuestMsr[] =
|
---|
496 | {
|
---|
497 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
498 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
499 | };
|
---|
500 |
|
---|
501 | /* CPUMGetGuestMsr args */
|
---|
502 | static const REMPARMDESC g_aArgsCPUMSetGuestMsr[] =
|
---|
503 | {
|
---|
504 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
505 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
506 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL },
|
---|
507 | };
|
---|
508 |
|
---|
509 | static const REMPARMDESC g_aArgsCPUMGetGuestCpuId[] =
|
---|
510 | {
|
---|
511 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
512 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
513 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL },
|
---|
514 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL },
|
---|
515 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL },
|
---|
516 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL }
|
---|
517 | };
|
---|
518 |
|
---|
519 | static const REMPARMDESC g_aArgsCPUMSetChangedFlags[] =
|
---|
520 | {
|
---|
521 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
522 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
523 | };
|
---|
524 |
|
---|
525 | static const REMPARMDESC g_aArgsCPUMQueryGuestCtxPtr[] =
|
---|
526 | {
|
---|
527 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }
|
---|
528 | };
|
---|
529 | static const REMPARMDESC g_aArgsCSAMR3MonitorPage[] =
|
---|
530 | {
|
---|
531 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
532 | { REMPARMDESC_FLAGS_INT, sizeof(RTRCPTR), NULL },
|
---|
533 | { REMPARMDESC_FLAGS_INT, sizeof(CSAMTAG), NULL }
|
---|
534 | };
|
---|
535 | static const REMPARMDESC g_aArgsCSAMR3UnmonitorPage[] =
|
---|
536 | {
|
---|
537 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
538 | { REMPARMDESC_FLAGS_INT, sizeof(RTRCPTR), NULL },
|
---|
539 | { REMPARMDESC_FLAGS_INT, sizeof(CSAMTAG), NULL }
|
---|
540 | };
|
---|
541 |
|
---|
542 | static const REMPARMDESC g_aArgsCSAMR3RecordCallAddress[] =
|
---|
543 | {
|
---|
544 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
545 | { REMPARMDESC_FLAGS_INT, sizeof(RTRCPTR), NULL }
|
---|
546 | };
|
---|
547 |
|
---|
548 | #if defined(VBOX_WITH_DEBUGGER) && !(defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64)) /* the callbacks are problematic */
|
---|
549 | static const REMPARMDESC g_aArgsDBGCRegisterCommands[] =
|
---|
550 | {
|
---|
551 | { REMPARMDESC_FLAGS_INT, sizeof(PCDBGCCMD), NULL },
|
---|
552 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL }
|
---|
553 | };
|
---|
554 | #endif
|
---|
555 | static const REMPARMDESC g_aArgsDBGFR3DisasInstrEx[] =
|
---|
556 | {
|
---|
557 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
558 | { REMPARMDESC_FLAGS_INT, sizeof(VMCPUID), NULL },
|
---|
559 | { REMPARMDESC_FLAGS_INT, sizeof(RTSEL), NULL },
|
---|
560 | { REMPARMDESC_FLAGS_INT, sizeof(RTGCPTR), NULL },
|
---|
561 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
562 | { REMPARMDESC_FLAGS_INT, sizeof(char *), NULL },
|
---|
563 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
564 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL }
|
---|
565 | };
|
---|
566 | static const REMPARMDESC g_aArgsDBGFR3DisasInstrCurrentLogInternal[] =
|
---|
567 | {
|
---|
568 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
569 | { REMPARMDESC_FLAGS_INT, sizeof(char *), NULL }
|
---|
570 | };
|
---|
571 | static const REMPARMDESC g_aArgsDBGFR3Info[] =
|
---|
572 | {
|
---|
573 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
574 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
575 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
576 | { REMPARMDESC_FLAGS_INT, sizeof(PCDBGFINFOHLP), NULL }
|
---|
577 | };
|
---|
578 | static const REMPARMDESC g_aArgsDBGFR3SymbolByAddr[] =
|
---|
579 | {
|
---|
580 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
581 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINTPTR), NULL },
|
---|
582 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCINTPTR), NULL },
|
---|
583 | { REMPARMDESC_FLAGS_INT, sizeof(PDBGFSYMBOL), NULL }
|
---|
584 | };
|
---|
585 | static const REMPARMDESC g_aArgsDISInstr[] =
|
---|
586 | {
|
---|
587 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
588 | { REMPARMDESC_FLAGS_INT, sizeof(RTUINTPTR), NULL },
|
---|
589 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
590 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL },
|
---|
591 | { REMPARMDESC_FLAGS_INT, sizeof(char *), NULL }
|
---|
592 | };
|
---|
593 | static const REMPARMDESC g_aArgsEMR3FatalError[] =
|
---|
594 | {
|
---|
595 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
596 | { REMPARMDESC_FLAGS_INT, sizeof(int), NULL }
|
---|
597 | };
|
---|
598 | static const REMPARMDESC g_aArgsHWACCMR3CanExecuteGuest[] =
|
---|
599 | {
|
---|
600 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
601 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
602 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
603 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
604 | };
|
---|
605 | static const REMPARMDESC g_aArgsIOMIOPortRead[] =
|
---|
606 | {
|
---|
607 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
608 | { REMPARMDESC_FLAGS_INT, sizeof(RTIOPORT), NULL },
|
---|
609 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL },
|
---|
610 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
611 | };
|
---|
612 | static const REMPARMDESC g_aArgsIOMIOPortWrite[] =
|
---|
613 | {
|
---|
614 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
615 | { REMPARMDESC_FLAGS_INT, sizeof(RTIOPORT), NULL },
|
---|
616 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
617 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
618 | };
|
---|
619 | static const REMPARMDESC g_aArgsIOMMMIORead[] =
|
---|
620 | {
|
---|
621 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
622 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
623 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL },
|
---|
624 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
625 | };
|
---|
626 | static const REMPARMDESC g_aArgsIOMMMIOWrite[] =
|
---|
627 | {
|
---|
628 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
629 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
630 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
631 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
632 | };
|
---|
633 | static const REMPARMDESC g_aArgsMMR3HeapAlloc[] =
|
---|
634 | {
|
---|
635 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
636 | { REMPARMDESC_FLAGS_INT, sizeof(MMTAG), NULL },
|
---|
637 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
638 | };
|
---|
639 | static const REMPARMDESC g_aArgsMMR3HeapAllocZ[] =
|
---|
640 | {
|
---|
641 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
642 | { REMPARMDESC_FLAGS_INT, sizeof(MMTAG), NULL },
|
---|
643 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
644 | };
|
---|
645 | static const REMPARMDESC g_aArgsPATMIsPatchGCAddr[] =
|
---|
646 | {
|
---|
647 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
648 | { REMPARMDESC_FLAGS_INT, sizeof(RTRCPTR), NULL }
|
---|
649 | };
|
---|
650 | static const REMPARMDESC g_aArgsPATMR3QueryOpcode[] =
|
---|
651 | {
|
---|
652 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
653 | { REMPARMDESC_FLAGS_INT, sizeof(RTRCPTR), NULL },
|
---|
654 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL }
|
---|
655 | };
|
---|
656 | static const REMPARMDESC g_aArgsPATMR3QueryPatchMem[] =
|
---|
657 | {
|
---|
658 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
659 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL }
|
---|
660 | };
|
---|
661 | #ifdef VBOX_WITH_VMI
|
---|
662 | static const REMPARMDESC g_aArgsPARAVIsBiosCall[] =
|
---|
663 | {
|
---|
664 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
665 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR), NULL },
|
---|
666 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
667 | };
|
---|
668 | #endif
|
---|
669 | static const REMPARMDESC g_aArgsPDMApicGetBase[] =
|
---|
670 | {
|
---|
671 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
672 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t *), NULL }
|
---|
673 | };
|
---|
674 | static const REMPARMDESC g_aArgsPDMApicGetTPR[] =
|
---|
675 | {
|
---|
676 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
677 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL },
|
---|
678 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL }
|
---|
679 | };
|
---|
680 | static const REMPARMDESC g_aArgsPDMApicSetBase[] =
|
---|
681 | {
|
---|
682 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
683 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL }
|
---|
684 | };
|
---|
685 | static const REMPARMDESC g_aArgsPDMApicSetTPR[] =
|
---|
686 | {
|
---|
687 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
688 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL }
|
---|
689 | };
|
---|
690 | static const REMPARMDESC g_aArgsPDMApicWriteMSR[] =
|
---|
691 | {
|
---|
692 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
693 | { REMPARMDESC_FLAGS_INT, sizeof(VMCPUID), NULL },
|
---|
694 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
695 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL }
|
---|
696 | };
|
---|
697 | static const REMPARMDESC g_aArgsPDMApicReadMSR[] =
|
---|
698 | {
|
---|
699 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
700 | { REMPARMDESC_FLAGS_INT, sizeof(VMCPUID), NULL },
|
---|
701 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
702 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t *), NULL }
|
---|
703 | };
|
---|
704 | static const REMPARMDESC g_aArgsPDMGetInterrupt[] =
|
---|
705 | {
|
---|
706 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
707 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL }
|
---|
708 | };
|
---|
709 | static const REMPARMDESC g_aArgsPDMIsaSetIrq[] =
|
---|
710 | {
|
---|
711 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
712 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL },
|
---|
713 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL }
|
---|
714 | };
|
---|
715 | static const REMPARMDESC g_aArgsPGMGetGuestMode[] =
|
---|
716 | {
|
---|
717 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
718 | };
|
---|
719 | static const REMPARMDESC g_aArgsPGMGstGetPage[] =
|
---|
720 | {
|
---|
721 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
722 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR), NULL },
|
---|
723 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t *), NULL },
|
---|
724 | { REMPARMDESC_FLAGS_INT, sizeof(PRTGCPHYS), NULL }
|
---|
725 | };
|
---|
726 | static const REMPARMDESC g_aArgsPGMInvalidatePage[] =
|
---|
727 | {
|
---|
728 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
729 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR), NULL }
|
---|
730 | };
|
---|
731 | static const REMPARMDESC g_aArgsPGMR3PhysTlbGCPhys2Ptr[] =
|
---|
732 | {
|
---|
733 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
734 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
735 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL },
|
---|
736 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL }
|
---|
737 | };
|
---|
738 | static const REMPARMDESC g_aArgsPGM3PhysGrowRange[] =
|
---|
739 | {
|
---|
740 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
741 | { REMPARMDESC_FLAGS_INT, sizeof(PCRTGCPHYS), NULL }
|
---|
742 | };
|
---|
743 | static const REMPARMDESC g_aArgsPGMPhysIsGCPhysValid[] =
|
---|
744 | {
|
---|
745 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
746 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL }
|
---|
747 | };
|
---|
748 | static const REMPARMDESC g_aArgsPGMPhysRead[] =
|
---|
749 | {
|
---|
750 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
751 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
752 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
753 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL }
|
---|
754 | };
|
---|
755 | static const REMPARMDESC g_aArgsPGMPhysSimpleReadGCPtr[] =
|
---|
756 | {
|
---|
757 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
758 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
759 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR), NULL },
|
---|
760 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL }
|
---|
761 | };
|
---|
762 | static const REMPARMDESC g_aArgsPGMPhysWrite[] =
|
---|
763 | {
|
---|
764 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
765 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
766 | { REMPARMDESC_FLAGS_INT, sizeof(const void *), NULL },
|
---|
767 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL }
|
---|
768 | };
|
---|
769 | static const REMPARMDESC g_aArgsPGMChangeMode[] =
|
---|
770 | {
|
---|
771 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
772 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL },
|
---|
773 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL },
|
---|
774 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL }
|
---|
775 | };
|
---|
776 | static const REMPARMDESC g_aArgsPGMFlushTLB[] =
|
---|
777 | {
|
---|
778 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
779 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL },
|
---|
780 | { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }
|
---|
781 | };
|
---|
782 | static const REMPARMDESC g_aArgsPGMR3PhysReadUxx[] =
|
---|
783 | {
|
---|
784 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
785 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL }
|
---|
786 | };
|
---|
787 | static const REMPARMDESC g_aArgsPGMR3PhysWriteU8[] =
|
---|
788 | {
|
---|
789 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
790 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
791 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL }
|
---|
792 | };
|
---|
793 | static const REMPARMDESC g_aArgsPGMR3PhysWriteU16[] =
|
---|
794 | {
|
---|
795 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
796 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
797 | { REMPARMDESC_FLAGS_INT, sizeof(uint16_t), NULL }
|
---|
798 | };
|
---|
799 | static const REMPARMDESC g_aArgsPGMR3PhysWriteU32[] =
|
---|
800 | {
|
---|
801 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
802 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
803 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }
|
---|
804 | };
|
---|
805 | static const REMPARMDESC g_aArgsPGMR3PhysWriteU64[] =
|
---|
806 | {
|
---|
807 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
808 | { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL },
|
---|
809 | { REMPARMDESC_FLAGS_INT, sizeof(uint64_t), NULL }
|
---|
810 | };
|
---|
811 | static const REMPARMDESC g_aArgsRTMemRealloc[] =
|
---|
812 | {
|
---|
813 | { REMPARMDESC_FLAGS_INT, sizeof(void*), NULL },
|
---|
814 | { REMPARMDESC_FLAGS_INT, sizeof(size_t) }
|
---|
815 | };
|
---|
816 | static const REMPARMDESC g_aArgsSSMR3GetGCPtr[] =
|
---|
817 | {
|
---|
818 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
819 | { REMPARMDESC_FLAGS_INT, sizeof(PRTGCPTR), NULL }
|
---|
820 | };
|
---|
821 | static const REMPARMDESC g_aArgsSSMR3GetMem[] =
|
---|
822 | {
|
---|
823 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
824 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
825 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL }
|
---|
826 | };
|
---|
827 | static const REMPARMDESC g_aArgsSSMR3GetU32[] =
|
---|
828 | {
|
---|
829 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
830 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t *), NULL }
|
---|
831 | };
|
---|
832 | static const REMPARMDESC g_aArgsSSMR3GetUInt[] =
|
---|
833 | {
|
---|
834 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
835 | { REMPARMDESC_FLAGS_INT, sizeof(PRTUINT), NULL }
|
---|
836 | };
|
---|
837 | static const REMPARMDESC g_aArgsSSMR3PutGCPtr[] =
|
---|
838 | {
|
---|
839 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
840 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPTR), NULL }
|
---|
841 | };
|
---|
842 | static const REMPARMDESC g_aArgsSSMR3PutMem[] =
|
---|
843 | {
|
---|
844 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
845 | { REMPARMDESC_FLAGS_INT, sizeof(const void *), NULL },
|
---|
846 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL }
|
---|
847 | };
|
---|
848 | static const REMPARMDESC g_aArgsSSMR3PutU32[] =
|
---|
849 | {
|
---|
850 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
851 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
852 | };
|
---|
853 | static const REMPARMDESC g_aArgsSSMR3PutUInt[] =
|
---|
854 | {
|
---|
855 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
856 | { REMPARMDESC_FLAGS_INT, sizeof(RTUINT), NULL },
|
---|
857 | };
|
---|
858 |
|
---|
859 | static const REMPARMDESC g_aArgsSSMIntCallback[] =
|
---|
860 | {
|
---|
861 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
862 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
863 | };
|
---|
864 | static REMFNDESC g_SSMIntCallback =
|
---|
865 | {
|
---|
866 | "SSMIntCallback", NULL, &g_aArgsSSMIntCallback[0], RT_ELEMENTS(g_aArgsSSMIntCallback), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL
|
---|
867 | };
|
---|
868 |
|
---|
869 | static const REMPARMDESC g_aArgsSSMIntLoadExecCallback[] =
|
---|
870 | {
|
---|
871 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
872 | { REMPARMDESC_FLAGS_INT, sizeof(PSSMHANDLE), NULL },
|
---|
873 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
874 | };
|
---|
875 | static REMFNDESC g_SSMIntLoadExecCallback =
|
---|
876 | {
|
---|
877 | "SSMIntLoadExecCallback", NULL, &g_aArgsSSMIntLoadExecCallback[0], RT_ELEMENTS(g_aArgsSSMIntLoadExecCallback), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL
|
---|
878 | };
|
---|
879 | static const REMPARMDESC g_aArgsSSMR3RegisterInternal[] =
|
---|
880 | {
|
---|
881 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
882 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
883 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
884 | { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL },
|
---|
885 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL },
|
---|
886 | { REMPARMDESC_FLAGS_PFN, sizeof(PFNSSMINTSAVEPREP), &g_SSMIntCallback },
|
---|
887 | { REMPARMDESC_FLAGS_PFN, sizeof(PFNSSMINTSAVEEXEC), &g_SSMIntCallback },
|
---|
888 | { REMPARMDESC_FLAGS_PFN, sizeof(PFNSSMINTSAVEDONE), &g_SSMIntCallback },
|
---|
889 | { REMPARMDESC_FLAGS_PFN, sizeof(PFNSSMINTLOADPREP), &g_SSMIntCallback },
|
---|
890 | { REMPARMDESC_FLAGS_PFN, sizeof(PFNSSMINTLOADEXEC), &g_SSMIntLoadExecCallback },
|
---|
891 | { REMPARMDESC_FLAGS_PFN, sizeof(PFNSSMINTLOADDONE), &g_SSMIntCallback },
|
---|
892 | };
|
---|
893 |
|
---|
894 | static const REMPARMDESC g_aArgsSTAMR3Register[] =
|
---|
895 | {
|
---|
896 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
897 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
898 | { REMPARMDESC_FLAGS_INT, sizeof(STAMTYPE), NULL },
|
---|
899 | { REMPARMDESC_FLAGS_INT, sizeof(STAMVISIBILITY), NULL },
|
---|
900 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
901 | { REMPARMDESC_FLAGS_INT, sizeof(STAMUNIT), NULL },
|
---|
902 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL }
|
---|
903 | };
|
---|
904 | static const REMPARMDESC g_aArgsSTAMR3Deregister[] =
|
---|
905 | {
|
---|
906 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
907 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
908 | };
|
---|
909 | static const REMPARMDESC g_aArgsTRPMAssertTrap[] =
|
---|
910 | {
|
---|
911 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
912 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL },
|
---|
913 | { REMPARMDESC_FLAGS_INT, sizeof(TRPMEVENT), NULL }
|
---|
914 | };
|
---|
915 | static const REMPARMDESC g_aArgsTRPMQueryTrap[] =
|
---|
916 | {
|
---|
917 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
918 | { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL },
|
---|
919 | { REMPARMDESC_FLAGS_INT, sizeof(TRPMEVENT *), NULL }
|
---|
920 | };
|
---|
921 | static const REMPARMDESC g_aArgsTRPMSetErrorCode[] =
|
---|
922 | {
|
---|
923 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
924 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINT), NULL }
|
---|
925 | };
|
---|
926 | static const REMPARMDESC g_aArgsTRPMSetFaultAddress[] =
|
---|
927 | {
|
---|
928 | { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL },
|
---|
929 | { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINT), NULL }
|
---|
930 | };
|
---|
931 | static const REMPARMDESC g_aArgsVMR3ReqCall[] =
|
---|
932 | {
|
---|
933 | { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL },
|
---|
934 | { REMPARMDESC_FLAGS_INT, sizeof(VMCPUID), NULL },
|
---|
935 | { REMPARMDESC_FLAGS_INT, sizeof(PVMREQ *), NULL },
|
---|
936 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
937 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
938 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
939 | { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
|
---|
940 | };
|
---|
941 | static const REMPARMDESC g_aArgsVMR3ReqFree[] =
|
---|
942 | {
|
---|
943 | { REMPARMDESC_FLAGS_INT, sizeof(PVMREQ), NULL }
|
---|
944 | };
|
---|
945 |
|
---|
946 | /* IPRT args */
|
---|
947 | static const REMPARMDESC g_aArgsAssertMsg1[] =
|
---|
948 | {
|
---|
949 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
950 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
951 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
952 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL }
|
---|
953 | };
|
---|
954 | static const REMPARMDESC g_aArgsAssertMsg2[] =
|
---|
955 | {
|
---|
956 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
957 | { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
|
---|
958 | };
|
---|
959 | static const REMPARMDESC g_aArgsRTLogFlags[] =
|
---|
960 | {
|
---|
961 | { REMPARMDESC_FLAGS_INT, sizeof(PRTLOGGER), NULL },
|
---|
962 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL }
|
---|
963 | };
|
---|
964 | static const REMPARMDESC g_aArgsRTLogFlush[] =
|
---|
965 | {
|
---|
966 | { REMPARMDESC_FLAGS_INT, sizeof(PRTLOGGER), NULL }
|
---|
967 | };
|
---|
968 | static const REMPARMDESC g_aArgsRTLogLoggerEx[] =
|
---|
969 | {
|
---|
970 | { REMPARMDESC_FLAGS_INT, sizeof(PRTLOGGER), NULL },
|
---|
971 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
972 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
973 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
974 | { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
|
---|
975 | };
|
---|
976 | static const REMPARMDESC g_aArgsRTLogLoggerExV[] =
|
---|
977 | {
|
---|
978 | { REMPARMDESC_FLAGS_INT, sizeof(PRTLOGGER), NULL },
|
---|
979 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
980 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL },
|
---|
981 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
982 | { REMPARMDESC_FLAGS_VALIST, 0 }
|
---|
983 | };
|
---|
984 | static const REMPARMDESC g_aArgsRTLogPrintf[] =
|
---|
985 | {
|
---|
986 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
987 | { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
|
---|
988 | };
|
---|
989 | static const REMPARMDESC g_aArgsRTMemProtect[] =
|
---|
990 | {
|
---|
991 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
992 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL },
|
---|
993 | { REMPARMDESC_FLAGS_INT, sizeof(unsigned), NULL }
|
---|
994 | };
|
---|
995 | static const REMPARMDESC g_aArgsRTStrPrintf[] =
|
---|
996 | {
|
---|
997 | { REMPARMDESC_FLAGS_INT, sizeof(char *), NULL },
|
---|
998 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL },
|
---|
999 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
1000 | { REMPARMDESC_FLAGS_ELLIPSIS, 0 }
|
---|
1001 | };
|
---|
1002 | static const REMPARMDESC g_aArgsRTStrPrintfV[] =
|
---|
1003 | {
|
---|
1004 | { REMPARMDESC_FLAGS_INT, sizeof(char *), NULL },
|
---|
1005 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL },
|
---|
1006 | { REMPARMDESC_FLAGS_INT, sizeof(const char *), NULL },
|
---|
1007 | { REMPARMDESC_FLAGS_VALIST, 0 }
|
---|
1008 | };
|
---|
1009 | static const REMPARMDESC g_aArgsThread[] =
|
---|
1010 | {
|
---|
1011 | { REMPARMDESC_FLAGS_INT, sizeof(RTTHREAD), NULL }
|
---|
1012 | };
|
---|
1013 |
|
---|
1014 |
|
---|
1015 | /* CRT args */
|
---|
1016 | static const REMPARMDESC g_aArgsmemcpy[] =
|
---|
1017 | {
|
---|
1018 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
1019 | { REMPARMDESC_FLAGS_INT, sizeof(const void *), NULL },
|
---|
1020 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL }
|
---|
1021 | };
|
---|
1022 | static const REMPARMDESC g_aArgsmemset[] =
|
---|
1023 | {
|
---|
1024 | { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL },
|
---|
1025 | { REMPARMDESC_FLAGS_INT, sizeof(int), NULL },
|
---|
1026 | { REMPARMDESC_FLAGS_INT, sizeof(size_t), NULL }
|
---|
1027 | };
|
---|
1028 |
|
---|
1029 | /** @} */
|
---|
1030 |
|
---|
1031 | /**
|
---|
1032 | * Descriptors for the exported functions.
|
---|
1033 | */
|
---|
1034 | static const REMFNDESC g_aExports[] =
|
---|
1035 | { /* pszName, (void *)pv, pParams, cParams, fFlags, cb, pvWrapper. */
|
---|
1036 | { "REMR3Init", (void *)&pfnREMR3Init, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1037 | { "REMR3InitFinalize", (void *)&pfnREMR3InitFinalize, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1038 | { "REMR3Term", (void *)&pfnREMR3Term, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1039 | { "REMR3Reset", (void *)&pfnREMR3Reset, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1040 | { "REMR3Step", (void *)&pfnREMR3Step, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1041 | { "REMR3BreakpointSet", (void *)&pfnREMR3BreakpointSet, &g_aArgsBreakpoint[0], RT_ELEMENTS(g_aArgsBreakpoint), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1042 | { "REMR3BreakpointClear", (void *)&pfnREMR3BreakpointClear, &g_aArgsBreakpoint[0], RT_ELEMENTS(g_aArgsBreakpoint), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1043 | { "REMR3EmulateInstruction", (void *)&pfnREMR3EmulateInstruction, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1044 | { "REMR3Run", (void *)&pfnREMR3Run, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1045 | { "REMR3State", (void *)&pfnREMR3State, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1046 | { "REMR3StateBack", (void *)&pfnREMR3StateBack, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1047 | { "REMR3StateUpdate", (void *)&pfnREMR3StateUpdate, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1048 | { "REMR3A20Set", (void *)&pfnREMR3A20Set, &g_aArgsA20Set[0], RT_ELEMENTS(g_aArgsA20Set), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1049 | { "REMR3ReplayHandlerNotifications", (void *)&pfnREMR3ReplayHandlerNotifications, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1050 | { "REMR3NotifyPhysRamRegister", (void *)&pfnREMR3NotifyPhysRamRegister, &g_aArgsNotifyPhysRamRegister[0], RT_ELEMENTS(g_aArgsNotifyPhysRamRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1051 | { "REMR3NotifyPhysRamDeregister", (void *)&pfnREMR3NotifyPhysRamDeregister, &g_aArgsNotifyPhysRamDeregister[0], RT_ELEMENTS(g_aArgsNotifyPhysRamDeregister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1052 | { "REMR3NotifyPhysRomRegister", (void *)&pfnREMR3NotifyPhysRomRegister, &g_aArgsNotifyPhysRomRegister[0], RT_ELEMENTS(g_aArgsNotifyPhysRomRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1053 | { "REMR3NotifyHandlerPhysicalModify", (void *)&pfnREMR3NotifyHandlerPhysicalModify, &g_aArgsNotifyHandlerPhysicalModify[0], RT_ELEMENTS(g_aArgsNotifyHandlerPhysicalModify), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1054 | { "REMR3NotifyHandlerPhysicalRegister", (void *)&pfnREMR3NotifyHandlerPhysicalRegister, &g_aArgsNotifyHandlerPhysicalRegister[0], RT_ELEMENTS(g_aArgsNotifyHandlerPhysicalRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1055 | { "REMR3NotifyHandlerPhysicalDeregister", (void *)&pfnREMR3NotifyHandlerPhysicalDeregister, &g_aArgsNotifyHandlerPhysicalDeregister[0], RT_ELEMENTS(g_aArgsNotifyHandlerPhysicalDeregister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1056 | { "REMR3NotifyInterruptSet", (void *)&pfnREMR3NotifyInterruptSet, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1057 | { "REMR3NotifyInterruptClear", (void *)&pfnREMR3NotifyInterruptClear, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1058 | { "REMR3NotifyTimerPending", (void *)&pfnREMR3NotifyTimerPending, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1059 | { "REMR3NotifyDmaPending", (void *)&pfnREMR3NotifyDmaPending, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1060 | { "REMR3NotifyQueuePending", (void *)&pfnREMR3NotifyQueuePending, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1061 | { "REMR3NotifyFF", (void *)&pfnREMR3NotifyFF, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1062 | { "REMR3NotifyCodePageChanged", (void *)&pfnREMR3NotifyCodePageChanged, &g_aArgsNotifyCodePageChanged[0], RT_ELEMENTS(g_aArgsNotifyCodePageChanged), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1063 | { "REMR3NotifyPendingInterrupt", (void *)&pfnREMR3NotifyPendingInterrupt, &g_aArgsNotifyPendingInterrupt[0], RT_ELEMENTS(g_aArgsNotifyPendingInterrupt), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1064 | { "REMR3QueryPendingInterrupt", (void *)&pfnREMR3QueryPendingInterrupt, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1065 | { "REMR3DisasEnableStepping", (void *)&pfnREMR3DisasEnableStepping, &g_aArgsDisasEnableStepping[0], RT_ELEMENTS(g_aArgsDisasEnableStepping), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1066 | { "REMR3IsPageAccessHandled", (void *)&pfnREMR3IsPageAccessHandled, &g_aArgsIsPageAccessHandled[0], RT_ELEMENTS(g_aArgsIsPageAccessHandled), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }
|
---|
1067 | };
|
---|
1068 |
|
---|
1069 |
|
---|
1070 | /**
|
---|
1071 | * Descriptors for the functions imported from VBoxVMM.
|
---|
1072 | */
|
---|
1073 | static REMFNDESC g_aVMMImports[] =
|
---|
1074 | {
|
---|
1075 | { "CPUMAreHiddenSelRegsValid", (void *)(uintptr_t)&CPUMAreHiddenSelRegsValid, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1076 | { "CPUMGetAndClearChangedFlagsREM", (void *)(uintptr_t)&CPUMGetAndClearChangedFlagsREM, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(unsigned), NULL },
|
---|
1077 | { "CPUMSetChangedFlags", (void *)(uintptr_t)&CPUMSetChangedFlags, &g_aArgsCPUMSetChangedFlags[0], RT_ELEMENTS(g_aArgsCPUMSetChangedFlags), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1078 | { "CPUMGetGuestCPL", (void *)(uintptr_t)&CPUMGetGuestCPL, &g_aArgsCPUMGetGuestCpl[0], RT_ELEMENTS(g_aArgsCPUMGetGuestCpl), REMFNDESC_FLAGS_RET_INT, sizeof(unsigned), NULL },
|
---|
1079 | { "CPUMGetGuestMsr", (void *)(uintptr_t)&CPUMGetGuestMsr, &g_aArgsCPUMGetGuestMsr[0], RT_ELEMENTS(g_aArgsCPUMGetGuestMsr), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t), NULL },
|
---|
1080 | { "CPUMSetGuestMsr", (void *)(uintptr_t)&CPUMSetGuestMsr, &g_aArgsCPUMSetGuestMsr[0], RT_ELEMENTS(g_aArgsCPUMSetGuestMsr), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1081 | { "CPUMGetGuestCpuId", (void *)(uintptr_t)&CPUMGetGuestCpuId, &g_aArgsCPUMGetGuestCpuId[0], RT_ELEMENTS(g_aArgsCPUMGetGuestCpuId), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1082 | { "CPUMGetGuestEAX", (void *)(uintptr_t)&CPUMGetGuestEAX, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1083 | { "CPUMGetGuestEBP", (void *)(uintptr_t)&CPUMGetGuestEBP, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1084 | { "CPUMGetGuestEBX", (void *)(uintptr_t)&CPUMGetGuestEBX, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1085 | { "CPUMGetGuestECX", (void *)(uintptr_t)&CPUMGetGuestECX, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1086 | { "CPUMGetGuestEDI", (void *)(uintptr_t)&CPUMGetGuestEDI, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1087 | { "CPUMGetGuestEDX", (void *)(uintptr_t)&CPUMGetGuestEDX, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1088 | { "CPUMGetGuestEIP", (void *)(uintptr_t)&CPUMGetGuestEIP, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1089 | { "CPUMGetGuestESI", (void *)(uintptr_t)&CPUMGetGuestESI, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1090 | { "CPUMGetGuestESP", (void *)(uintptr_t)&CPUMGetGuestESP, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1091 | { "CPUMGetGuestCS", (void *)(uintptr_t)&CPUMGetGuestCS, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(RTSEL), NULL },
|
---|
1092 | { "CPUMGetGuestSS", (void *)(uintptr_t)&CPUMGetGuestSS, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(RTSEL), NULL },
|
---|
1093 | { "CPUMQueryGuestCtxPtr", (void *)(uintptr_t)&CPUMQueryGuestCtxPtr, &g_aArgsCPUMQueryGuestCtxPtr[0], RT_ELEMENTS(g_aArgsCPUMQueryGuestCtxPtr), REMFNDESC_FLAGS_RET_INT, sizeof(PCPUMCTX), NULL },
|
---|
1094 | { "CSAMR3MonitorPage", (void *)(uintptr_t)&CSAMR3MonitorPage, &g_aArgsCSAMR3MonitorPage[0], RT_ELEMENTS(g_aArgsCSAMR3MonitorPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1095 | { "CSAMR3UnmonitorPage", (void *)(uintptr_t)&CSAMR3UnmonitorPage, &g_aArgsCSAMR3UnmonitorPage[0], RT_ELEMENTS(g_aArgsCSAMR3UnmonitorPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1096 | { "CSAMR3RecordCallAddress", (void *)(uintptr_t)&CSAMR3RecordCallAddress, &g_aArgsCSAMR3RecordCallAddress[0], RT_ELEMENTS(g_aArgsCSAMR3RecordCallAddress), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1097 | #if defined(VBOX_WITH_DEBUGGER) && !(defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64)) /* the callbacks are problematic */
|
---|
1098 | { "DBGCRegisterCommands", (void *)(uintptr_t)&DBGCRegisterCommands, &g_aArgsDBGCRegisterCommands[0], RT_ELEMENTS(g_aArgsDBGCRegisterCommands), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1099 | #endif
|
---|
1100 | { "DBGFR3DisasInstrEx", (void *)(uintptr_t)&DBGFR3DisasInstrEx, &g_aArgsDBGFR3DisasInstrEx[0], RT_ELEMENTS(g_aArgsDBGFR3DisasInstrEx), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1101 | { "DBGFR3DisasInstrCurrentLogInternal", (void *)(uintptr_t)&DBGFR3DisasInstrCurrentLogInternal, &g_aArgsDBGFR3DisasInstrCurrentLogInternal[0], RT_ELEMENTS(g_aArgsDBGFR3DisasInstrCurrentLogInternal),REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1102 | { "DBGFR3Info", (void *)(uintptr_t)&DBGFR3Info, &g_aArgsDBGFR3Info[0], RT_ELEMENTS(g_aArgsDBGFR3Info), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1103 | { "DBGFR3InfoLogRelHlp", (void *)(uintptr_t)&DBGFR3InfoLogRelHlp, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1104 | { "DBGFR3SymbolByAddr", (void *)(uintptr_t)&DBGFR3SymbolByAddr, &g_aArgsDBGFR3SymbolByAddr[0], RT_ELEMENTS(g_aArgsDBGFR3SymbolByAddr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1105 | { "DISInstr", (void *)(uintptr_t)&DISInstr, &g_aArgsDISInstr[0], RT_ELEMENTS(g_aArgsDISInstr), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1106 | { "EMR3FatalError", (void *)(uintptr_t)&EMR3FatalError, &g_aArgsEMR3FatalError[0], RT_ELEMENTS(g_aArgsEMR3FatalError), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1107 | { "EMRemLock", (void *)(uintptr_t)&EMRemLock, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1108 | { "EMRemUnlock", (void *)(uintptr_t)&EMRemUnlock, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1109 | { "EMRemIsLockOwner", (void *)(uintptr_t)&EMRemIsLockOwner, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, sizeof(bool), NULL },
|
---|
1110 | { "HWACCMR3CanExecuteGuest", (void *)(uintptr_t)&HWACCMR3CanExecuteGuest, &g_aArgsHWACCMR3CanExecuteGuest[0], RT_ELEMENTS(g_aArgsHWACCMR3CanExecuteGuest), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1111 | { "IOMIOPortRead", (void *)(uintptr_t)&IOMIOPortRead, &g_aArgsIOMIOPortRead[0], RT_ELEMENTS(g_aArgsIOMIOPortRead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1112 | { "IOMIOPortWrite", (void *)(uintptr_t)&IOMIOPortWrite, &g_aArgsIOMIOPortWrite[0], RT_ELEMENTS(g_aArgsIOMIOPortWrite), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1113 | { "IOMMMIORead", (void *)(uintptr_t)&IOMMMIORead, &g_aArgsIOMMMIORead[0], RT_ELEMENTS(g_aArgsIOMMMIORead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1114 | { "IOMMMIOWrite", (void *)(uintptr_t)&IOMMMIOWrite, &g_aArgsIOMMMIOWrite[0], RT_ELEMENTS(g_aArgsIOMMMIOWrite), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1115 | { "MMR3HeapAlloc", (void *)(uintptr_t)&MMR3HeapAlloc, &g_aArgsMMR3HeapAlloc[0], RT_ELEMENTS(g_aArgsMMR3HeapAlloc), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1116 | { "MMR3HeapAllocZ", (void *)(uintptr_t)&MMR3HeapAllocZ, &g_aArgsMMR3HeapAllocZ[0], RT_ELEMENTS(g_aArgsMMR3HeapAllocZ), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1117 | { "MMR3PhysGetRamSize", (void *)(uintptr_t)&MMR3PhysGetRamSize, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t), NULL },
|
---|
1118 | { "PATMIsPatchGCAddr", (void *)(uintptr_t)&PATMIsPatchGCAddr, &g_aArgsPATMIsPatchGCAddr[0], RT_ELEMENTS(g_aArgsPATMIsPatchGCAddr), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1119 | { "PATMR3QueryOpcode", (void *)(uintptr_t)&PATMR3QueryOpcode, &g_aArgsPATMR3QueryOpcode[0], RT_ELEMENTS(g_aArgsPATMR3QueryOpcode), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1120 | { "PATMR3QueryPatchMemGC", (void *)(uintptr_t)&PATMR3QueryPatchMemGC, &g_aArgsPATMR3QueryPatchMem[0], RT_ELEMENTS(g_aArgsPATMR3QueryPatchMem), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCPTR), NULL },
|
---|
1121 | { "PATMR3QueryPatchMemHC", (void *)(uintptr_t)&PATMR3QueryPatchMemHC, &g_aArgsPATMR3QueryPatchMem[0], RT_ELEMENTS(g_aArgsPATMR3QueryPatchMem), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1122 | #ifdef VBOX_WITH_VMI
|
---|
1123 | { "PARAVIsBiosCall", (void *)(uintptr_t)&PARAVIsBiosCall, &g_aArgsPARAVIsBiosCall[0], RT_ELEMENTS(g_aArgsPARAVIsBiosCall), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1124 | #endif
|
---|
1125 | { "PDMApicGetBase", (void *)(uintptr_t)&PDMApicGetBase, &g_aArgsPDMApicGetBase[0], RT_ELEMENTS(g_aArgsPDMApicGetBase), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1126 | { "PDMApicGetTPR", (void *)(uintptr_t)&PDMApicGetTPR, &g_aArgsPDMApicGetTPR[0], RT_ELEMENTS(g_aArgsPDMApicGetTPR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1127 | { "PDMApicSetBase", (void *)(uintptr_t)&PDMApicSetBase, &g_aArgsPDMApicSetBase[0], RT_ELEMENTS(g_aArgsPDMApicSetBase), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1128 | { "PDMApicSetTPR", (void *)(uintptr_t)&PDMApicSetTPR, &g_aArgsPDMApicSetTPR[0], RT_ELEMENTS(g_aArgsPDMApicSetTPR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1129 | { "PDMApicWriteMSR", (void *)(uintptr_t)&PDMApicWriteMSR, &g_aArgsPDMApicWriteMSR[0], RT_ELEMENTS(g_aArgsPDMApicWriteMSR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1130 | { "PDMApicReadMSR", (void *)(uintptr_t)&PDMApicReadMSR, &g_aArgsPDMApicReadMSR[0], RT_ELEMENTS(g_aArgsPDMApicReadMSR), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1131 | { "PDMR3DmaRun", (void *)(uintptr_t)&PDMR3DmaRun, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1132 | { "PDMGetInterrupt", (void *)(uintptr_t)&PDMGetInterrupt, &g_aArgsPDMGetInterrupt[0], RT_ELEMENTS(g_aArgsPDMGetInterrupt), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1133 | { "PDMIsaSetIrq", (void *)(uintptr_t)&PDMIsaSetIrq, &g_aArgsPDMIsaSetIrq[0], RT_ELEMENTS(g_aArgsPDMIsaSetIrq), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1134 | { "PGMGetGuestMode", (void *)(uintptr_t)&PGMGetGuestMode, &g_aArgsPGMGetGuestMode[0], RT_ELEMENTS(g_aArgsPGMGetGuestMode), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1135 | { "PGMGstGetPage", (void *)(uintptr_t)&PGMGstGetPage, &g_aArgsPGMGstGetPage[0], RT_ELEMENTS(g_aArgsPGMGstGetPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1136 | { "PGMInvalidatePage", (void *)(uintptr_t)&PGMInvalidatePage, &g_aArgsPGMInvalidatePage[0], RT_ELEMENTS(g_aArgsPGMInvalidatePage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1137 | { "PGMPhysIsGCPhysValid", (void *)(uintptr_t)&PGMPhysIsGCPhysValid, &g_aArgsPGMPhysIsGCPhysValid[0], RT_ELEMENTS(g_aArgsPGMPhysIsGCPhysValid), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1138 | { "PGMPhysIsA20Enabled", (void *)(uintptr_t)&PGMPhysIsA20Enabled, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1139 | { "PGMPhysRead", (void *)(uintptr_t)&PGMPhysRead, &g_aArgsPGMPhysRead[0], RT_ELEMENTS(g_aArgsPGMPhysRead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1140 | { "PGMPhysSimpleReadGCPtr", (void *)(uintptr_t)&PGMPhysSimpleReadGCPtr, &g_aArgsPGMPhysSimpleReadGCPtr[0], RT_ELEMENTS(g_aArgsPGMPhysSimpleReadGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1141 | { "PGMPhysWrite", (void *)(uintptr_t)&PGMPhysWrite, &g_aArgsPGMPhysWrite[0], RT_ELEMENTS(g_aArgsPGMPhysWrite), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1142 | { "PGMChangeMode", (void *)(uintptr_t)&PGMChangeMode, &g_aArgsPGMChangeMode[0], RT_ELEMENTS(g_aArgsPGMChangeMode), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1143 | { "PGMFlushTLB", (void *)(uintptr_t)&PGMFlushTLB, &g_aArgsPGMFlushTLB[0], RT_ELEMENTS(g_aArgsPGMFlushTLB), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1144 | { "PGMR3PhysReadU8", (void *)(uintptr_t)&PGMR3PhysReadU8, &g_aArgsPGMR3PhysReadUxx[0], RT_ELEMENTS(g_aArgsPGMR3PhysReadUxx), REMFNDESC_FLAGS_RET_INT, sizeof(uint8_t), NULL },
|
---|
1145 | { "PGMR3PhysReadU16", (void *)(uintptr_t)&PGMR3PhysReadU16, &g_aArgsPGMR3PhysReadUxx[0], RT_ELEMENTS(g_aArgsPGMR3PhysReadUxx), REMFNDESC_FLAGS_RET_INT, sizeof(uint16_t), NULL },
|
---|
1146 | { "PGMR3PhysReadU32", (void *)(uintptr_t)&PGMR3PhysReadU32, &g_aArgsPGMR3PhysReadUxx[0], RT_ELEMENTS(g_aArgsPGMR3PhysReadUxx), REMFNDESC_FLAGS_RET_INT, sizeof(uint32_t), NULL },
|
---|
1147 | { "PGMR3PhysReadU64", (void *)(uintptr_t)&PGMR3PhysReadU64, &g_aArgsPGMR3PhysReadUxx[0], RT_ELEMENTS(g_aArgsPGMR3PhysReadUxx), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t), NULL },
|
---|
1148 | { "PGMR3PhysWriteU8", (void *)(uintptr_t)&PGMR3PhysWriteU8, &g_aArgsPGMR3PhysWriteU8[0], RT_ELEMENTS(g_aArgsPGMR3PhysWriteU8), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1149 | { "PGMR3PhysWriteU16", (void *)(uintptr_t)&PGMR3PhysWriteU16, &g_aArgsPGMR3PhysWriteU16[0], RT_ELEMENTS(g_aArgsPGMR3PhysWriteU16), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1150 | { "PGMR3PhysWriteU32", (void *)(uintptr_t)&PGMR3PhysWriteU32, &g_aArgsPGMR3PhysWriteU32[0], RT_ELEMENTS(g_aArgsPGMR3PhysWriteU32), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1151 | { "PGMR3PhysWriteU64", (void *)(uintptr_t)&PGMR3PhysWriteU64, &g_aArgsPGMR3PhysWriteU64[0], RT_ELEMENTS(g_aArgsPGMR3PhysWriteU32), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1152 | { "PGMR3PhysTlbGCPhys2Ptr", (void *)(uintptr_t)&PGMR3PhysTlbGCPhys2Ptr, &g_aArgsPGMR3PhysTlbGCPhys2Ptr[0], RT_ELEMENTS(g_aArgsPGMR3PhysTlbGCPhys2Ptr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1153 | { "PGMIsLockOwner", (void *)(uintptr_t)&PGMIsLockOwner, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1154 | { "SSMR3GetGCPtr", (void *)(uintptr_t)&SSMR3GetGCPtr, &g_aArgsSSMR3GetGCPtr[0], RT_ELEMENTS(g_aArgsSSMR3GetGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1155 | { "SSMR3GetMem", (void *)(uintptr_t)&SSMR3GetMem, &g_aArgsSSMR3GetMem[0], RT_ELEMENTS(g_aArgsSSMR3GetMem), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1156 | { "SSMR3GetU32", (void *)(uintptr_t)&SSMR3GetU32, &g_aArgsSSMR3GetU32[0], RT_ELEMENTS(g_aArgsSSMR3GetU32), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1157 | { "SSMR3GetUInt", (void *)(uintptr_t)&SSMR3GetUInt, &g_aArgsSSMR3GetUInt[0], RT_ELEMENTS(g_aArgsSSMR3GetUInt), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1158 | { "SSMR3PutGCPtr", (void *)(uintptr_t)&SSMR3PutGCPtr, &g_aArgsSSMR3PutGCPtr[0], RT_ELEMENTS(g_aArgsSSMR3PutGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1159 | { "SSMR3PutMem", (void *)(uintptr_t)&SSMR3PutMem, &g_aArgsSSMR3PutMem[0], RT_ELEMENTS(g_aArgsSSMR3PutMem), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1160 | { "SSMR3PutU32", (void *)(uintptr_t)&SSMR3PutU32, &g_aArgsSSMR3PutU32[0], RT_ELEMENTS(g_aArgsSSMR3PutU32), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1161 | { "SSMR3PutUInt", (void *)(uintptr_t)&SSMR3PutUInt, &g_aArgsSSMR3PutUInt[0], RT_ELEMENTS(g_aArgsSSMR3PutUInt), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1162 | { "SSMR3RegisterInternal", (void *)(uintptr_t)&SSMR3RegisterInternal, &g_aArgsSSMR3RegisterInternal[0], RT_ELEMENTS(g_aArgsSSMR3RegisterInternal), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1163 | { "STAMR3Register", (void *)(uintptr_t)&STAMR3Register, &g_aArgsSTAMR3Register[0], RT_ELEMENTS(g_aArgsSTAMR3Register), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1164 | { "STAMR3Deregister", (void *)(uintptr_t)&STAMR3Deregister, &g_aArgsSTAMR3Deregister[0], RT_ELEMENTS(g_aArgsSTAMR3Deregister), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1165 | { "TMCpuTickGet", (void *)(uintptr_t)&TMCpuTickGet, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t), NULL },
|
---|
1166 | { "TMR3NotifySuspend", (void *)(uintptr_t)&TMR3NotifySuspend, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1167 | { "TMR3NotifyResume", (void *)(uintptr_t)&TMR3NotifyResume, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1168 | { "TMNotifyEndOfExecution", (void *)(uintptr_t)&TMNotifyEndOfExecution, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1169 | { "TMNotifyStartOfExecution", (void *)(uintptr_t)&TMNotifyStartOfExecution, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1170 | { "TMTimerPollBool", (void *)(uintptr_t)&TMTimerPollBool, &g_aArgsVMandVMCPU[0], RT_ELEMENTS(g_aArgsVMandVMCPU), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1171 | { "TMR3TimerQueuesDo", (void *)(uintptr_t)&TMR3TimerQueuesDo, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1172 | { "TRPMAssertTrap", (void *)(uintptr_t)&TRPMAssertTrap, &g_aArgsTRPMAssertTrap[0], RT_ELEMENTS(g_aArgsTRPMAssertTrap), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1173 | { "TRPMGetErrorCode", (void *)(uintptr_t)&TRPMGetErrorCode, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINT), NULL },
|
---|
1174 | { "TRPMGetFaultAddress", (void *)(uintptr_t)&TRPMGetFaultAddress, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(RTGCUINTPTR),NULL },
|
---|
1175 | { "TRPMQueryTrap", (void *)(uintptr_t)&TRPMQueryTrap, &g_aArgsTRPMQueryTrap[0], RT_ELEMENTS(g_aArgsTRPMQueryTrap), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1176 | { "TRPMResetTrap", (void *)(uintptr_t)&TRPMResetTrap, &g_aArgsVMCPU[0], RT_ELEMENTS(g_aArgsVMCPU), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1177 | { "TRPMSetErrorCode", (void *)(uintptr_t)&TRPMSetErrorCode, &g_aArgsTRPMSetErrorCode[0], RT_ELEMENTS(g_aArgsTRPMSetErrorCode), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1178 | { "TRPMSetFaultAddress", (void *)(uintptr_t)&TRPMSetFaultAddress, &g_aArgsTRPMSetFaultAddress[0], RT_ELEMENTS(g_aArgsTRPMSetFaultAddress), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1179 | { "VMMGetCpu", (void *)(uintptr_t)&VMMGetCpu, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(PVMCPU), NULL },
|
---|
1180 | { "VMR3ReqCall", (void *)(uintptr_t)&VMR3ReqCall, &g_aArgsVMR3ReqCall[0], RT_ELEMENTS(g_aArgsVMR3ReqCall), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1181 | { "VMR3ReqFree", (void *)(uintptr_t)&VMR3ReqFree, &g_aArgsVMR3ReqFree[0], RT_ELEMENTS(g_aArgsVMR3ReqFree), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(int), NULL },
|
---|
1182 | { "VMR3GetVMCPUId", (void *)(uintptr_t)&VMR3GetVMCPUId, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1183 | { "VMR3GetVMCPUNativeThread", (void *)(uintptr_t)&VMR3GetVMCPUNativeThread, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1184 | // { "", (void *)(uintptr_t)&, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1185 | };
|
---|
1186 |
|
---|
1187 |
|
---|
1188 | /**
|
---|
1189 | * Descriptors for the functions imported from VBoxRT.
|
---|
1190 | */
|
---|
1191 | static REMFNDESC g_aRTImports[] =
|
---|
1192 | {
|
---|
1193 | { "AssertMsg1", (void *)(uintptr_t)&AssertMsg1, &g_aArgsAssertMsg1[0], RT_ELEMENTS(g_aArgsAssertMsg1), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1194 | { "AssertMsg2", (void *)(uintptr_t)&AssertMsg2, &g_aArgsAssertMsg2[0], RT_ELEMENTS(g_aArgsAssertMsg2), REMFNDESC_FLAGS_RET_VOID | REMFNDESC_FLAGS_ELLIPSIS, 0, NULL },
|
---|
1195 | { "RTAssertShouldPanic", (void *)(uintptr_t)&RTAssertShouldPanic, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL },
|
---|
1196 | { "RTLogDefaultInstance", (void *)(uintptr_t)&RTLogDefaultInstance, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(PRTLOGGER), NULL },
|
---|
1197 | { "RTLogRelDefaultInstance", (void *)(uintptr_t)&RTLogRelDefaultInstance, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(PRTLOGGER), NULL },
|
---|
1198 | { "RTLogFlags", (void *)(uintptr_t)&RTLogFlags, &g_aArgsRTLogFlags[0], RT_ELEMENTS(g_aArgsRTLogFlags), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1199 | { "RTLogFlush", (void *)(uintptr_t)&RTLogFlush, &g_aArgsRTLogFlush[0], RT_ELEMENTS(g_aArgsRTLogFlush), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1200 | { "RTLogLoggerEx", (void *)(uintptr_t)&RTLogLoggerEx, &g_aArgsRTLogLoggerEx[0], RT_ELEMENTS(g_aArgsRTLogLoggerEx), REMFNDESC_FLAGS_RET_VOID | REMFNDESC_FLAGS_ELLIPSIS, 0, NULL },
|
---|
1201 | { "RTLogLoggerExV", (void *)(uintptr_t)&RTLogLoggerExV, &g_aArgsRTLogLoggerExV[0], RT_ELEMENTS(g_aArgsRTLogLoggerExV), REMFNDESC_FLAGS_RET_VOID | REMFNDESC_FLAGS_VALIST, 0, NULL },
|
---|
1202 | { "RTLogPrintf", (void *)(uintptr_t)&RTLogPrintf, &g_aArgsRTLogPrintf[0], RT_ELEMENTS(g_aArgsRTLogPrintf), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1203 | { "RTLogRelPrintf", (void *)(uintptr_t)&RTLogRelPrintf, &g_aArgsRTLogPrintf[0], RT_ELEMENTS(g_aArgsRTLogPrintf), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1204 | { "RTMemAlloc", (void *)(uintptr_t)&RTMemAlloc, &g_aArgsSIZE_T[0], RT_ELEMENTS(g_aArgsSIZE_T), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1205 | { "RTMemAllocZ", (void *)(uintptr_t)&RTMemAllocZ, &g_aArgsSIZE_T[0], RT_ELEMENTS(g_aArgsSIZE_T), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1206 | { "RTMemRealloc", (void *)(uintptr_t)&RTMemRealloc, &g_aArgsRTMemRealloc[0], RT_ELEMENTS(g_aArgsRTMemRealloc), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1207 | { "RTMemExecAlloc", (void *)(uintptr_t)&RTMemExecAlloc, &g_aArgsSIZE_T[0], RT_ELEMENTS(g_aArgsSIZE_T), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1208 | { "RTMemExecFree", (void *)(uintptr_t)&RTMemExecFree, &g_aArgsPTR[0], RT_ELEMENTS(g_aArgsPTR), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1209 | { "RTMemFree", (void *)(uintptr_t)&RTMemFree, &g_aArgsPTR[0], RT_ELEMENTS(g_aArgsPTR), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1210 | { "RTMemPageAlloc", (void *)(uintptr_t)&RTMemPageAlloc, &g_aArgsSIZE_T[0], RT_ELEMENTS(g_aArgsSIZE_T), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1211 | { "RTMemPageFree", (void *)(uintptr_t)&RTMemPageFree, &g_aArgsPTR[0], RT_ELEMENTS(g_aArgsPTR), REMFNDESC_FLAGS_RET_VOID, 0, NULL },
|
---|
1212 | { "RTMemProtect", (void *)(uintptr_t)&RTMemProtect, &g_aArgsRTMemProtect[0], RT_ELEMENTS(g_aArgsRTMemProtect), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },
|
---|
1213 | { "RTStrPrintf", (void *)(uintptr_t)&RTStrPrintf, &g_aArgsRTStrPrintf[0], RT_ELEMENTS(g_aArgsRTStrPrintf), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_ELLIPSIS, sizeof(size_t), NULL },
|
---|
1214 | { "RTStrPrintfV", (void *)(uintptr_t)&RTStrPrintfV, &g_aArgsRTStrPrintfV[0], RT_ELEMENTS(g_aArgsRTStrPrintfV), REMFNDESC_FLAGS_RET_INT | REMFNDESC_FLAGS_VALIST, sizeof(size_t), NULL },
|
---|
1215 | { "RTThreadSelf", (void *)(uintptr_t)&RTThreadSelf, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(RTTHREAD), NULL },
|
---|
1216 | { "RTThreadNativeSelf", (void *)(uintptr_t)&RTThreadNativeSelf, NULL, 0, REMFNDESC_FLAGS_RET_INT, sizeof(RTNATIVETHREAD), NULL },
|
---|
1217 | { "RTThreadGetWriteLockCount", (void *)(uintptr_t)&RTThreadGetWriteLockCount, &g_aArgsThread[0], 0, REMFNDESC_FLAGS_RET_INT, sizeof(int32_t), NULL },
|
---|
1218 | };
|
---|
1219 |
|
---|
1220 |
|
---|
1221 | /**
|
---|
1222 | * Descriptors for the functions imported from VBoxRT.
|
---|
1223 | */
|
---|
1224 | static REMFNDESC g_aCRTImports[] =
|
---|
1225 | {
|
---|
1226 | { "memcpy", (void *)(uintptr_t)&memcpy, &g_aArgsmemcpy[0], RT_ELEMENTS(g_aArgsmemcpy), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL },
|
---|
1227 | { "memset", (void *)(uintptr_t)&memset, &g_aArgsmemset[0], RT_ELEMENTS(g_aArgsmemset), REMFNDESC_FLAGS_RET_INT, sizeof(void *), NULL }
|
---|
1228 | /*
|
---|
1229 | floor floor
|
---|
1230 | memcpy memcpy
|
---|
1231 | sqrt sqrt
|
---|
1232 | sqrtf sqrtf
|
---|
1233 | */
|
---|
1234 | };
|
---|
1235 |
|
---|
1236 |
|
---|
1237 | # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
|
---|
1238 | /** LIFO of read-write-executable memory chunks used for wrappers. */
|
---|
1239 | static PREMEXECMEM g_pExecMemHead;
|
---|
1240 | # endif
|
---|
1241 |
|
---|
1242 |
|
---|
1243 | /*******************************************************************************
|
---|
1244 | * Internal Functions *
|
---|
1245 | *******************************************************************************/
|
---|
1246 | static int remGenerateExportGlue(PRTUINTPTR pValue, PCREMFNDESC pDesc);
|
---|
1247 |
|
---|
1248 | # ifdef USE_REM_CALLING_CONVENTION_GLUE
|
---|
1249 | DECLASM(int) WrapGCC2MSC0Int(void); DECLASM(int) WrapGCC2MSC0Int_EndProc(void);
|
---|
1250 | DECLASM(int) WrapGCC2MSC1Int(void); DECLASM(int) WrapGCC2MSC1Int_EndProc(void);
|
---|
1251 | DECLASM(int) WrapGCC2MSC2Int(void); DECLASM(int) WrapGCC2MSC2Int_EndProc(void);
|
---|
1252 | DECLASM(int) WrapGCC2MSC3Int(void); DECLASM(int) WrapGCC2MSC3Int_EndProc(void);
|
---|
1253 | DECLASM(int) WrapGCC2MSC4Int(void); DECLASM(int) WrapGCC2MSC4Int_EndProc(void);
|
---|
1254 | DECLASM(int) WrapGCC2MSC5Int(void); DECLASM(int) WrapGCC2MSC5Int_EndProc(void);
|
---|
1255 | DECLASM(int) WrapGCC2MSC6Int(void); DECLASM(int) WrapGCC2MSC6Int_EndProc(void);
|
---|
1256 | DECLASM(int) WrapGCC2MSC7Int(void); DECLASM(int) WrapGCC2MSC7Int_EndProc(void);
|
---|
1257 | DECLASM(int) WrapGCC2MSC8Int(void); DECLASM(int) WrapGCC2MSC8Int_EndProc(void);
|
---|
1258 | DECLASM(int) WrapGCC2MSC9Int(void); DECLASM(int) WrapGCC2MSC9Int_EndProc(void);
|
---|
1259 | DECLASM(int) WrapGCC2MSC10Int(void); DECLASM(int) WrapGCC2MSC10Int_EndProc(void);
|
---|
1260 | DECLASM(int) WrapGCC2MSC11Int(void); DECLASM(int) WrapGCC2MSC11Int_EndProc(void);
|
---|
1261 | DECLASM(int) WrapGCC2MSC12Int(void); DECLASM(int) WrapGCC2MSC12Int_EndProc(void);
|
---|
1262 | DECLASM(int) WrapGCC2MSCVariadictInt(void); DECLASM(int) WrapGCC2MSCVariadictInt_EndProc(void);
|
---|
1263 | DECLASM(int) WrapGCC2MSC_SSMR3RegisterInternal(void); DECLASM(int) WrapGCC2MSC_SSMR3RegisterInternal_EndProc(void);
|
---|
1264 |
|
---|
1265 | DECLASM(int) WrapMSC2GCC0Int(void); DECLASM(int) WrapMSC2GCC0Int_EndProc(void);
|
---|
1266 | DECLASM(int) WrapMSC2GCC1Int(void); DECLASM(int) WrapMSC2GCC1Int_EndProc(void);
|
---|
1267 | DECLASM(int) WrapMSC2GCC2Int(void); DECLASM(int) WrapMSC2GCC2Int_EndProc(void);
|
---|
1268 | DECLASM(int) WrapMSC2GCC3Int(void); DECLASM(int) WrapMSC2GCC3Int_EndProc(void);
|
---|
1269 | DECLASM(int) WrapMSC2GCC4Int(void); DECLASM(int) WrapMSC2GCC4Int_EndProc(void);
|
---|
1270 | DECLASM(int) WrapMSC2GCC5Int(void); DECLASM(int) WrapMSC2GCC5Int_EndProc(void);
|
---|
1271 | DECLASM(int) WrapMSC2GCC6Int(void); DECLASM(int) WrapMSC2GCC6Int_EndProc(void);
|
---|
1272 | DECLASM(int) WrapMSC2GCC7Int(void); DECLASM(int) WrapMSC2GCC7Int_EndProc(void);
|
---|
1273 | DECLASM(int) WrapMSC2GCC8Int(void); DECLASM(int) WrapMSC2GCC8Int_EndProc(void);
|
---|
1274 | DECLASM(int) WrapMSC2GCC9Int(void); DECLASM(int) WrapMSC2GCC9Int_EndProc(void);
|
---|
1275 | # endif
|
---|
1276 |
|
---|
1277 |
|
---|
1278 | # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
|
---|
1279 | /**
|
---|
1280 | * Allocates a block of memory for glue code.
|
---|
1281 | *
|
---|
1282 | * The returned memory is padded with INT3s.
|
---|
1283 | *
|
---|
1284 | * @returns Pointer to the allocated memory.
|
---|
1285 | * @param The amount of memory to allocate.
|
---|
1286 | */
|
---|
1287 | static void *remAllocGlue(size_t cb)
|
---|
1288 | {
|
---|
1289 | PREMEXECMEM pCur = g_pExecMemHead;
|
---|
1290 | uint32_t cbAligned = (uint32_t)RT_ALIGN_32(cb, 32);
|
---|
1291 | while (pCur)
|
---|
1292 | {
|
---|
1293 | if (pCur->cb - pCur->off >= cbAligned)
|
---|
1294 | {
|
---|
1295 | void *pv = (uint8_t *)pCur + pCur->off;
|
---|
1296 | pCur->off += cbAligned;
|
---|
1297 | return memset(pv, 0xcc, cbAligned);
|
---|
1298 | }
|
---|
1299 | pCur = pCur->pNext;
|
---|
1300 | }
|
---|
1301 |
|
---|
1302 | /* add a new chunk */
|
---|
1303 | AssertReturn(_64K - RT_ALIGN_Z(sizeof(*pCur), 32) > cbAligned, NULL);
|
---|
1304 | pCur = (PREMEXECMEM)RTMemExecAlloc(_64K);
|
---|
1305 | AssertReturn(pCur, NULL);
|
---|
1306 | pCur->cb = _64K;
|
---|
1307 | pCur->off = RT_ALIGN_32(sizeof(*pCur), 32) + cbAligned;
|
---|
1308 | pCur->pNext = g_pExecMemHead;
|
---|
1309 | g_pExecMemHead = pCur;
|
---|
1310 | return memset((uint8_t *)pCur + RT_ALIGN_Z(sizeof(*pCur), 32), 0xcc, cbAligned);
|
---|
1311 | }
|
---|
1312 | # endif /* USE_REM_CALLING_CONVENTION_GLUE || USE_REM_IMPORT_JUMP_GLUE */
|
---|
1313 |
|
---|
1314 |
|
---|
1315 | # ifdef USE_REM_CALLING_CONVENTION_GLUE
|
---|
1316 | /**
|
---|
1317 | * Checks if a function is all straight forward integers.
|
---|
1318 | *
|
---|
1319 | * @returns True if it's simple, false if it's bothersome.
|
---|
1320 | * @param pDesc The function descriptor.
|
---|
1321 | */
|
---|
1322 | static bool remIsFunctionAllInts(PCREMFNDESC pDesc)
|
---|
1323 | {
|
---|
1324 | if ( ( (pDesc->fFlags & REMFNDESC_FLAGS_RET_TYPE_MASK) != REMFNDESC_FLAGS_RET_INT
|
---|
1325 | || pDesc->cbReturn > sizeof(uint64_t))
|
---|
1326 | && (pDesc->fFlags & REMFNDESC_FLAGS_RET_TYPE_MASK) != REMFNDESC_FLAGS_RET_VOID)
|
---|
1327 | return false;
|
---|
1328 | unsigned i = pDesc->cParams;
|
---|
1329 | while (i-- > 0)
|
---|
1330 | switch (pDesc->paParams[i].fFlags & REMPARMDESC_FLAGS_TYPE_MASK)
|
---|
1331 | {
|
---|
1332 | case REMPARMDESC_FLAGS_INT:
|
---|
1333 | case REMPARMDESC_FLAGS_GCPTR:
|
---|
1334 | case REMPARMDESC_FLAGS_GCPHYS:
|
---|
1335 | case REMPARMDESC_FLAGS_HCPHYS:
|
---|
1336 | break;
|
---|
1337 |
|
---|
1338 | default:
|
---|
1339 | AssertReleaseMsgFailed(("Invalid param flags %#x for #%d of %s!\n", pDesc->paParams[i].fFlags, i, pDesc->pszName));
|
---|
1340 | case REMPARMDESC_FLAGS_VALIST:
|
---|
1341 | case REMPARMDESC_FLAGS_ELLIPSIS:
|
---|
1342 | case REMPARMDESC_FLAGS_FLOAT:
|
---|
1343 | case REMPARMDESC_FLAGS_STRUCT:
|
---|
1344 | case REMPARMDESC_FLAGS_PFN:
|
---|
1345 | return false;
|
---|
1346 | }
|
---|
1347 | return true;
|
---|
1348 | }
|
---|
1349 |
|
---|
1350 |
|
---|
1351 | /**
|
---|
1352 | * Checks if the function has an ellipsis (...) argument.
|
---|
1353 | *
|
---|
1354 | * @returns true if it has an ellipsis, otherwise false.
|
---|
1355 | * @param pDesc The function descriptor.
|
---|
1356 | */
|
---|
1357 | static bool remHasFunctionEllipsis(PCREMFNDESC pDesc)
|
---|
1358 | {
|
---|
1359 | unsigned i = pDesc->cParams;
|
---|
1360 | while (i-- > 0)
|
---|
1361 | if ((pDesc->paParams[i].fFlags & REMPARMDESC_FLAGS_TYPE_MASK) == REMPARMDESC_FLAGS_ELLIPSIS)
|
---|
1362 | return true;
|
---|
1363 | return false;
|
---|
1364 | }
|
---|
1365 |
|
---|
1366 |
|
---|
1367 | /**
|
---|
1368 | * Checks if the function uses floating point (FP) arguments or return value.
|
---|
1369 | *
|
---|
1370 | * @returns true if it uses floating point, otherwise false.
|
---|
1371 | * @param pDesc The function descriptor.
|
---|
1372 | */
|
---|
1373 | static bool remIsFunctionUsingFP(PCREMFNDESC pDesc)
|
---|
1374 | {
|
---|
1375 | if ((pDesc->fFlags & REMFNDESC_FLAGS_RET_TYPE_MASK) == REMFNDESC_FLAGS_RET_FLOAT)
|
---|
1376 | return true;
|
---|
1377 | unsigned i = pDesc->cParams;
|
---|
1378 | while (i-- > 0)
|
---|
1379 | if ((pDesc->paParams[i].fFlags & REMPARMDESC_FLAGS_TYPE_MASK) == REMPARMDESC_FLAGS_FLOAT)
|
---|
1380 | return true;
|
---|
1381 | return false;
|
---|
1382 | }
|
---|
1383 |
|
---|
1384 |
|
---|
1385 | /** @name The export and import fixups.
|
---|
1386 | * @{ */
|
---|
1387 | #define REM_FIXUP_32_REAL_STUFF UINT32_C(0xdeadbeef)
|
---|
1388 | #define REM_FIXUP_64_REAL_STUFF UINT64_C(0xdeadf00df00ddead)
|
---|
1389 | #define REM_FIXUP_64_DESC UINT64_C(0xdead00010001dead)
|
---|
1390 | #define REM_FIXUP_64_LOG_ENTRY UINT64_C(0xdead00020002dead)
|
---|
1391 | #define REM_FIXUP_64_LOG_EXIT UINT64_C(0xdead00030003dead)
|
---|
1392 | #define REM_FIXUP_64_WRAP_GCC_CB UINT64_C(0xdead00040004dead)
|
---|
1393 | /** @} */
|
---|
1394 |
|
---|
1395 |
|
---|
1396 | /**
|
---|
1397 | * Entry logger function.
|
---|
1398 | *
|
---|
1399 | * @param pDesc The description.
|
---|
1400 | */
|
---|
1401 | DECLASM(void) remLogEntry(PCREMFNDESC pDesc)
|
---|
1402 | {
|
---|
1403 | RTPrintf("calling %s\n", pDesc->pszName);
|
---|
1404 | }
|
---|
1405 |
|
---|
1406 |
|
---|
1407 | /**
|
---|
1408 | * Exit logger function.
|
---|
1409 | *
|
---|
1410 | * @param pDesc The description.
|
---|
1411 | * @param pvRet The return code.
|
---|
1412 | */
|
---|
1413 | DECLASM(void) remLogExit(PCREMFNDESC pDesc, void *pvRet)
|
---|
1414 | {
|
---|
1415 | RTPrintf("returning %p from %s\n", pvRet, pDesc->pszName);
|
---|
1416 | }
|
---|
1417 |
|
---|
1418 |
|
---|
1419 | /**
|
---|
1420 | * Creates a wrapper for the specified callback function at run time.
|
---|
1421 | *
|
---|
1422 | * @param pDesc The function descriptor.
|
---|
1423 | * @param pValue Upon entry *pValue contains the address of the function to be wrapped.
|
---|
1424 | * Upon return *pValue contains the address of the wrapper glue function.
|
---|
1425 | * @param iParam The parameter index in the function descriptor (0 based).
|
---|
1426 | * If UINT32_MAX pDesc is the descriptor for *pValue.
|
---|
1427 | */
|
---|
1428 | DECLASM(void) remWrapGCCCallback(PCREMFNDESC pDesc, PRTUINTPTR pValue, uint32_t iParam)
|
---|
1429 | {
|
---|
1430 | AssertPtr(pDesc);
|
---|
1431 | AssertPtr(pValue);
|
---|
1432 |
|
---|
1433 | /*
|
---|
1434 | * Simple?
|
---|
1435 | */
|
---|
1436 | if (!*pValue)
|
---|
1437 | return;
|
---|
1438 |
|
---|
1439 | /*
|
---|
1440 | * Locate the right function descriptor.
|
---|
1441 | */
|
---|
1442 | if (iParam != UINT32_MAX)
|
---|
1443 | {
|
---|
1444 | AssertRelease(iParam < pDesc->cParams);
|
---|
1445 | pDesc = (PCREMFNDESC)pDesc->paParams[iParam].pvExtra;
|
---|
1446 | AssertPtr(pDesc);
|
---|
1447 | }
|
---|
1448 |
|
---|
1449 | /*
|
---|
1450 | * When we get serious, here is where to insert the hash table lookup.
|
---|
1451 | */
|
---|
1452 |
|
---|
1453 | /*
|
---|
1454 | * Create a new glue patch.
|
---|
1455 | */
|
---|
1456 | #ifdef RT_OS_WINDOWS
|
---|
1457 | int rc = remGenerateExportGlue(pValue, pDesc);
|
---|
1458 | #else
|
---|
1459 | #error "port me"
|
---|
1460 | #endif
|
---|
1461 | AssertReleaseRC(rc);
|
---|
1462 |
|
---|
1463 | /*
|
---|
1464 | * Add it to the hash (later)
|
---|
1465 | */
|
---|
1466 | }
|
---|
1467 |
|
---|
1468 |
|
---|
1469 | /**
|
---|
1470 | * Fixes export glue.
|
---|
1471 | *
|
---|
1472 | * @param pvGlue The glue code.
|
---|
1473 | * @param cb The size of the glue code.
|
---|
1474 | * @param pvExport The address of the export we're wrapping.
|
---|
1475 | * @param pDesc The export descriptor.
|
---|
1476 | */
|
---|
1477 | static void remGenerateExportGlueFixup(void *pvGlue, size_t cb, uintptr_t uExport, PCREMFNDESC pDesc)
|
---|
1478 | {
|
---|
1479 | union
|
---|
1480 | {
|
---|
1481 | uint8_t *pu8;
|
---|
1482 | int32_t *pi32;
|
---|
1483 | uint32_t *pu32;
|
---|
1484 | uint64_t *pu64;
|
---|
1485 | void *pv;
|
---|
1486 | } u;
|
---|
1487 | u.pv = pvGlue;
|
---|
1488 |
|
---|
1489 | while (cb >= 4)
|
---|
1490 | {
|
---|
1491 | /** @todo add defines for the fixup constants... */
|
---|
1492 | if (*u.pu32 == REM_FIXUP_32_REAL_STUFF)
|
---|
1493 | {
|
---|
1494 | /* 32-bit rel jmp/call to real export. */
|
---|
1495 | *u.pi32 = uExport - (uintptr_t)(u.pi32 + 1);
|
---|
1496 | Assert((uintptr_t)(u.pi32 + 1) + *u.pi32 == uExport);
|
---|
1497 | u.pi32++;
|
---|
1498 | cb -= 4;
|
---|
1499 | continue;
|
---|
1500 | }
|
---|
1501 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_REAL_STUFF)
|
---|
1502 | {
|
---|
1503 | /* 64-bit address to the real export. */
|
---|
1504 | *u.pu64++ = uExport;
|
---|
1505 | cb -= 8;
|
---|
1506 | continue;
|
---|
1507 | }
|
---|
1508 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_DESC)
|
---|
1509 | {
|
---|
1510 | /* 64-bit address to the descriptor. */
|
---|
1511 | *u.pu64++ = (uintptr_t)pDesc;
|
---|
1512 | cb -= 8;
|
---|
1513 | continue;
|
---|
1514 | }
|
---|
1515 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_WRAP_GCC_CB)
|
---|
1516 | {
|
---|
1517 | /* 64-bit address to the entry logger function. */
|
---|
1518 | *u.pu64++ = (uintptr_t)remWrapGCCCallback;
|
---|
1519 | cb -= 8;
|
---|
1520 | continue;
|
---|
1521 | }
|
---|
1522 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_LOG_ENTRY)
|
---|
1523 | {
|
---|
1524 | /* 64-bit address to the entry logger function. */
|
---|
1525 | *u.pu64++ = (uintptr_t)remLogEntry;
|
---|
1526 | cb -= 8;
|
---|
1527 | continue;
|
---|
1528 | }
|
---|
1529 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_LOG_EXIT)
|
---|
1530 | {
|
---|
1531 | /* 64-bit address to the entry logger function. */
|
---|
1532 | *u.pu64++ = (uintptr_t)remLogExit;
|
---|
1533 | cb -= 8;
|
---|
1534 | continue;
|
---|
1535 | }
|
---|
1536 |
|
---|
1537 | /* move on. */
|
---|
1538 | u.pu8++;
|
---|
1539 | cb--;
|
---|
1540 | }
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 |
|
---|
1544 | /**
|
---|
1545 | * Fixes import glue.
|
---|
1546 | *
|
---|
1547 | * @param pvGlue The glue code.
|
---|
1548 | * @param cb The size of the glue code.
|
---|
1549 | * @param pDesc The import descriptor.
|
---|
1550 | */
|
---|
1551 | static void remGenerateImportGlueFixup(void *pvGlue, size_t cb, PCREMFNDESC pDesc)
|
---|
1552 | {
|
---|
1553 | union
|
---|
1554 | {
|
---|
1555 | uint8_t *pu8;
|
---|
1556 | int32_t *pi32;
|
---|
1557 | uint32_t *pu32;
|
---|
1558 | uint64_t *pu64;
|
---|
1559 | void *pv;
|
---|
1560 | } u;
|
---|
1561 | u.pv = pvGlue;
|
---|
1562 |
|
---|
1563 | while (cb >= 4)
|
---|
1564 | {
|
---|
1565 | if (*u.pu32 == REM_FIXUP_32_REAL_STUFF)
|
---|
1566 | {
|
---|
1567 | /* 32-bit rel jmp/call to real function. */
|
---|
1568 | *u.pi32 = (uintptr_t)pDesc->pv - (uintptr_t)(u.pi32 + 1);
|
---|
1569 | Assert((uintptr_t)(u.pi32 + 1) + *u.pi32 == (uintptr_t)pDesc->pv);
|
---|
1570 | u.pi32++;
|
---|
1571 | cb -= 4;
|
---|
1572 | continue;
|
---|
1573 | }
|
---|
1574 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_REAL_STUFF)
|
---|
1575 | {
|
---|
1576 | /* 64-bit address to the real function. */
|
---|
1577 | *u.pu64++ = (uintptr_t)pDesc->pv;
|
---|
1578 | cb -= 8;
|
---|
1579 | continue;
|
---|
1580 | }
|
---|
1581 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_DESC)
|
---|
1582 | {
|
---|
1583 | /* 64-bit address to the descriptor. */
|
---|
1584 | *u.pu64++ = (uintptr_t)pDesc;
|
---|
1585 | cb -= 8;
|
---|
1586 | continue;
|
---|
1587 | }
|
---|
1588 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_WRAP_GCC_CB)
|
---|
1589 | {
|
---|
1590 | /* 64-bit address to the entry logger function. */
|
---|
1591 | *u.pu64++ = (uintptr_t)remWrapGCCCallback;
|
---|
1592 | cb -= 8;
|
---|
1593 | continue;
|
---|
1594 | }
|
---|
1595 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_LOG_ENTRY)
|
---|
1596 | {
|
---|
1597 | /* 64-bit address to the entry logger function. */
|
---|
1598 | *u.pu64++ = (uintptr_t)remLogEntry;
|
---|
1599 | cb -= 8;
|
---|
1600 | continue;
|
---|
1601 | }
|
---|
1602 | if (cb >= 8 && *u.pu64 == REM_FIXUP_64_LOG_EXIT)
|
---|
1603 | {
|
---|
1604 | /* 64-bit address to the entry logger function. */
|
---|
1605 | *u.pu64++ = (uintptr_t)remLogExit;
|
---|
1606 | cb -= 8;
|
---|
1607 | continue;
|
---|
1608 | }
|
---|
1609 |
|
---|
1610 | /* move on. */
|
---|
1611 | u.pu8++;
|
---|
1612 | cb--;
|
---|
1613 | }
|
---|
1614 | }
|
---|
1615 |
|
---|
1616 | # endif /* USE_REM_CALLING_CONVENTION_GLUE */
|
---|
1617 |
|
---|
1618 |
|
---|
1619 | /**
|
---|
1620 | * Generate wrapper glue code for an export.
|
---|
1621 | *
|
---|
1622 | * This is only used on win64 when loading a 64-bit linux module. So, on other
|
---|
1623 | * platforms it will not do anything.
|
---|
1624 | *
|
---|
1625 | * @returns VBox status code.
|
---|
1626 | * @param pValue IN: Where to get the address of the function to wrap.
|
---|
1627 | * OUT: Where to store the glue address.
|
---|
1628 | * @param pDesc The export descriptor.
|
---|
1629 | */
|
---|
1630 | static int remGenerateExportGlue(PRTUINTPTR pValue, PCREMFNDESC pDesc)
|
---|
1631 | {
|
---|
1632 | # ifdef USE_REM_CALLING_CONVENTION_GLUE
|
---|
1633 | uintptr_t *ppfn = (uintptr_t *)pDesc->pv;
|
---|
1634 |
|
---|
1635 | uintptr_t pfn = 0; /* a little hack for the callback glue */
|
---|
1636 | if (!ppfn)
|
---|
1637 | ppfn = &pfn;
|
---|
1638 |
|
---|
1639 | if (!*ppfn)
|
---|
1640 | {
|
---|
1641 | if (remIsFunctionAllInts(pDesc))
|
---|
1642 | {
|
---|
1643 | static const struct { void *pvStart, *pvEnd; } s_aTemplates[] =
|
---|
1644 | {
|
---|
1645 | { (void *)&WrapMSC2GCC0Int, (void *)&WrapMSC2GCC0Int_EndProc },
|
---|
1646 | { (void *)&WrapMSC2GCC1Int, (void *)&WrapMSC2GCC1Int_EndProc },
|
---|
1647 | { (void *)&WrapMSC2GCC2Int, (void *)&WrapMSC2GCC2Int_EndProc },
|
---|
1648 | { (void *)&WrapMSC2GCC3Int, (void *)&WrapMSC2GCC3Int_EndProc },
|
---|
1649 | { (void *)&WrapMSC2GCC4Int, (void *)&WrapMSC2GCC4Int_EndProc },
|
---|
1650 | { (void *)&WrapMSC2GCC5Int, (void *)&WrapMSC2GCC5Int_EndProc },
|
---|
1651 | { (void *)&WrapMSC2GCC6Int, (void *)&WrapMSC2GCC6Int_EndProc },
|
---|
1652 | { (void *)&WrapMSC2GCC7Int, (void *)&WrapMSC2GCC7Int_EndProc },
|
---|
1653 | { (void *)&WrapMSC2GCC8Int, (void *)&WrapMSC2GCC8Int_EndProc },
|
---|
1654 | { (void *)&WrapMSC2GCC9Int, (void *)&WrapMSC2GCC9Int_EndProc },
|
---|
1655 | };
|
---|
1656 | const unsigned i = pDesc->cParams;
|
---|
1657 | AssertReleaseMsg(i < RT_ELEMENTS(s_aTemplates), ("%d (%s)\n", i, pDesc->pszName));
|
---|
1658 |
|
---|
1659 | /* duplicate the patch. */
|
---|
1660 | const size_t cb = (uintptr_t)s_aTemplates[i].pvEnd - (uintptr_t)s_aTemplates[i].pvStart;
|
---|
1661 | uint8_t *pb = (uint8_t *)remAllocGlue(cb);
|
---|
1662 | AssertReturn(pb, VERR_NO_MEMORY);
|
---|
1663 | memcpy(pb, s_aTemplates[i].pvStart, cb);
|
---|
1664 |
|
---|
1665 | /* fix it up. */
|
---|
1666 | remGenerateExportGlueFixup(pb, cb, *pValue, pDesc);
|
---|
1667 | *ppfn = (uintptr_t)pb;
|
---|
1668 | }
|
---|
1669 | else
|
---|
1670 | {
|
---|
1671 | /* custom hacks - it's simpler to make assembly templates than writing a more generic code generator... */
|
---|
1672 | static const struct { const char *pszName; PFNRT pvStart, pvEnd; } s_aTemplates[] =
|
---|
1673 | {
|
---|
1674 | { "somefunction", (PFNRT)&WrapMSC2GCC9Int, (PFNRT)&WrapMSC2GCC9Int_EndProc },
|
---|
1675 | };
|
---|
1676 | unsigned i;
|
---|
1677 | for (i = 0; i < RT_ELEMENTS(s_aTemplates); i++)
|
---|
1678 | if (!strcmp(pDesc->pszName, s_aTemplates[i].pszName))
|
---|
1679 | break;
|
---|
1680 | AssertReleaseMsgReturn(i < RT_ELEMENTS(s_aTemplates), ("Not implemented! %s\n", pDesc->pszName), VERR_NOT_IMPLEMENTED);
|
---|
1681 |
|
---|
1682 | /* duplicate the patch. */
|
---|
1683 | const size_t cb = (uintptr_t)s_aTemplates[i].pvEnd - (uintptr_t)s_aTemplates[i].pvStart;
|
---|
1684 | uint8_t *pb = (uint8_t *)remAllocGlue(cb);
|
---|
1685 | AssertReturn(pb, VERR_NO_MEMORY);
|
---|
1686 | memcpy(pb, s_aTemplates[i].pvStart, cb);
|
---|
1687 |
|
---|
1688 | /* fix it up. */
|
---|
1689 | remGenerateExportGlueFixup(pb, cb, *pValue, pDesc);
|
---|
1690 | *ppfn = (uintptr_t)pb;
|
---|
1691 | }
|
---|
1692 | }
|
---|
1693 | *pValue = *ppfn;
|
---|
1694 | return VINF_SUCCESS;
|
---|
1695 | # else /* !USE_REM_CALLING_CONVENTION_GLUE */
|
---|
1696 | return VINF_SUCCESS;
|
---|
1697 | # endif /* !USE_REM_CALLING_CONVENTION_GLUE */
|
---|
1698 | }
|
---|
1699 |
|
---|
1700 |
|
---|
1701 | /**
|
---|
1702 | * Generate wrapper glue code for an import.
|
---|
1703 | *
|
---|
1704 | * This is only used on win64 when loading a 64-bit linux module. So, on other
|
---|
1705 | * platforms it will simply return the address of the imported function
|
---|
1706 | * without generating any glue code.
|
---|
1707 | *
|
---|
1708 | * @returns VBox status code.
|
---|
1709 | * @param pValue Where to store the glue address.
|
---|
1710 | * @param pDesc The export descriptor.
|
---|
1711 | */
|
---|
1712 | static int remGenerateImportGlue(PRTUINTPTR pValue, PREMFNDESC pDesc)
|
---|
1713 | {
|
---|
1714 | # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
|
---|
1715 | if (!pDesc->pvWrapper)
|
---|
1716 | {
|
---|
1717 | # ifdef USE_REM_CALLING_CONVENTION_GLUE
|
---|
1718 | if (remIsFunctionAllInts(pDesc))
|
---|
1719 | {
|
---|
1720 | static const struct { void *pvStart, *pvEnd; } s_aTemplates[] =
|
---|
1721 | {
|
---|
1722 | { (void *)&WrapGCC2MSC0Int, (void *)&WrapGCC2MSC0Int_EndProc },
|
---|
1723 | { (void *)&WrapGCC2MSC1Int, (void *)&WrapGCC2MSC1Int_EndProc },
|
---|
1724 | { (void *)&WrapGCC2MSC2Int, (void *)&WrapGCC2MSC2Int_EndProc },
|
---|
1725 | { (void *)&WrapGCC2MSC3Int, (void *)&WrapGCC2MSC3Int_EndProc },
|
---|
1726 | { (void *)&WrapGCC2MSC4Int, (void *)&WrapGCC2MSC4Int_EndProc },
|
---|
1727 | { (void *)&WrapGCC2MSC5Int, (void *)&WrapGCC2MSC5Int_EndProc },
|
---|
1728 | { (void *)&WrapGCC2MSC6Int, (void *)&WrapGCC2MSC6Int_EndProc },
|
---|
1729 | { (void *)&WrapGCC2MSC7Int, (void *)&WrapGCC2MSC7Int_EndProc },
|
---|
1730 | { (void *)&WrapGCC2MSC8Int, (void *)&WrapGCC2MSC8Int_EndProc },
|
---|
1731 | { (void *)&WrapGCC2MSC9Int, (void *)&WrapGCC2MSC9Int_EndProc },
|
---|
1732 | { (void *)&WrapGCC2MSC10Int, (void *)&WrapGCC2MSC10Int_EndProc },
|
---|
1733 | { (void *)&WrapGCC2MSC11Int, (void *)&WrapGCC2MSC11Int_EndProc },
|
---|
1734 | { (void *)&WrapGCC2MSC12Int, (void *)&WrapGCC2MSC12Int_EndProc }
|
---|
1735 | };
|
---|
1736 | const unsigned i = pDesc->cParams;
|
---|
1737 | AssertReleaseMsg(i < RT_ELEMENTS(s_aTemplates), ("%d (%s)\n", i, pDesc->pszName));
|
---|
1738 |
|
---|
1739 | /* duplicate the patch. */
|
---|
1740 | const size_t cb = (uintptr_t)s_aTemplates[i].pvEnd - (uintptr_t)s_aTemplates[i].pvStart;
|
---|
1741 | pDesc->pvWrapper = remAllocGlue(cb);
|
---|
1742 | AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
|
---|
1743 | memcpy(pDesc->pvWrapper, s_aTemplates[i].pvStart, cb);
|
---|
1744 |
|
---|
1745 | /* fix it up. */
|
---|
1746 | remGenerateImportGlueFixup((uint8_t *)pDesc->pvWrapper, cb, pDesc);
|
---|
1747 | }
|
---|
1748 | else if ( remHasFunctionEllipsis(pDesc)
|
---|
1749 | && !remIsFunctionUsingFP(pDesc))
|
---|
1750 | {
|
---|
1751 | /* duplicate the patch. */
|
---|
1752 | const size_t cb = (uintptr_t)&WrapGCC2MSCVariadictInt_EndProc - (uintptr_t)&WrapGCC2MSCVariadictInt;
|
---|
1753 | pDesc->pvWrapper = remAllocGlue(cb);
|
---|
1754 | AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
|
---|
1755 | memcpy(pDesc->pvWrapper, (void *)&WrapGCC2MSCVariadictInt, cb);
|
---|
1756 |
|
---|
1757 | /* fix it up. */
|
---|
1758 | remGenerateImportGlueFixup((uint8_t *)pDesc->pvWrapper, cb, pDesc);
|
---|
1759 | }
|
---|
1760 | else
|
---|
1761 | {
|
---|
1762 | /* custom hacks - it's simpler to make assembly templates than writing a more generic code generator... */
|
---|
1763 | static const struct { const char *pszName; PFNRT pvStart, pvEnd; } s_aTemplates[] =
|
---|
1764 | {
|
---|
1765 | { "SSMR3RegisterInternal", (PFNRT)&WrapGCC2MSC_SSMR3RegisterInternal, (PFNRT)&WrapGCC2MSC_SSMR3RegisterInternal_EndProc },
|
---|
1766 | };
|
---|
1767 | unsigned i;
|
---|
1768 | for (i = 0; i < RT_ELEMENTS(s_aTemplates); i++)
|
---|
1769 | if (!strcmp(pDesc->pszName, s_aTemplates[i].pszName))
|
---|
1770 | break;
|
---|
1771 | AssertReleaseMsgReturn(i < RT_ELEMENTS(s_aTemplates), ("Not implemented! %s\n", pDesc->pszName), VERR_NOT_IMPLEMENTED);
|
---|
1772 |
|
---|
1773 | /* duplicate the patch. */
|
---|
1774 | const size_t cb = (uintptr_t)s_aTemplates[i].pvEnd - (uintptr_t)s_aTemplates[i].pvStart;
|
---|
1775 | pDesc->pvWrapper = remAllocGlue(cb);
|
---|
1776 | AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
|
---|
1777 | memcpy(pDesc->pvWrapper, s_aTemplates[i].pvStart, cb);
|
---|
1778 |
|
---|
1779 | /* fix it up. */
|
---|
1780 | remGenerateImportGlueFixup((uint8_t *)pDesc->pvWrapper, cb, pDesc);
|
---|
1781 | }
|
---|
1782 | # else /* !USE_REM_CALLING_CONVENTION_GLUE */
|
---|
1783 |
|
---|
1784 | /*
|
---|
1785 | * Generate a jump patch.
|
---|
1786 | */
|
---|
1787 | uint8_t *pb;
|
---|
1788 | # ifdef RT_ARCH_AMD64
|
---|
1789 | pDesc->pvWrapper = pb = (uint8_t *)remAllocGlue(32);
|
---|
1790 | AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
|
---|
1791 | /**pb++ = 0xcc;*/
|
---|
1792 | *pb++ = 0xff;
|
---|
1793 | *pb++ = 0x24;
|
---|
1794 | *pb++ = 0x25;
|
---|
1795 | *(uint32_t *)pb = (uintptr_t)pb + 5;
|
---|
1796 | pb += 5;
|
---|
1797 | *(uint64_t *)pb = (uint64_t)pDesc->pv;
|
---|
1798 | # else
|
---|
1799 | pDesc->pvWrapper = pb = (uint8_t *)remAllocGlue(8);
|
---|
1800 | AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
|
---|
1801 | *pb++ = 0xea;
|
---|
1802 | *(uint32_t *)pb = (uint32_t)pDesc->pv;
|
---|
1803 | # endif
|
---|
1804 | # endif /* !USE_REM_CALLING_CONVENTION_GLUE */
|
---|
1805 | }
|
---|
1806 | *pValue = (uintptr_t)pDesc->pvWrapper;
|
---|
1807 | # else /* !USE_REM_CALLING_CONVENTION_GLUE */
|
---|
1808 | *pValue = (uintptr_t)pDesc->pv;
|
---|
1809 | # endif /* !USE_REM_CALLING_CONVENTION_GLUE */
|
---|
1810 | return VINF_SUCCESS;
|
---|
1811 | }
|
---|
1812 |
|
---|
1813 |
|
---|
1814 | /**
|
---|
1815 | * Resolve an external symbol during RTLdrGetBits().
|
---|
1816 | *
|
---|
1817 | * @returns iprt status code.
|
---|
1818 | * @param hLdrMod The loader module handle.
|
---|
1819 | * @param pszModule Module name.
|
---|
1820 | * @param pszSymbol Symbol name, NULL if uSymbol should be used.
|
---|
1821 | * @param uSymbol Symbol ordinal, ~0 if pszSymbol should be used.
|
---|
1822 | * @param pValue Where to store the symbol value (address).
|
---|
1823 | * @param pvUser User argument.
|
---|
1824 | */
|
---|
1825 | static DECLCALLBACK(int) remGetImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser)
|
---|
1826 | {
|
---|
1827 | unsigned i;
|
---|
1828 | for (i = 0; i < RT_ELEMENTS(g_aVMMImports); i++)
|
---|
1829 | if (!strcmp(g_aVMMImports[i].pszName, pszSymbol))
|
---|
1830 | return remGenerateImportGlue(pValue, &g_aVMMImports[i]);
|
---|
1831 | for (i = 0; i < RT_ELEMENTS(g_aRTImports); i++)
|
---|
1832 | if (!strcmp(g_aRTImports[i].pszName, pszSymbol))
|
---|
1833 | return remGenerateImportGlue(pValue, &g_aRTImports[i]);
|
---|
1834 | for (i = 0; i < RT_ELEMENTS(g_aCRTImports); i++)
|
---|
1835 | if (!strcmp(g_aCRTImports[i].pszName, pszSymbol))
|
---|
1836 | return remGenerateImportGlue(pValue, &g_aCRTImports[i]);
|
---|
1837 | LogRel(("Missing REM Import: %s\n", pszSymbol));
|
---|
1838 | #if 1
|
---|
1839 | *pValue = 0;
|
---|
1840 | AssertMsgFailed(("%s.%s\n", pszModule, pszSymbol));
|
---|
1841 | return VERR_SYMBOL_NOT_FOUND;
|
---|
1842 | #else
|
---|
1843 | return remGenerateImportGlue(pValue, &g_aCRTImports[0]);
|
---|
1844 | #endif
|
---|
1845 | }
|
---|
1846 |
|
---|
1847 | /**
|
---|
1848 | * Loads the linux object, resolves all imports and exports.
|
---|
1849 | *
|
---|
1850 | * @returns VBox status code.
|
---|
1851 | */
|
---|
1852 | static int remLoadLinuxObj(void)
|
---|
1853 | {
|
---|
1854 | size_t offFilename;
|
---|
1855 | char szPath[RTPATH_MAX];
|
---|
1856 | int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - 32);
|
---|
1857 | AssertRCReturn(rc, rc);
|
---|
1858 | offFilename = strlen(szPath);
|
---|
1859 |
|
---|
1860 | /*
|
---|
1861 | * Load the VBoxREM2.rel object/DLL.
|
---|
1862 | */
|
---|
1863 | strcpy(&szPath[offFilename], "/VBoxREM2.rel");
|
---|
1864 | rc = RTLdrOpen(szPath, 0, RTLDRARCH_HOST, &g_ModREM2);
|
---|
1865 | if (RT_SUCCESS(rc))
|
---|
1866 | {
|
---|
1867 | g_pvREM2 = RTMemExecAlloc(RTLdrSize(g_ModREM2));
|
---|
1868 | if (g_pvREM2)
|
---|
1869 | {
|
---|
1870 | #ifdef DEBUG /* How to load the VBoxREM2.rel symbols into the GNU debugger. */
|
---|
1871 | RTPrintf("VBoxREMWrapper: (gdb) add-symbol-file %s 0x%p\n", szPath, g_pvREM2);
|
---|
1872 | #endif
|
---|
1873 | LogRel(("REM: Loading %s at 0x%p (%d bytes)\n"
|
---|
1874 | "REM: (gdb) add-symbol-file %s 0x%p\n",
|
---|
1875 | szPath, g_pvREM2, RTLdrSize(g_ModREM2), szPath, g_pvREM2));
|
---|
1876 | rc = RTLdrGetBits(g_ModREM2, g_pvREM2, (RTUINTPTR)g_pvREM2, remGetImport, NULL);
|
---|
1877 | if (RT_SUCCESS(rc))
|
---|
1878 | {
|
---|
1879 | /*
|
---|
1880 | * Resolve exports.
|
---|
1881 | */
|
---|
1882 | unsigned i;
|
---|
1883 | for (i = 0; i < RT_ELEMENTS(g_aExports); i++)
|
---|
1884 | {
|
---|
1885 | RTUINTPTR Value;
|
---|
1886 | rc = RTLdrGetSymbolEx(g_ModREM2, g_pvREM2, (RTUINTPTR)g_pvREM2, g_aExports[i].pszName, &Value);
|
---|
1887 | AssertMsgRC(rc, ("%s rc=%Rrc\n", g_aExports[i].pszName, rc));
|
---|
1888 | if (RT_FAILURE(rc))
|
---|
1889 | break;
|
---|
1890 | rc = remGenerateExportGlue(&Value, &g_aExports[i]);
|
---|
1891 | if (RT_FAILURE(rc))
|
---|
1892 | break;
|
---|
1893 | *(void **)g_aExports[i].pv = (void *)(uintptr_t)Value;
|
---|
1894 | }
|
---|
1895 | return rc;
|
---|
1896 | }
|
---|
1897 | RTMemExecFree(g_pvREM2);
|
---|
1898 | }
|
---|
1899 | RTLdrClose(g_ModREM2);
|
---|
1900 | g_ModREM2 = NIL_RTLDRMOD;
|
---|
1901 | }
|
---|
1902 | LogRel(("REM: failed loading '%s', rc=%Rrc\n", szPath, rc));
|
---|
1903 | return rc;
|
---|
1904 | }
|
---|
1905 |
|
---|
1906 |
|
---|
1907 | /**
|
---|
1908 | * Unloads the linux object, freeing up all resources (dlls and
|
---|
1909 | * import glue) we allocated during remLoadLinuxObj().
|
---|
1910 | */
|
---|
1911 | static void remUnloadLinuxObj(void)
|
---|
1912 | {
|
---|
1913 | unsigned i;
|
---|
1914 |
|
---|
1915 | /* close modules. */
|
---|
1916 | RTLdrClose(g_ModREM2);
|
---|
1917 | g_ModREM2 = NIL_RTLDRMOD;
|
---|
1918 | RTMemExecFree(g_pvREM2);
|
---|
1919 | g_pvREM2 = NULL;
|
---|
1920 |
|
---|
1921 | /* clear the pointers. */
|
---|
1922 | for (i = 0; i < RT_ELEMENTS(g_aExports); i++)
|
---|
1923 | *(void **)g_aExports[i].pv = NULL;
|
---|
1924 | # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
|
---|
1925 | for (i = 0; i < RT_ELEMENTS(g_aVMMImports); i++)
|
---|
1926 | g_aVMMImports[i].pvWrapper = NULL;
|
---|
1927 | for (i = 0; i < RT_ELEMENTS(g_aRTImports); i++)
|
---|
1928 | g_aRTImports[i].pvWrapper = NULL;
|
---|
1929 | for (i = 0; i < RT_ELEMENTS(g_aCRTImports); i++)
|
---|
1930 | g_aCRTImports[i].pvWrapper = NULL;
|
---|
1931 |
|
---|
1932 | /* free wrapper memory. */
|
---|
1933 | while (g_pExecMemHead)
|
---|
1934 | {
|
---|
1935 | PREMEXECMEM pCur = g_pExecMemHead;
|
---|
1936 | g_pExecMemHead = pCur->pNext;
|
---|
1937 | memset(pCur, 0xcc, pCur->cb);
|
---|
1938 | RTMemExecFree(pCur);
|
---|
1939 | }
|
---|
1940 | # endif
|
---|
1941 | }
|
---|
1942 |
|
---|
1943 | #endif /* USE_REM_STUBS */
|
---|
1944 | #ifdef VBOX_USE_BITNESS_SELECTOR
|
---|
1945 |
|
---|
1946 | /**
|
---|
1947 | * Checks if 64-bit support is enabled.
|
---|
1948 | *
|
---|
1949 | * @returns true / false.
|
---|
1950 | * @param pVM Pointer to the shared VM structure.
|
---|
1951 | */
|
---|
1952 | static bool remIs64bitEnabled(PVM pVM)
|
---|
1953 | {
|
---|
1954 | bool f;
|
---|
1955 | int rc = CFGMR3QueryBoolDef(CFGMR3GetChild(CFGMR3GetRoot(pVM), "REM"), "64bitEnabled", &f, false);
|
---|
1956 | AssertRCReturn(rc, false);
|
---|
1957 | return f;
|
---|
1958 | }
|
---|
1959 |
|
---|
1960 |
|
---|
1961 | /**
|
---|
1962 | * Loads real REM object, resolves all exports (imports are done by native loader).
|
---|
1963 | *
|
---|
1964 | * @returns VBox status code.
|
---|
1965 | */
|
---|
1966 | static int remLoadProperObj(PVM pVM)
|
---|
1967 | {
|
---|
1968 | /*
|
---|
1969 | * Load the VBoxREM32/64 object/DLL.
|
---|
1970 | */
|
---|
1971 | const char *pszModule = remIs64bitEnabled(pVM) ? "VBoxREM64" : "VBoxREM32";
|
---|
1972 | int rc = SUPR3HardenedLdrLoadAppPriv(pszModule, &g_ModREM2);
|
---|
1973 | if (RT_SUCCESS(rc))
|
---|
1974 | {
|
---|
1975 | LogRel(("REM: %s\n", pszModule));
|
---|
1976 |
|
---|
1977 | /*
|
---|
1978 | * Resolve exports.
|
---|
1979 | */
|
---|
1980 | unsigned i;
|
---|
1981 | for (i = 0; i < RT_ELEMENTS(g_aExports); i++)
|
---|
1982 | {
|
---|
1983 | void *pvValue;
|
---|
1984 | rc = RTLdrGetSymbol(g_ModREM2, g_aExports[i].pszName, &pvValue);
|
---|
1985 | AssertLogRelMsgRCBreak(rc, ("%s rc=%Rrc\n", g_aExports[i].pszName, rc));
|
---|
1986 | *(void **)g_aExports[i].pv = pvValue;
|
---|
1987 | }
|
---|
1988 | }
|
---|
1989 |
|
---|
1990 | return rc;
|
---|
1991 | }
|
---|
1992 |
|
---|
1993 |
|
---|
1994 | /**
|
---|
1995 | * Unloads the real REM object.
|
---|
1996 | */
|
---|
1997 | static void remUnloadProperObj(void)
|
---|
1998 | {
|
---|
1999 | /* close module. */
|
---|
2000 | RTLdrClose(g_ModREM2);
|
---|
2001 | g_ModREM2 = NIL_RTLDRMOD;
|
---|
2002 | }
|
---|
2003 |
|
---|
2004 | #endif /* VBOX_USE_BITNESS_SELECTOR */
|
---|
2005 |
|
---|
2006 | REMR3DECL(int) REMR3Init(PVM pVM)
|
---|
2007 | {
|
---|
2008 | #ifdef USE_REM_STUBS
|
---|
2009 | return VINF_SUCCESS;
|
---|
2010 |
|
---|
2011 | #elif defined(VBOX_USE_BITNESS_SELECTOR)
|
---|
2012 | if (!pfnREMR3Init)
|
---|
2013 | {
|
---|
2014 | int rc = remLoadProperObj(pVM);
|
---|
2015 | if (RT_FAILURE(rc))
|
---|
2016 | return rc;
|
---|
2017 | }
|
---|
2018 | return pfnREMR3Init(pVM);
|
---|
2019 |
|
---|
2020 | #else
|
---|
2021 | if (!pfnREMR3Init)
|
---|
2022 | {
|
---|
2023 | int rc = remLoadLinuxObj();
|
---|
2024 | if (RT_FAILURE(rc))
|
---|
2025 | return rc;
|
---|
2026 | }
|
---|
2027 | return pfnREMR3Init(pVM);
|
---|
2028 | #endif
|
---|
2029 | }
|
---|
2030 |
|
---|
2031 | REMR3DECL(int) REMR3InitFinalize(PVM pVM)
|
---|
2032 | {
|
---|
2033 | #ifndef USE_REM_STUBS
|
---|
2034 | Assert(VALID_PTR(pfnREMR3InitFinalize));
|
---|
2035 | return pfnREMR3InitFinalize(pVM);
|
---|
2036 | #endif
|
---|
2037 | }
|
---|
2038 |
|
---|
2039 | REMR3DECL(int) REMR3Term(PVM pVM)
|
---|
2040 | {
|
---|
2041 | #ifdef USE_REM_STUBS
|
---|
2042 | return VINF_SUCCESS;
|
---|
2043 |
|
---|
2044 | #elif defined(VBOX_USE_BITNESS_SELECTOR)
|
---|
2045 | int rc;
|
---|
2046 | Assert(VALID_PTR(pfnREMR3Term));
|
---|
2047 | rc = pfnREMR3Term(pVM);
|
---|
2048 | remUnloadProperObj();
|
---|
2049 | return rc;
|
---|
2050 |
|
---|
2051 | #else
|
---|
2052 | int rc;
|
---|
2053 | Assert(VALID_PTR(pfnREMR3Term));
|
---|
2054 | rc = pfnREMR3Term(pVM);
|
---|
2055 | remUnloadLinuxObj();
|
---|
2056 | return rc;
|
---|
2057 | #endif
|
---|
2058 | }
|
---|
2059 |
|
---|
2060 | REMR3DECL(void) REMR3Reset(PVM pVM)
|
---|
2061 | {
|
---|
2062 | #ifndef USE_REM_STUBS
|
---|
2063 | Assert(VALID_PTR(pfnREMR3Reset));
|
---|
2064 | pfnREMR3Reset(pVM);
|
---|
2065 | #endif
|
---|
2066 | }
|
---|
2067 |
|
---|
2068 | REMR3DECL(int) REMR3Step(PVM pVM, PVMCPU pVCpu)
|
---|
2069 | {
|
---|
2070 | #ifdef USE_REM_STUBS
|
---|
2071 | return VERR_NOT_IMPLEMENTED;
|
---|
2072 | #else
|
---|
2073 | Assert(VALID_PTR(pfnREMR3Step));
|
---|
2074 | return pfnREMR3Step(pVM, pVCpu);
|
---|
2075 | #endif
|
---|
2076 | }
|
---|
2077 |
|
---|
2078 | REMR3DECL(int) REMR3BreakpointSet(PVM pVM, RTGCUINTPTR Address)
|
---|
2079 | {
|
---|
2080 | #ifdef USE_REM_STUBS
|
---|
2081 | return VERR_REM_NO_MORE_BP_SLOTS;
|
---|
2082 | #else
|
---|
2083 | Assert(VALID_PTR(pfnREMR3BreakpointSet));
|
---|
2084 | return pfnREMR3BreakpointSet(pVM, Address);
|
---|
2085 | #endif
|
---|
2086 | }
|
---|
2087 |
|
---|
2088 | REMR3DECL(int) REMR3BreakpointClear(PVM pVM, RTGCUINTPTR Address)
|
---|
2089 | {
|
---|
2090 | #ifdef USE_REM_STUBS
|
---|
2091 | return VERR_NOT_IMPLEMENTED;
|
---|
2092 | #else
|
---|
2093 | Assert(VALID_PTR(pfnREMR3BreakpointClear));
|
---|
2094 | return pfnREMR3BreakpointClear(pVM, Address);
|
---|
2095 | #endif
|
---|
2096 | }
|
---|
2097 |
|
---|
2098 | REMR3DECL(int) REMR3EmulateInstruction(PVM pVM, PVMCPU pVCpu)
|
---|
2099 | {
|
---|
2100 | #ifdef USE_REM_STUBS
|
---|
2101 | return VERR_NOT_IMPLEMENTED;
|
---|
2102 | #else
|
---|
2103 | Assert(VALID_PTR(pfnREMR3EmulateInstruction));
|
---|
2104 | return pfnREMR3EmulateInstruction(pVM, pVCpu);
|
---|
2105 | #endif
|
---|
2106 | }
|
---|
2107 |
|
---|
2108 | REMR3DECL(int) REMR3Run(PVM pVM, PVMCPU pVCpu)
|
---|
2109 | {
|
---|
2110 | #ifdef USE_REM_STUBS
|
---|
2111 | return VERR_NOT_IMPLEMENTED;
|
---|
2112 | #else
|
---|
2113 | Assert(VALID_PTR(pfnREMR3Run));
|
---|
2114 | return pfnREMR3Run(pVM, pVCpu);
|
---|
2115 | #endif
|
---|
2116 | }
|
---|
2117 |
|
---|
2118 | REMR3DECL(int) REMR3State(PVM pVM, PVMCPU pVCpu)
|
---|
2119 | {
|
---|
2120 | #ifdef USE_REM_STUBS
|
---|
2121 | return VERR_NOT_IMPLEMENTED;
|
---|
2122 | #else
|
---|
2123 | Assert(VALID_PTR(pfnREMR3State));
|
---|
2124 | return pfnREMR3State(pVM, pVCpu);
|
---|
2125 | #endif
|
---|
2126 | }
|
---|
2127 |
|
---|
2128 | REMR3DECL(int) REMR3StateBack(PVM pVM, PVMCPU pVCpu)
|
---|
2129 | {
|
---|
2130 | #ifdef USE_REM_STUBS
|
---|
2131 | return VERR_NOT_IMPLEMENTED;
|
---|
2132 | #else
|
---|
2133 | Assert(VALID_PTR(pfnREMR3StateBack));
|
---|
2134 | return pfnREMR3StateBack(pVM, pVCpu);
|
---|
2135 | #endif
|
---|
2136 | }
|
---|
2137 |
|
---|
2138 | REMR3DECL(void) REMR3StateUpdate(PVM pVM, PVMCPU pVCpu)
|
---|
2139 | {
|
---|
2140 | #ifndef USE_REM_STUBS
|
---|
2141 | Assert(VALID_PTR(pfnREMR3StateUpdate));
|
---|
2142 | pfnREMR3StateUpdate(pVM, pVCpu);
|
---|
2143 | #endif
|
---|
2144 | }
|
---|
2145 |
|
---|
2146 | REMR3DECL(void) REMR3A20Set(PVM pVM, PVMCPU pVCpu, bool fEnable)
|
---|
2147 | {
|
---|
2148 | #ifndef USE_REM_STUBS
|
---|
2149 | Assert(VALID_PTR(pfnREMR3A20Set));
|
---|
2150 | pfnREMR3A20Set(pVM, pVCpu, fEnable);
|
---|
2151 | #endif
|
---|
2152 | }
|
---|
2153 |
|
---|
2154 | REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM)
|
---|
2155 | {
|
---|
2156 | #ifndef USE_REM_STUBS
|
---|
2157 | Assert(VALID_PTR(pfnREMR3ReplayHandlerNotifications));
|
---|
2158 | pfnREMR3ReplayHandlerNotifications(pVM);
|
---|
2159 | #endif
|
---|
2160 | }
|
---|
2161 |
|
---|
2162 | REMR3DECL(int) REMR3NotifyCodePageChanged(PVM pVM, PVMCPU pVCpu, RTGCPTR pvCodePage)
|
---|
2163 | {
|
---|
2164 | #ifdef USE_REM_STUBS
|
---|
2165 | return VINF_SUCCESS;
|
---|
2166 | #else
|
---|
2167 | Assert(VALID_PTR(pfnREMR3NotifyCodePageChanged));
|
---|
2168 | return pfnREMR3NotifyCodePageChanged(pVM, pVCpu, pvCodePage);
|
---|
2169 | #endif
|
---|
2170 | }
|
---|
2171 |
|
---|
2172 | REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, unsigned fFlags)
|
---|
2173 | {
|
---|
2174 | #ifndef USE_REM_STUBS
|
---|
2175 | Assert(VALID_PTR(pfnREMR3NotifyPhysRamRegister));
|
---|
2176 | pfnREMR3NotifyPhysRamRegister(pVM, GCPhys, cb, fFlags);
|
---|
2177 | #endif
|
---|
2178 | }
|
---|
2179 |
|
---|
2180 | REMR3DECL(void) REMR3NotifyPhysRomRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvCopy, bool fShadow)
|
---|
2181 | {
|
---|
2182 | #ifndef USE_REM_STUBS
|
---|
2183 | Assert(VALID_PTR(pfnREMR3NotifyPhysRomRegister));
|
---|
2184 | pfnREMR3NotifyPhysRomRegister(pVM, GCPhys, cb, pvCopy, fShadow);
|
---|
2185 | #endif
|
---|
2186 | }
|
---|
2187 |
|
---|
2188 | REMR3DECL(void) REMR3NotifyPhysRamDeregister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb)
|
---|
2189 | {
|
---|
2190 | #ifndef USE_REM_STUBS
|
---|
2191 | Assert(VALID_PTR(pfnREMR3NotifyPhysRamDeregister));
|
---|
2192 | pfnREMR3NotifyPhysRamDeregister(pVM, GCPhys, cb);
|
---|
2193 | #endif
|
---|
2194 | }
|
---|
2195 |
|
---|
2196 | REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
|
---|
2197 | {
|
---|
2198 | #ifndef USE_REM_STUBS
|
---|
2199 | Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalRegister));
|
---|
2200 | pfnREMR3NotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, cb, fHasHCHandler);
|
---|
2201 | #endif
|
---|
2202 | }
|
---|
2203 |
|
---|
2204 | REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
|
---|
2205 | {
|
---|
2206 | #ifndef USE_REM_STUBS
|
---|
2207 | Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalDeregister));
|
---|
2208 | pfnREMR3NotifyHandlerPhysicalDeregister(pVM, enmType, GCPhys, cb, fHasHCHandler, fRestoreAsRAM);
|
---|
2209 | #endif
|
---|
2210 | }
|
---|
2211 |
|
---|
2212 | REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
|
---|
2213 | {
|
---|
2214 | #ifndef USE_REM_STUBS
|
---|
2215 | Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalModify));
|
---|
2216 | pfnREMR3NotifyHandlerPhysicalModify(pVM, enmType, GCPhysOld, GCPhysNew, cb, fHasHCHandler, fRestoreAsRAM);
|
---|
2217 | #endif
|
---|
2218 | }
|
---|
2219 |
|
---|
2220 | REMR3DECL(bool) REMR3IsPageAccessHandled(PVM pVM, RTGCPHYS GCPhys)
|
---|
2221 | {
|
---|
2222 | #ifdef USE_REM_STUBS
|
---|
2223 | return false;
|
---|
2224 | #else
|
---|
2225 | Assert(VALID_PTR(pfnREMR3IsPageAccessHandled));
|
---|
2226 | return pfnREMR3IsPageAccessHandled(pVM, GCPhys);
|
---|
2227 | #endif
|
---|
2228 | }
|
---|
2229 |
|
---|
2230 | REMR3DECL(int) REMR3DisasEnableStepping(PVM pVM, bool fEnable)
|
---|
2231 | {
|
---|
2232 | #ifdef USE_REM_STUBS
|
---|
2233 | return VERR_NOT_IMPLEMENTED;
|
---|
2234 | #else
|
---|
2235 | Assert(VALID_PTR(pfnREMR3DisasEnableStepping));
|
---|
2236 | return pfnREMR3DisasEnableStepping(pVM, fEnable);
|
---|
2237 | #endif
|
---|
2238 | }
|
---|
2239 |
|
---|
2240 | REMR3DECL(void) REMR3NotifyPendingInterrupt(PVM pVM, PVMCPU pVCpu, uint8_t u8Interrupt)
|
---|
2241 | {
|
---|
2242 | #ifndef USE_REM_STUBS
|
---|
2243 | Assert(VALID_PTR(pfnREMR3NotifyPendingInterrupt));
|
---|
2244 | pfnREMR3NotifyPendingInterrupt(pVM, pVCpu, u8Interrupt);
|
---|
2245 | #endif
|
---|
2246 | }
|
---|
2247 |
|
---|
2248 | REMR3DECL(uint32_t) REMR3QueryPendingInterrupt(PVM pVM, PVMCPU pVCpu)
|
---|
2249 | {
|
---|
2250 | #ifdef USE_REM_STUBS
|
---|
2251 | return REM_NO_PENDING_IRQ;
|
---|
2252 | #else
|
---|
2253 | Assert(VALID_PTR(pfnREMR3QueryPendingInterrupt));
|
---|
2254 | return pfnREMR3QueryPendingInterrupt(pVM, pVCpu);
|
---|
2255 | #endif
|
---|
2256 | }
|
---|
2257 |
|
---|
2258 | REMR3DECL(void) REMR3NotifyInterruptSet(PVM pVM, PVMCPU pVCpu)
|
---|
2259 | {
|
---|
2260 | #ifndef USE_REM_STUBS
|
---|
2261 | Assert(VALID_PTR(pfnREMR3NotifyInterruptSet));
|
---|
2262 | pfnREMR3NotifyInterruptSet(pVM, pVCpu);
|
---|
2263 | #endif
|
---|
2264 | }
|
---|
2265 |
|
---|
2266 | REMR3DECL(void) REMR3NotifyInterruptClear(PVM pVM, PVMCPU pVCpu)
|
---|
2267 | {
|
---|
2268 | #ifndef USE_REM_STUBS
|
---|
2269 | Assert(VALID_PTR(pfnREMR3NotifyInterruptClear));
|
---|
2270 | pfnREMR3NotifyInterruptClear(pVM, pVCpu);
|
---|
2271 | #endif
|
---|
2272 | }
|
---|
2273 |
|
---|
2274 | REMR3DECL(void) REMR3NotifyTimerPending(PVM pVM, PVMCPU pVCpuDst)
|
---|
2275 | {
|
---|
2276 | #ifndef USE_REM_STUBS
|
---|
2277 | Assert(VALID_PTR(pfnREMR3NotifyTimerPending));
|
---|
2278 | pfnREMR3NotifyTimerPending(pVM, pVCpuDst);
|
---|
2279 | #endif
|
---|
2280 | }
|
---|
2281 |
|
---|
2282 | REMR3DECL(void) REMR3NotifyDmaPending(PVM pVM)
|
---|
2283 | {
|
---|
2284 | #ifndef USE_REM_STUBS
|
---|
2285 | Assert(VALID_PTR(pfnREMR3NotifyDmaPending));
|
---|
2286 | pfnREMR3NotifyDmaPending(pVM);
|
---|
2287 | #endif
|
---|
2288 | }
|
---|
2289 |
|
---|
2290 | REMR3DECL(void) REMR3NotifyQueuePending(PVM pVM)
|
---|
2291 | {
|
---|
2292 | #ifndef USE_REM_STUBS
|
---|
2293 | Assert(VALID_PTR(pfnREMR3NotifyQueuePending));
|
---|
2294 | pfnREMR3NotifyQueuePending(pVM);
|
---|
2295 | #endif
|
---|
2296 | }
|
---|
2297 |
|
---|
2298 | REMR3DECL(void) REMR3NotifyFF(PVM pVM)
|
---|
2299 | {
|
---|
2300 | #ifndef USE_REM_STUBS
|
---|
2301 | /* the timer can call this early on, so don't be picky. */
|
---|
2302 | if (pfnREMR3NotifyFF)
|
---|
2303 | pfnREMR3NotifyFF(pVM);
|
---|
2304 | #endif
|
---|
2305 | }
|
---|
2306 |
|
---|