1 | /** @file
|
---|
2 | * DBGF - Debugger Facility.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_dbgf_h
|
---|
27 | #define ___VBox_vmm_dbgf_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 | #include <VBox/log.h> /* LOG_ENABLED */
|
---|
31 | #include <VBox/vmm/vmm.h>
|
---|
32 | #include <VBox/vmm/dbgfsel.h>
|
---|
33 |
|
---|
34 | #include <iprt/stdarg.h>
|
---|
35 | #include <iprt/dbg.h>
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 |
|
---|
40 | /** @defgroup grp_dbgf The Debugger Facility API
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 |
|
---|
44 | #if defined(IN_RC) || defined(IN_RING0)
|
---|
45 | /** @addgroup grp_dbgf_rz The RZ DBGF API
|
---|
46 | * @ingroup grp_dbgf
|
---|
47 | * @{
|
---|
48 | */
|
---|
49 | VMMRZDECL(int) DBGFRZTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6);
|
---|
50 | VMMRZDECL(int) DBGFRZTrap03Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
|
---|
51 | /** @} */
|
---|
52 | #endif
|
---|
53 |
|
---|
54 |
|
---|
55 |
|
---|
56 | #ifdef IN_RING3
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Mixed address.
|
---|
60 | */
|
---|
61 | typedef struct DBGFADDRESS
|
---|
62 | {
|
---|
63 | /** The flat address. */
|
---|
64 | RTGCUINTPTR FlatPtr;
|
---|
65 | /** The selector offset address. */
|
---|
66 | RTGCUINTPTR off;
|
---|
67 | /** The selector. DBGF_SEL_FLAT is a legal value. */
|
---|
68 | RTSEL Sel;
|
---|
69 | /** Flags describing further details about the address. */
|
---|
70 | uint16_t fFlags;
|
---|
71 | } DBGFADDRESS;
|
---|
72 | /** Pointer to a mixed address. */
|
---|
73 | typedef DBGFADDRESS *PDBGFADDRESS;
|
---|
74 | /** Pointer to a const mixed address. */
|
---|
75 | typedef const DBGFADDRESS *PCDBGFADDRESS;
|
---|
76 |
|
---|
77 | /** @name DBGFADDRESS Flags.
|
---|
78 | * @{ */
|
---|
79 | /** A 16:16 far address. */
|
---|
80 | #define DBGFADDRESS_FLAGS_FAR16 0
|
---|
81 | /** A 16:32 far address. */
|
---|
82 | #define DBGFADDRESS_FLAGS_FAR32 1
|
---|
83 | /** A 16:64 far address. */
|
---|
84 | #define DBGFADDRESS_FLAGS_FAR64 2
|
---|
85 | /** A flat address. */
|
---|
86 | #define DBGFADDRESS_FLAGS_FLAT 3
|
---|
87 | /** A physical address. */
|
---|
88 | #define DBGFADDRESS_FLAGS_PHYS 4
|
---|
89 | /** A physical address. */
|
---|
90 | #define DBGFADDRESS_FLAGS_RING0 5
|
---|
91 | /** The address type mask. */
|
---|
92 | #define DBGFADDRESS_FLAGS_TYPE_MASK 7
|
---|
93 |
|
---|
94 | /** Set if the address is valid. */
|
---|
95 | #define DBGFADDRESS_FLAGS_VALID RT_BIT(3)
|
---|
96 |
|
---|
97 | /** The address is within the hypervisor memoary area (HMA).
|
---|
98 | * If not set, the address can be assumed to be a guest address. */
|
---|
99 | #define DBGFADDRESS_FLAGS_HMA RT_BIT(4)
|
---|
100 |
|
---|
101 | /** Checks if the mixed address is flat or not. */
|
---|
102 | #define DBGFADDRESS_IS_FLAT(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FLAT )
|
---|
103 | /** Checks if the mixed address is flat or not. */
|
---|
104 | #define DBGFADDRESS_IS_PHYS(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_PHYS )
|
---|
105 | /** Checks if the mixed address is far 16:16 or not. */
|
---|
106 | #define DBGFADDRESS_IS_FAR16(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR16 )
|
---|
107 | /** Checks if the mixed address is far 16:32 or not. */
|
---|
108 | #define DBGFADDRESS_IS_FAR32(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR32 )
|
---|
109 | /** Checks if the mixed address is far 16:64 or not. */
|
---|
110 | #define DBGFADDRESS_IS_FAR64(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR64 )
|
---|
111 | /** Checks if the mixed address is valid. */
|
---|
112 | #define DBGFADDRESS_IS_VALID(pAddress) ( !!((pAddress)->fFlags & DBGFADDRESS_FLAGS_VALID) )
|
---|
113 | /** Checks if the address is flagged as within the HMA. */
|
---|
114 | #define DBGFADDRESS_IS_HMA(pAddress) ( !!((pAddress)->fFlags & DBGFADDRESS_FLAGS_HMA) )
|
---|
115 | /** @} */
|
---|
116 |
|
---|
117 | VMMR3DECL(int) DBGFR3AddrFromSelOff(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off);
|
---|
118 | VMMR3DECL(int) DBGFR3AddrFromSelInfoOff(PVM pVM, PDBGFADDRESS pAddress, PCDBGFSELINFO pSelInfo, RTUINTPTR off);
|
---|
119 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromFlat(PVM pVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr);
|
---|
120 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromPhys(PVM pVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr);
|
---|
121 | VMMR3DECL(bool) DBGFR3AddrIsValid(PVM pVM, PCDBGFADDRESS pAddress);
|
---|
122 | VMMR3DECL(int) DBGFR3AddrToPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTGCPHYS pGCPhys);
|
---|
123 | VMMR3DECL(int) DBGFR3AddrToHostPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys);
|
---|
124 | VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr);
|
---|
125 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrAdd(PDBGFADDRESS pAddress, RTGCUINTPTR uAddend);
|
---|
126 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrSub(PDBGFADDRESS pAddress, RTGCUINTPTR uSubtrahend);
|
---|
127 |
|
---|
128 | #endif /* IN_RING3 */
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * VMM Debug Event Type.
|
---|
134 | */
|
---|
135 | typedef enum DBGFEVENTTYPE
|
---|
136 | {
|
---|
137 | /** Halt completed.
|
---|
138 | * This notifies that a halt command have been successfully completed.
|
---|
139 | */
|
---|
140 | DBGFEVENT_HALT_DONE = 0,
|
---|
141 | /** Detach completed.
|
---|
142 | * This notifies that the detach command have been successfully completed.
|
---|
143 | */
|
---|
144 | DBGFEVENT_DETACH_DONE,
|
---|
145 | /** The command from the debugger is not recognized.
|
---|
146 | * This means internal error or half implemented features.
|
---|
147 | */
|
---|
148 | DBGFEVENT_INVALID_COMMAND,
|
---|
149 |
|
---|
150 |
|
---|
151 | /** Fatal error.
|
---|
152 | * This notifies a fatal error in the VMM and that the debugger get's a
|
---|
153 | * chance to first hand information about the the problem.
|
---|
154 | */
|
---|
155 | DBGFEVENT_FATAL_ERROR = 100,
|
---|
156 | /** Breakpoint Hit.
|
---|
157 | * This notifies that a breakpoint installed by the debugger was hit. The
|
---|
158 | * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
|
---|
159 | */
|
---|
160 | DBGFEVENT_BREAKPOINT,
|
---|
161 | /** Breakpoint Hit in the Hypervisor.
|
---|
162 | * This notifies that a breakpoint installed by the debugger was hit. The
|
---|
163 | * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
|
---|
164 | */
|
---|
165 | DBGFEVENT_BREAKPOINT_HYPER,
|
---|
166 | /** Assertion in the Hypervisor (breakpoint instruction).
|
---|
167 | * This notifies that a breakpoint instruction was hit in the hypervisor context.
|
---|
168 | */
|
---|
169 | DBGFEVENT_ASSERTION_HYPER,
|
---|
170 | /** Single Stepped.
|
---|
171 | * This notifies that a single step operation was completed.
|
---|
172 | */
|
---|
173 | DBGFEVENT_STEPPED,
|
---|
174 | /** Single Stepped.
|
---|
175 | * This notifies that a hypervisor single step operation was completed.
|
---|
176 | */
|
---|
177 | DBGFEVENT_STEPPED_HYPER,
|
---|
178 | /** The developer have used the DBGFSTOP macro or the PDMDeviceDBGFSTOP function
|
---|
179 | * to bring up the debugger at a specific place.
|
---|
180 | */
|
---|
181 | DBGFEVENT_DEV_STOP,
|
---|
182 | /** The VM is terminating.
|
---|
183 | * When this notification is received, the debugger thread should detach ASAP.
|
---|
184 | */
|
---|
185 | DBGFEVENT_TERMINATING,
|
---|
186 |
|
---|
187 | /** The usual 32-bit hack. */
|
---|
188 | DBGFEVENT_32BIT_HACK = 0x7fffffff
|
---|
189 | } DBGFEVENTTYPE;
|
---|
190 |
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * The context of an event.
|
---|
194 | */
|
---|
195 | typedef enum DBGFEVENTCTX
|
---|
196 | {
|
---|
197 | /** The usual invalid entry. */
|
---|
198 | DBGFEVENTCTX_INVALID = 0,
|
---|
199 | /** Raw mode. */
|
---|
200 | DBGFEVENTCTX_RAW,
|
---|
201 | /** Recompiled mode. */
|
---|
202 | DBGFEVENTCTX_REM,
|
---|
203 | /** VMX / AVT mode. */
|
---|
204 | DBGFEVENTCTX_HM,
|
---|
205 | /** Hypervisor context. */
|
---|
206 | DBGFEVENTCTX_HYPER,
|
---|
207 | /** Other mode */
|
---|
208 | DBGFEVENTCTX_OTHER,
|
---|
209 |
|
---|
210 | /** The usual 32-bit hack */
|
---|
211 | DBGFEVENTCTX_32BIT_HACK = 0x7fffffff
|
---|
212 | } DBGFEVENTCTX;
|
---|
213 |
|
---|
214 | /**
|
---|
215 | * VMM Debug Event.
|
---|
216 | */
|
---|
217 | typedef struct DBGFEVENT
|
---|
218 | {
|
---|
219 | /** Type. */
|
---|
220 | DBGFEVENTTYPE enmType;
|
---|
221 | /** Context */
|
---|
222 | DBGFEVENTCTX enmCtx;
|
---|
223 | /** Type specific data. */
|
---|
224 | union
|
---|
225 | {
|
---|
226 | /** Fatal error details. */
|
---|
227 | struct
|
---|
228 | {
|
---|
229 | /** The GC return code. */
|
---|
230 | int rc;
|
---|
231 | } FatalError;
|
---|
232 |
|
---|
233 | /** Source location. */
|
---|
234 | struct
|
---|
235 | {
|
---|
236 | /** File name. */
|
---|
237 | R3PTRTYPE(const char *) pszFile;
|
---|
238 | /** Function name. */
|
---|
239 | R3PTRTYPE(const char *) pszFunction;
|
---|
240 | /** Message. */
|
---|
241 | R3PTRTYPE(const char *) pszMessage;
|
---|
242 | /** Line number. */
|
---|
243 | unsigned uLine;
|
---|
244 | } Src;
|
---|
245 |
|
---|
246 | /** Assertion messages. */
|
---|
247 | struct
|
---|
248 | {
|
---|
249 | /** The first message. */
|
---|
250 | R3PTRTYPE(const char *) pszMsg1;
|
---|
251 | /** The second message. */
|
---|
252 | R3PTRTYPE(const char *) pszMsg2;
|
---|
253 | } Assert;
|
---|
254 |
|
---|
255 | /** Breakpoint. */
|
---|
256 | struct DBGFEVENTBP
|
---|
257 | {
|
---|
258 | /** The identifier of the breakpoint which was hit. */
|
---|
259 | RTUINT iBp;
|
---|
260 | } Bp;
|
---|
261 | /** Padding for ensuring that the structure is 8 byte aligned. */
|
---|
262 | uint64_t au64Padding[4];
|
---|
263 | } u;
|
---|
264 | } DBGFEVENT;
|
---|
265 | /** Pointer to VMM Debug Event. */
|
---|
266 | typedef DBGFEVENT *PDBGFEVENT;
|
---|
267 | /** Pointer to const VMM Debug Event. */
|
---|
268 | typedef const DBGFEVENT *PCDBGFEVENT;
|
---|
269 |
|
---|
270 | #ifdef IN_RING3 /* The event API only works in ring-3. */
|
---|
271 |
|
---|
272 | /** @def DBGFSTOP
|
---|
273 | * Stops the debugger raising a DBGFEVENT_DEVELOPER_STOP event.
|
---|
274 | *
|
---|
275 | * @returns VBox status code which must be propagated up to EM if not VINF_SUCCESS.
|
---|
276 | * @param pVM VM Handle.
|
---|
277 | */
|
---|
278 | # ifdef VBOX_STRICT
|
---|
279 | # define DBGFSTOP(pVM) DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL)
|
---|
280 | # else
|
---|
281 | # define DBGFSTOP(pVM) VINF_SUCCESS
|
---|
282 | # endif
|
---|
283 |
|
---|
284 | VMMR3DECL(int) DBGFR3Init(PVM pVM);
|
---|
285 | VMMR3DECL(int) DBGFR3Term(PVM pVM);
|
---|
286 | VMMR3DECL(void) DBGFR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
287 | VMMR3DECL(int) DBGFR3VMMForcedAction(PVM pVM);
|
---|
288 | VMMR3DECL(int) DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent);
|
---|
289 | VMMR3DECL(int) DBGFR3EventSrc(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, ...);
|
---|
290 | VMMR3DECL(int) DBGFR3EventSrcV(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, va_list args);
|
---|
291 | VMMR3DECL(int) DBGFR3EventAssertion(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszMsg1, const char *pszMsg2);
|
---|
292 | VMMR3DECL(int) DBGFR3EventBreakpoint(PVM pVM, DBGFEVENTTYPE enmEvent);
|
---|
293 | VMMR3DECL(int) DBGFR3Attach(PVM pVM);
|
---|
294 | VMMR3DECL(int) DBGFR3Detach(PVM pVM);
|
---|
295 | VMMR3DECL(int) DBGFR3EventWait(PVM pVM, RTMSINTERVAL cMillies, PCDBGFEVENT *ppEvent);
|
---|
296 | VMMR3DECL(int) DBGFR3Halt(PVM pVM);
|
---|
297 | VMMR3DECL(bool) DBGFR3IsHalted(PVM pVM);
|
---|
298 | VMMR3DECL(bool) DBGFR3CanWait(PVM pVM);
|
---|
299 | VMMR3DECL(int) DBGFR3Resume(PVM pVM);
|
---|
300 | VMMR3DECL(int) DBGFR3Step(PVM pVM, VMCPUID idCpu);
|
---|
301 | VMMR3DECL(int) DBGFR3PrgStep(PVMCPU pVCpu);
|
---|
302 | VMMR3DECL(int) DBGFR3InjectNMI(PUVM pUVM, VMCPUID idCpu);
|
---|
303 |
|
---|
304 | #endif /* IN_RING3 */
|
---|
305 |
|
---|
306 |
|
---|
307 |
|
---|
308 | /** Breakpoint type. */
|
---|
309 | typedef enum DBGFBPTYPE
|
---|
310 | {
|
---|
311 | /** Free breakpoint entry. */
|
---|
312 | DBGFBPTYPE_FREE = 0,
|
---|
313 | /** Debug register. */
|
---|
314 | DBGFBPTYPE_REG,
|
---|
315 | /** INT 3 instruction. */
|
---|
316 | DBGFBPTYPE_INT3,
|
---|
317 | /** Recompiler. */
|
---|
318 | DBGFBPTYPE_REM,
|
---|
319 | /** ensure 32-bit size. */
|
---|
320 | DBGFBPTYPE_32BIT_HACK = 0x7fffffff
|
---|
321 | } DBGFBPTYPE;
|
---|
322 |
|
---|
323 |
|
---|
324 | /**
|
---|
325 | * A Breakpoint.
|
---|
326 | */
|
---|
327 | typedef struct DBGFBP
|
---|
328 | {
|
---|
329 | /** The number of breakpoint hits. */
|
---|
330 | uint64_t cHits;
|
---|
331 | /** The hit number which starts to trigger the breakpoint. */
|
---|
332 | uint64_t iHitTrigger;
|
---|
333 | /** The hit number which stops triggering the breakpoint (disables it).
|
---|
334 | * Use ~(uint64_t)0 if it should never stop. */
|
---|
335 | uint64_t iHitDisable;
|
---|
336 | /** The Flat GC address of the breakpoint.
|
---|
337 | * (PC register value if REM type?) */
|
---|
338 | RTGCUINTPTR GCPtr;
|
---|
339 | /** The breakpoint id. */
|
---|
340 | uint32_t iBp;
|
---|
341 | /** The breakpoint status - enabled or disabled. */
|
---|
342 | bool fEnabled;
|
---|
343 |
|
---|
344 | /** The breakpoint type. */
|
---|
345 | DBGFBPTYPE enmType;
|
---|
346 |
|
---|
347 | #if GC_ARCH_BITS == 64
|
---|
348 | uint32_t u32Padding;
|
---|
349 | #endif
|
---|
350 |
|
---|
351 | /** Union of type specific data. */
|
---|
352 | union
|
---|
353 | {
|
---|
354 | /** Debug register data. */
|
---|
355 | struct DBGFBPREG
|
---|
356 | {
|
---|
357 | /** The debug register number. */
|
---|
358 | uint8_t iReg;
|
---|
359 | /** The access type (one of the X86_DR7_RW_* value). */
|
---|
360 | uint8_t fType;
|
---|
361 | /** The access size. */
|
---|
362 | uint8_t cb;
|
---|
363 | } Reg;
|
---|
364 | /** Recompiler breakpoint data. */
|
---|
365 | struct DBGFBPINT3
|
---|
366 | {
|
---|
367 | /** The byte value we replaced by the INT 3 instruction. */
|
---|
368 | uint8_t bOrg;
|
---|
369 | } Int3;
|
---|
370 |
|
---|
371 | /** Recompiler breakpoint data. */
|
---|
372 | struct DBGFBPREM
|
---|
373 | {
|
---|
374 | /** nothing yet */
|
---|
375 | uint8_t fDummy;
|
---|
376 | } Rem;
|
---|
377 | /** Paddind to ensure that the size is identical on win32 and linux. */
|
---|
378 | uint64_t u64Padding;
|
---|
379 | } u;
|
---|
380 | } DBGFBP;
|
---|
381 |
|
---|
382 | /** Pointer to a breakpoint. */
|
---|
383 | typedef DBGFBP *PDBGFBP;
|
---|
384 | /** Pointer to a const breakpoint. */
|
---|
385 | typedef const DBGFBP *PCDBGFBP;
|
---|
386 |
|
---|
387 | #ifdef IN_RING3 /* The breakpoint management API is only available in ring-3. */
|
---|
388 | VMMR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp);
|
---|
389 | VMMR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
|
---|
390 | uint8_t fType, uint8_t cb, uint32_t *piBp);
|
---|
391 | VMMR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp);
|
---|
392 | VMMR3DECL(int) DBGFR3BpClear(PVM pVM, uint32_t iBp);
|
---|
393 | VMMR3DECL(int) DBGFR3BpEnable(PVM pVM, uint32_t iBp);
|
---|
394 | VMMR3DECL(int) DBGFR3BpDisable(PVM pVM, uint32_t iBp);
|
---|
395 |
|
---|
396 | /**
|
---|
397 | * Breakpoint enumeration callback function.
|
---|
398 | *
|
---|
399 | * @returns VBox status code. Any failure will stop the enumeration.
|
---|
400 | * @param pVM The VM handle.
|
---|
401 | * @param pvUser The user argument.
|
---|
402 | * @param pBp Pointer to the breakpoint information. (readonly)
|
---|
403 | */
|
---|
404 | typedef DECLCALLBACK(int) FNDBGFBPENUM(PVM pVM, void *pvUser, PCDBGFBP pBp);
|
---|
405 | /** Pointer to a breakpoint enumeration callback function. */
|
---|
406 | typedef FNDBGFBPENUM *PFNDBGFBPENUM;
|
---|
407 |
|
---|
408 | VMMR3DECL(int) DBGFR3BpEnum(PVM pVM, PFNDBGFBPENUM pfnCallback, void *pvUser);
|
---|
409 | #endif /* IN_RING3 */
|
---|
410 |
|
---|
411 | VMMDECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM);
|
---|
412 | VMMDECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM);
|
---|
413 | VMMDECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM);
|
---|
414 | VMMDECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM);
|
---|
415 | VMMDECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM);
|
---|
416 | VMMDECL(bool) DBGFIsStepping(PVMCPU pVCpu);
|
---|
417 |
|
---|
418 |
|
---|
419 | #ifdef IN_RING3 /* The CPU mode API only works in ring-3. */
|
---|
420 | VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PVM pVM, VMCPUID idCpu);
|
---|
421 | #endif
|
---|
422 |
|
---|
423 |
|
---|
424 |
|
---|
425 | #ifdef IN_RING3 /* The info callbacks API only works in ring-3. */
|
---|
426 |
|
---|
427 | /**
|
---|
428 | * Info helper callback structure.
|
---|
429 | */
|
---|
430 | typedef struct DBGFINFOHLP
|
---|
431 | {
|
---|
432 | /**
|
---|
433 | * Print formatted string.
|
---|
434 | *
|
---|
435 | * @param pHlp Pointer to this structure.
|
---|
436 | * @param pszFormat The format string.
|
---|
437 | * @param ... Arguments.
|
---|
438 | */
|
---|
439 | DECLCALLBACKMEMBER(void, pfnPrintf)(PCDBGFINFOHLP pHlp, const char *pszFormat, ...);
|
---|
440 |
|
---|
441 | /**
|
---|
442 | * Print formatted string.
|
---|
443 | *
|
---|
444 | * @param pHlp Pointer to this structure.
|
---|
445 | * @param pszFormat The format string.
|
---|
446 | * @param args Argument list.
|
---|
447 | */
|
---|
448 | DECLCALLBACKMEMBER(void, pfnPrintfV)(PCDBGFINFOHLP pHlp, const char *pszFormat, va_list args);
|
---|
449 | } DBGFINFOHLP;
|
---|
450 |
|
---|
451 |
|
---|
452 | /**
|
---|
453 | * Info handler, device version.
|
---|
454 | *
|
---|
455 | * @param pDevIns The device instance which registered the info.
|
---|
456 | * @param pHlp Callback functions for doing output.
|
---|
457 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
458 | */
|
---|
459 | typedef DECLCALLBACK(void) FNDBGFHANDLERDEV(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
460 | /** Pointer to a FNDBGFHANDLERDEV function. */
|
---|
461 | typedef FNDBGFHANDLERDEV *PFNDBGFHANDLERDEV;
|
---|
462 |
|
---|
463 | /**
|
---|
464 | * Info handler, USB device version.
|
---|
465 | *
|
---|
466 | * @param pUsbIns The USB device instance which registered the info.
|
---|
467 | * @param pHlp Callback functions for doing output.
|
---|
468 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
469 | */
|
---|
470 | typedef DECLCALLBACK(void) FNDBGFHANDLERUSB(PPDMUSBINS pUsbIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
471 | /** Pointer to a FNDBGFHANDLERUSB function. */
|
---|
472 | typedef FNDBGFHANDLERUSB *PFNDBGFHANDLERUSB;
|
---|
473 |
|
---|
474 | /**
|
---|
475 | * Info handler, driver version.
|
---|
476 | *
|
---|
477 | * @param pDrvIns The driver instance which registered the info.
|
---|
478 | * @param pHlp Callback functions for doing output.
|
---|
479 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
480 | */
|
---|
481 | typedef DECLCALLBACK(void) FNDBGFHANDLERDRV(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
482 | /** Pointer to a FNDBGFHANDLERDRV function. */
|
---|
483 | typedef FNDBGFHANDLERDRV *PFNDBGFHANDLERDRV;
|
---|
484 |
|
---|
485 | /**
|
---|
486 | * Info handler, internal version.
|
---|
487 | *
|
---|
488 | * @param pVM The VM handle.
|
---|
489 | * @param pHlp Callback functions for doing output.
|
---|
490 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
491 | */
|
---|
492 | typedef DECLCALLBACK(void) FNDBGFHANDLERINT(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
493 | /** Pointer to a FNDBGFHANDLERINT function. */
|
---|
494 | typedef FNDBGFHANDLERINT *PFNDBGFHANDLERINT;
|
---|
495 |
|
---|
496 | /**
|
---|
497 | * Info handler, external version.
|
---|
498 | *
|
---|
499 | * @param pvUser User argument.
|
---|
500 | * @param pHlp Callback functions for doing output.
|
---|
501 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
502 | */
|
---|
503 | typedef DECLCALLBACK(void) FNDBGFHANDLEREXT(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
504 | /** Pointer to a FNDBGFHANDLEREXT function. */
|
---|
505 | typedef FNDBGFHANDLEREXT *PFNDBGFHANDLEREXT;
|
---|
506 |
|
---|
507 |
|
---|
508 | /** @name Flags for the info registration functions.
|
---|
509 | * @{ */
|
---|
510 | /** The handler must run on the EMT. */
|
---|
511 | #define DBGFINFO_FLAGS_RUN_ON_EMT RT_BIT(0)
|
---|
512 | /** @} */
|
---|
513 |
|
---|
514 | VMMR3DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler, PPDMDEVINS pDevIns);
|
---|
515 | VMMR3DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns);
|
---|
516 | VMMR3DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler);
|
---|
517 | VMMR3DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags);
|
---|
518 | VMMR3DECL(int) DBGFR3InfoRegisterExternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser);
|
---|
519 | VMMR3DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName);
|
---|
520 | VMMR3DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName);
|
---|
521 | VMMR3DECL(int) DBGFR3InfoDeregisterInternal(PVM pVM, const char *pszName);
|
---|
522 | VMMR3DECL(int) DBGFR3InfoDeregisterExternal(PVM pVM, const char *pszName);
|
---|
523 | VMMR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
|
---|
524 | VMMR3DECL(int) DBGFR3InfoEx(PVM pVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
|
---|
525 | VMMR3DECL(int) DBGFR3InfoLogRel(PVM pVM, const char *pszName, const char *pszArgs);
|
---|
526 | VMMR3DECL(int) DBGFR3InfoStdErr(PVM pVM, const char *pszName, const char *pszArgs);
|
---|
527 | VMMR3DECL(int) DBGFR3InfoMulti(PVM pVM, const char *pszIncludePat, const char *pszExcludePat,
|
---|
528 | const char *pszSepFmt, PCDBGFINFOHLP pHlp);
|
---|
529 |
|
---|
530 | /** @def DBGFR3InfoLog
|
---|
531 | * Display a piece of info writing to the log if enabled.
|
---|
532 | *
|
---|
533 | * @param pVM VM handle.
|
---|
534 | * @param pszName The identifier of the info to display.
|
---|
535 | * @param pszArgs Arguments to the info handler.
|
---|
536 | */
|
---|
537 | #ifdef LOG_ENABLED
|
---|
538 | #define DBGFR3InfoLog(pVM, pszName, pszArgs) \
|
---|
539 | do { \
|
---|
540 | if (LogIsEnabled()) \
|
---|
541 | DBGFR3Info(pVM, pszName, pszArgs, NULL); \
|
---|
542 | } while (0)
|
---|
543 | #else
|
---|
544 | #define DBGFR3InfoLog(pVM, pszName, pszArgs) do { } while (0)
|
---|
545 | #endif
|
---|
546 |
|
---|
547 | /**
|
---|
548 | * Enumeration callback for use with DBGFR3InfoEnum.
|
---|
549 | *
|
---|
550 | * @returns VBox status code.
|
---|
551 | * A status code indicating failure will end the enumeration
|
---|
552 | * and DBGFR3InfoEnum will return with that status code.
|
---|
553 | * @param pVM VM handle.
|
---|
554 | * @param pszName Info identifier name.
|
---|
555 | * @param pszDesc The description.
|
---|
556 | */
|
---|
557 | typedef DECLCALLBACK(int) FNDBGFINFOENUM(PVM pVM, const char *pszName, const char *pszDesc, void *pvUser);
|
---|
558 | /** Pointer to a FNDBGFINFOENUM function. */
|
---|
559 | typedef FNDBGFINFOENUM *PFNDBGFINFOENUM;
|
---|
560 |
|
---|
561 | VMMR3DECL(int) DBGFR3InfoEnum(PVM pVM, PFNDBGFINFOENUM pfnCallback, void *pvUser);
|
---|
562 | VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogHlp(void);
|
---|
563 | VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogRelHlp(void);
|
---|
564 |
|
---|
565 | #endif /* IN_RING3 */
|
---|
566 |
|
---|
567 |
|
---|
568 | #ifdef IN_RING3 /* The log contrl API only works in ring-3. */
|
---|
569 | VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings);
|
---|
570 | VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings);
|
---|
571 | VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings);
|
---|
572 | #endif /* IN_RING3 */
|
---|
573 |
|
---|
574 | #ifdef IN_RING3 /* The debug information management APIs only works in ring-3. */
|
---|
575 |
|
---|
576 | /** Max length (including '\\0') of a symbol name. */
|
---|
577 | #define DBGF_SYMBOL_NAME_LENGTH 512
|
---|
578 |
|
---|
579 | /**
|
---|
580 | * Debug symbol.
|
---|
581 | */
|
---|
582 | typedef struct DBGFSYMBOL
|
---|
583 | {
|
---|
584 | /** Symbol value (address). */
|
---|
585 | RTGCUINTPTR Value;
|
---|
586 | /** Symbol size. */
|
---|
587 | uint32_t cb;
|
---|
588 | /** Symbol Flags. (reserved). */
|
---|
589 | uint32_t fFlags;
|
---|
590 | /** Symbol name. */
|
---|
591 | char szName[DBGF_SYMBOL_NAME_LENGTH];
|
---|
592 | } DBGFSYMBOL;
|
---|
593 | /** Pointer to debug symbol. */
|
---|
594 | typedef DBGFSYMBOL *PDBGFSYMBOL;
|
---|
595 | /** Pointer to const debug symbol. */
|
---|
596 | typedef const DBGFSYMBOL *PCDBGFSYMBOL;
|
---|
597 |
|
---|
598 | /**
|
---|
599 | * Debug line number information.
|
---|
600 | */
|
---|
601 | typedef struct DBGFLINE
|
---|
602 | {
|
---|
603 | /** Address. */
|
---|
604 | RTGCUINTPTR Address;
|
---|
605 | /** Line number. */
|
---|
606 | uint32_t uLineNo;
|
---|
607 | /** Filename. */
|
---|
608 | char szFilename[260];
|
---|
609 | } DBGFLINE;
|
---|
610 | /** Pointer to debug line number. */
|
---|
611 | typedef DBGFLINE *PDBGFLINE;
|
---|
612 | /** Pointer to const debug line number. */
|
---|
613 | typedef const DBGFLINE *PCDBGFLINE;
|
---|
614 |
|
---|
615 | /** @name Address spaces aliases.
|
---|
616 | * @{ */
|
---|
617 | /** The guest global address space. */
|
---|
618 | #define DBGF_AS_GLOBAL ((RTDBGAS)-1)
|
---|
619 | /** The guest kernel address space.
|
---|
620 | * This is usually resolves to the same as DBGF_AS_GLOBAL. */
|
---|
621 | #define DBGF_AS_KERNEL ((RTDBGAS)-2)
|
---|
622 | /** The physical address space. */
|
---|
623 | #define DBGF_AS_PHYS ((RTDBGAS)-3)
|
---|
624 | /** Raw-mode context. */
|
---|
625 | #define DBGF_AS_RC ((RTDBGAS)-4)
|
---|
626 | /** Ring-0 context. */
|
---|
627 | #define DBGF_AS_R0 ((RTDBGAS)-5)
|
---|
628 | /** Raw-mode context and then global guest context.
|
---|
629 | * When used for looking up information, it works as if the call was first made
|
---|
630 | * with DBGF_AS_RC and then on failure with DBGF_AS_GLOBAL. When called for
|
---|
631 | * making address space changes, it works as if DBGF_AS_RC was used. */
|
---|
632 | #define DBGF_AS_RC_AND_GC_GLOBAL ((RTDBGAS)-6)
|
---|
633 |
|
---|
634 | /** The first special one. */
|
---|
635 | #define DBGF_AS_FIRST DBGF_AS_RC_AND_GC_GLOBAL
|
---|
636 | /** The last special one. */
|
---|
637 | #define DBGF_AS_LAST DBGF_AS_GLOBAL
|
---|
638 | #endif
|
---|
639 | /** The number of special address space handles. */
|
---|
640 | #define DBGF_AS_COUNT (6U)
|
---|
641 | #ifdef IN_RING3
|
---|
642 | /** Converts an alias handle to an array index. */
|
---|
643 | #define DBGF_AS_ALIAS_2_INDEX(hAlias) \
|
---|
644 | ( (uintptr_t)(hAlias) - (uintptr_t)DBGF_AS_FIRST )
|
---|
645 | /** Predicat macro that check if the specified handle is an alias. */
|
---|
646 | #define DBGF_AS_IS_ALIAS(hAlias) \
|
---|
647 | ( DBGF_AS_ALIAS_2_INDEX(hAlias) < DBGF_AS_COUNT )
|
---|
648 | /** Predicat macro that check if the specified alias is a fixed one or not. */
|
---|
649 | #define DBGF_AS_IS_FIXED_ALIAS(hAlias) \
|
---|
650 | ( DBGF_AS_ALIAS_2_INDEX(hAlias) < (uintptr_t)DBGF_AS_PHYS - (uintptr_t)DBGF_AS_FIRST + 1U )
|
---|
651 |
|
---|
652 | /** @} */
|
---|
653 |
|
---|
654 | VMMR3DECL(int) DBGFR3AsAdd(PVM pVM, RTDBGAS hDbgAs, RTPROCESS ProcId);
|
---|
655 | VMMR3DECL(int) DBGFR3AsDelete(PVM pVM, RTDBGAS hDbgAs);
|
---|
656 | VMMR3DECL(int) DBGFR3AsSetAlias(PVM pVM, RTDBGAS hAlias, RTDBGAS hAliasFor);
|
---|
657 | VMMR3DECL(RTDBGAS) DBGFR3AsResolve(PVM pVM, RTDBGAS hAlias);
|
---|
658 | VMMR3DECL(RTDBGAS) DBGFR3AsResolveAndRetain(PVM pVM, RTDBGAS hAlias);
|
---|
659 | VMMR3DECL(RTDBGAS) DBGFR3AsQueryByName(PVM pVM, const char *pszName);
|
---|
660 | VMMR3DECL(RTDBGAS) DBGFR3AsQueryByPid(PVM pVM, RTPROCESS ProcId);
|
---|
661 |
|
---|
662 | VMMR3DECL(int) DBGFR3AsLoadImage(PVM pVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
|
---|
663 | VMMR3DECL(int) DBGFR3AsLoadMap(PVM pVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags);
|
---|
664 | VMMR3DECL(int) DBGFR3AsLinkModule(PVM pVM, RTDBGAS hDbgAs, RTDBGMOD hMod, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
|
---|
665 |
|
---|
666 | VMMR3DECL(int) DBGFR3AsSymbolByAddr(PVM pVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
|
---|
667 | VMMR3DECL(PRTDBGSYMBOL) DBGFR3AsSymbolByAddrA(PVM pVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, PRTGCINTPTR poffDisp, PRTDBGMOD phMod);
|
---|
668 | VMMR3DECL(int) DBGFR3AsSymbolByName(PVM pVM, RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
|
---|
669 |
|
---|
670 | /* The following are soon to be obsoleted: */
|
---|
671 | VMMR3DECL(int) DBGFR3ModuleLoad(PVM pVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage);
|
---|
672 | VMMR3DECL(void) DBGFR3ModuleRelocate(PVM pVM, RTGCUINTPTR OldImageBase, RTGCUINTPTR NewImageBase, RTGCUINTPTR cbImage,
|
---|
673 | const char *pszFilename, const char *pszName);
|
---|
674 | VMMR3DECL(int) DBGFR3SymbolAdd(PVM pVM, RTGCUINTPTR ModuleAddress, RTGCUINTPTR SymbolAddress, RTUINT cbSymbol, const char *pszSymbol);
|
---|
675 | VMMR3DECL(int) DBGFR3SymbolByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFSYMBOL pSymbol);
|
---|
676 | VMMR3DECL(int) DBGFR3SymbolByName(PVM pVM, const char *pszSymbol, PDBGFSYMBOL pSymbol);
|
---|
677 |
|
---|
678 | VMMR3DECL(int) DBGFR3LineByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine);
|
---|
679 | VMMR3DECL(PDBGFLINE) DBGFR3LineByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
|
---|
680 | VMMR3DECL(void) DBGFR3LineFree(PDBGFLINE pLine);
|
---|
681 |
|
---|
682 | #endif /* IN_RING3 */
|
---|
683 |
|
---|
684 | #ifdef IN_RING3 /* The stack API only works in ring-3. */
|
---|
685 |
|
---|
686 | /**
|
---|
687 | * Return type.
|
---|
688 | */
|
---|
689 | typedef enum DBGFRETRUNTYPE
|
---|
690 | {
|
---|
691 | /** The usual invalid 0 value. */
|
---|
692 | DBGFRETURNTYPE_INVALID = 0,
|
---|
693 | /** Near 16-bit return. */
|
---|
694 | DBGFRETURNTYPE_NEAR16,
|
---|
695 | /** Near 32-bit return. */
|
---|
696 | DBGFRETURNTYPE_NEAR32,
|
---|
697 | /** Near 64-bit return. */
|
---|
698 | DBGFRETURNTYPE_NEAR64,
|
---|
699 | /** Far 16:16 return. */
|
---|
700 | DBGFRETURNTYPE_FAR16,
|
---|
701 | /** Far 16:32 return. */
|
---|
702 | DBGFRETURNTYPE_FAR32,
|
---|
703 | /** Far 16:64 return. */
|
---|
704 | DBGFRETURNTYPE_FAR64,
|
---|
705 | /** 16-bit iret return (e.g. real or 286 protect mode). */
|
---|
706 | DBGFRETURNTYPE_IRET16,
|
---|
707 | /** 32-bit iret return. */
|
---|
708 | DBGFRETURNTYPE_IRET32,
|
---|
709 | /** 32-bit iret return. */
|
---|
710 | DBGFRETURNTYPE_IRET32_PRIV,
|
---|
711 | /** 32-bit iret return to V86 mode. */
|
---|
712 | DBGFRETURNTYPE_IRET32_V86,
|
---|
713 | /** @todo 64-bit iret return. */
|
---|
714 | DBGFRETURNTYPE_IRET64,
|
---|
715 | /** The end of the valid return types. */
|
---|
716 | DBGFRETURNTYPE_END,
|
---|
717 | /** The usual 32-bit blowup. */
|
---|
718 | DBGFRETURNTYPE_32BIT_HACK = 0x7fffffff
|
---|
719 | } DBGFRETURNTYPE;
|
---|
720 |
|
---|
721 | /**
|
---|
722 | * Figures the size of the return state on the stack.
|
---|
723 | *
|
---|
724 | * @returns number of bytes. 0 if invalid parameter.
|
---|
725 | * @param enmRetType The type of return.
|
---|
726 | */
|
---|
727 | DECLINLINE(unsigned) DBGFReturnTypeSize(DBGFRETURNTYPE enmRetType)
|
---|
728 | {
|
---|
729 | switch (enmRetType)
|
---|
730 | {
|
---|
731 | case DBGFRETURNTYPE_NEAR16: return 2;
|
---|
732 | case DBGFRETURNTYPE_NEAR32: return 4;
|
---|
733 | case DBGFRETURNTYPE_NEAR64: return 8;
|
---|
734 | case DBGFRETURNTYPE_FAR16: return 4;
|
---|
735 | case DBGFRETURNTYPE_FAR32: return 4;
|
---|
736 | case DBGFRETURNTYPE_FAR64: return 8;
|
---|
737 | case DBGFRETURNTYPE_IRET16: return 6;
|
---|
738 | case DBGFRETURNTYPE_IRET32: return 4*3;
|
---|
739 | case DBGFRETURNTYPE_IRET32_PRIV: return 4*5;
|
---|
740 | case DBGFRETURNTYPE_IRET32_V86: return 4*9;
|
---|
741 | case DBGFRETURNTYPE_IRET64:
|
---|
742 | default:
|
---|
743 | return 0;
|
---|
744 | }
|
---|
745 | }
|
---|
746 |
|
---|
747 |
|
---|
748 | /** Pointer to stack frame info. */
|
---|
749 | typedef struct DBGFSTACKFRAME *PDBGFSTACKFRAME;
|
---|
750 | /** Pointer to const stack frame info. */
|
---|
751 | typedef struct DBGFSTACKFRAME const *PCDBGFSTACKFRAME;
|
---|
752 | /**
|
---|
753 | * Info about a stack frame.
|
---|
754 | */
|
---|
755 | typedef struct DBGFSTACKFRAME
|
---|
756 | {
|
---|
757 | /** Frame number. */
|
---|
758 | uint32_t iFrame;
|
---|
759 | /** Frame flags. */
|
---|
760 | uint32_t fFlags;
|
---|
761 | /** The frame address.
|
---|
762 | * The off member is [e|r]bp and the Sel member is ss. */
|
---|
763 | DBGFADDRESS AddrFrame;
|
---|
764 | /** The stack address of the frame.
|
---|
765 | * The off member is [e|r]sp and the Sel member is ss. */
|
---|
766 | DBGFADDRESS AddrStack;
|
---|
767 | /** The program counter (PC) address of the frame.
|
---|
768 | * The off member is [e|r]ip and the Sel member is cs. */
|
---|
769 | DBGFADDRESS AddrPC;
|
---|
770 | /** Pointer to the symbol nearest the program counter (PC). NULL if not found. */
|
---|
771 | PRTDBGSYMBOL pSymPC;
|
---|
772 | /** Pointer to the linnumber nearest the program counter (PC). NULL if not found. */
|
---|
773 | PDBGFLINE pLinePC;
|
---|
774 |
|
---|
775 | /** The return frame address.
|
---|
776 | * The off member is [e|r]bp and the Sel member is ss. */
|
---|
777 | DBGFADDRESS AddrReturnFrame;
|
---|
778 | /** The return stack address.
|
---|
779 | * The off member is [e|r]sp and the Sel member is ss. */
|
---|
780 | DBGFADDRESS AddrReturnStack;
|
---|
781 | /** The way this frame returns to the next one. */
|
---|
782 | DBGFRETURNTYPE enmReturnType;
|
---|
783 |
|
---|
784 | /** The program counter (PC) address which the frame returns to.
|
---|
785 | * The off member is [e|r]ip and the Sel member is cs. */
|
---|
786 | DBGFADDRESS AddrReturnPC;
|
---|
787 | /** Pointer to the symbol nearest the return PC. NULL if not found. */
|
---|
788 | PRTDBGSYMBOL pSymReturnPC;
|
---|
789 | /** Pointer to the linnumber nearest the return PC. NULL if not found. */
|
---|
790 | PDBGFLINE pLineReturnPC;
|
---|
791 |
|
---|
792 | /** 32-bytes of stack arguments. */
|
---|
793 | union
|
---|
794 | {
|
---|
795 | /** 64-bit view */
|
---|
796 | uint64_t au64[4];
|
---|
797 | /** 32-bit view */
|
---|
798 | uint32_t au32[8];
|
---|
799 | /** 16-bit view */
|
---|
800 | uint16_t au16[16];
|
---|
801 | /** 8-bit view */
|
---|
802 | uint8_t au8[32];
|
---|
803 | } Args;
|
---|
804 |
|
---|
805 | /** Pointer to the next frame.
|
---|
806 | * Might not be used in some cases, so consider it internal. */
|
---|
807 | PCDBGFSTACKFRAME pNextInternal;
|
---|
808 | /** Pointer to the first frame.
|
---|
809 | * Might not be used in some cases, so consider it internal. */
|
---|
810 | PCDBGFSTACKFRAME pFirstInternal;
|
---|
811 | } DBGFSTACKFRAME;
|
---|
812 |
|
---|
813 | /** @name DBGFSTACKFRAME Flags.
|
---|
814 | * @{ */
|
---|
815 | /** Set if the content of the frame is filled in by DBGFR3StackWalk() and can be used
|
---|
816 | * to construct the next frame. */
|
---|
817 | # define DBGFSTACKFRAME_FLAGS_ALL_VALID RT_BIT(0)
|
---|
818 | /** This is the last stack frame we can read.
|
---|
819 | * This flag is not set if the walk stop because of max dept or recursion. */
|
---|
820 | # define DBGFSTACKFRAME_FLAGS_LAST RT_BIT(1)
|
---|
821 | /** This is the last record because we detected a loop. */
|
---|
822 | # define DBGFSTACKFRAME_FLAGS_LOOP RT_BIT(2)
|
---|
823 | /** This is the last record because we reached the maximum depth. */
|
---|
824 | # define DBGFSTACKFRAME_FLAGS_MAX_DEPTH RT_BIT(3)
|
---|
825 | /** 16-bit frame. */
|
---|
826 | # define DBGFSTACKFRAME_FLAGS_16BIT RT_BIT(4)
|
---|
827 | /** 32-bit frame. */
|
---|
828 | # define DBGFSTACKFRAME_FLAGS_32BIT RT_BIT(5)
|
---|
829 | /** 64-bit frame. */
|
---|
830 | # define DBGFSTACKFRAME_FLAGS_64BIT RT_BIT(6)
|
---|
831 | /** @} */
|
---|
832 |
|
---|
833 | /** @name DBGFCODETYPE
|
---|
834 | * @{ */
|
---|
835 | typedef enum DBGFCODETYPE
|
---|
836 | {
|
---|
837 | /** The usual invalid 0 value. */
|
---|
838 | DBGFCODETYPE_INVALID = 0,
|
---|
839 | /** Stack walk for guest code. */
|
---|
840 | DBGFCODETYPE_GUEST,
|
---|
841 | /** Stack walk for hypervisor code. */
|
---|
842 | DBGFCODETYPE_HYPER,
|
---|
843 | /** Stack walk for ring 0 code. */
|
---|
844 | DBGFCODETYPE_RING0,
|
---|
845 | /** The usual 32-bit blowup. */
|
---|
846 | DBGFCODETYPE_32BIT_HACK = 0x7fffffff
|
---|
847 | } DBGFCODETYPE;
|
---|
848 | /** @} */
|
---|
849 |
|
---|
850 | VMMR3DECL(int) DBGFR3StackWalkBegin(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame);
|
---|
851 | VMMR3DECL(int) DBGFR3StackWalkBeginEx(PVM pVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFADDRESS pAddrFrame,
|
---|
852 | PCDBGFADDRESS pAddrStack,PCDBGFADDRESS pAddrPC,
|
---|
853 | DBGFRETURNTYPE enmReturnType, PCDBGFSTACKFRAME *ppFirstFrame);
|
---|
854 | VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent);
|
---|
855 | VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame);
|
---|
856 |
|
---|
857 | #endif /* IN_RING3 */
|
---|
858 |
|
---|
859 |
|
---|
860 | #ifdef IN_RING3 /* The disassembly API only works in ring-3. */
|
---|
861 |
|
---|
862 | /** Flags to pass to DBGFR3DisasInstrEx().
|
---|
863 | * @{ */
|
---|
864 | /** Disassemble the current guest instruction, with annotations. */
|
---|
865 | #define DBGF_DISAS_FLAGS_CURRENT_GUEST RT_BIT(0)
|
---|
866 | /** Disassemble the current hypervisor instruction, with annotations. */
|
---|
867 | #define DBGF_DISAS_FLAGS_CURRENT_HYPER RT_BIT(1)
|
---|
868 | /** No annotations for current context. */
|
---|
869 | #define DBGF_DISAS_FLAGS_NO_ANNOTATION RT_BIT(2)
|
---|
870 | /** No symbol lookup. */
|
---|
871 | #define DBGF_DISAS_FLAGS_NO_SYMBOLS RT_BIT(3)
|
---|
872 | /** No instruction bytes. */
|
---|
873 | #define DBGF_DISAS_FLAGS_NO_BYTES RT_BIT(4)
|
---|
874 | /** No address in the output. */
|
---|
875 | #define DBGF_DISAS_FLAGS_NO_ADDRESS RT_BIT(5)
|
---|
876 | /** Disassemble in the default mode of the specific context. */
|
---|
877 | #define DBGF_DISAS_FLAGS_DEFAULT_MODE UINT32_C(0x00000000)
|
---|
878 | /** Disassemble in 16-bit mode. */
|
---|
879 | #define DBGF_DISAS_FLAGS_16BIT_MODE UINT32_C(0x10000000)
|
---|
880 | /** Disassemble in 16-bit mode with real mode address translation. */
|
---|
881 | #define DBGF_DISAS_FLAGS_16BIT_REAL_MODE UINT32_C(0x20000000)
|
---|
882 | /** Disassemble in 32-bit mode. */
|
---|
883 | #define DBGF_DISAS_FLAGS_32BIT_MODE UINT32_C(0x30000000)
|
---|
884 | /** Disassemble in 64-bit mode. */
|
---|
885 | #define DBGF_DISAS_FLAGS_64BIT_MODE UINT32_C(0x40000000)
|
---|
886 | /** The disassembly mode mask. */
|
---|
887 | #define DBGF_DISAS_FLAGS_MODE_MASK UINT32_C(0x70000000)
|
---|
888 | /** Mask containing the valid flags. */
|
---|
889 | #define DBGF_DISAS_FLAGS_VALID_MASK UINT32_C(0x7000007f)
|
---|
890 | /** @} */
|
---|
891 |
|
---|
892 | /** Special flat selector. */
|
---|
893 | #define DBGF_SEL_FLAT 1
|
---|
894 |
|
---|
895 | VMMR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, uint32_t fFlags,
|
---|
896 | char *pszOutput, uint32_t cbOutput, uint32_t *pcbInstr);
|
---|
897 | VMMR3DECL(int) DBGFR3DisasInstrCurrent(PVMCPU pVCpu, char *pszOutput, uint32_t cbOutput);
|
---|
898 | VMMR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVMCPU pVCpu, const char *pszPrefix);
|
---|
899 |
|
---|
900 | /** @def DBGFR3DisasInstrCurrentLog
|
---|
901 | * Disassembles the current guest context instruction and writes it to the log.
|
---|
902 | * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
|
---|
903 | */
|
---|
904 | #ifdef LOG_ENABLED
|
---|
905 | # define DBGFR3DisasInstrCurrentLog(pVCpu, pszPrefix) \
|
---|
906 | do { \
|
---|
907 | if (LogIsEnabled()) \
|
---|
908 | DBGFR3DisasInstrCurrentLogInternal(pVCpu, pszPrefix); \
|
---|
909 | } while (0)
|
---|
910 | #else
|
---|
911 | # define DBGFR3DisasInstrCurrentLog(pVCpu, pszPrefix) do { } while (0)
|
---|
912 | #endif
|
---|
913 |
|
---|
914 | VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr, const char *pszPrefix);
|
---|
915 |
|
---|
916 | /** @def DBGFR3DisasInstrLog
|
---|
917 | * Disassembles the specified guest context instruction and writes it to the log.
|
---|
918 | * Addresses will be attempted resolved to symbols.
|
---|
919 | * @thread Any EMT.
|
---|
920 | */
|
---|
921 | # ifdef LOG_ENABLED
|
---|
922 | # define DBGFR3DisasInstrLog(pVCpu, Sel, GCPtr, pszPrefix) \
|
---|
923 | do { \
|
---|
924 | if (LogIsEnabled()) \
|
---|
925 | DBGFR3DisasInstrLogInternal(pVCpu, Sel, GCPtr, pszPrefix); \
|
---|
926 | } while (0)
|
---|
927 | # else
|
---|
928 | # define DBGFR3DisasInstrLog(pVCpu, Sel, GCPtr, pszPrefix) do { } while (0)
|
---|
929 | # endif
|
---|
930 | #endif
|
---|
931 |
|
---|
932 |
|
---|
933 | #ifdef IN_RING3
|
---|
934 | VMMR3DECL(int) DBGFR3MemScan(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, RTGCUINTPTR uAlign,
|
---|
935 | const void *pvNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress);
|
---|
936 | VMMR3DECL(int) DBGFR3MemRead(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead);
|
---|
937 | VMMR3DECL(int) DBGFR3MemReadString(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cbBuf);
|
---|
938 | VMMR3DECL(int) DBGFR3MemWrite(PVM pVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void const *pvBuf, size_t cbRead);
|
---|
939 | #endif
|
---|
940 |
|
---|
941 |
|
---|
942 | /** @name Flags for DBGFR3PagingDumpEx, PGMR3DumpHierarchyHCEx and
|
---|
943 | * PGMR3DumpHierarchyGCEx
|
---|
944 | * @{ */
|
---|
945 | /** The CR3 from the current CPU state. */
|
---|
946 | #define DBGFPGDMP_FLAGS_CURRENT_CR3 RT_BIT_32(0)
|
---|
947 | /** The current CPU paging mode (PSE, PAE, LM, EPT, NX). */
|
---|
948 | #define DBGFPGDMP_FLAGS_CURRENT_MODE RT_BIT_32(1)
|
---|
949 | /** Whether PSE is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
950 | * Same value as X86_CR4_PSE. */
|
---|
951 | #define DBGFPGDMP_FLAGS_PSE RT_BIT_32(4) /* */
|
---|
952 | /** Whether PAE is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
953 | * Same value as X86_CR4_PAE. */
|
---|
954 | #define DBGFPGDMP_FLAGS_PAE RT_BIT_32(5) /* */
|
---|
955 | /** Whether LME is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
956 | * Same value as MSR_K6_EFER_LME. */
|
---|
957 | #define DBGFPGDMP_FLAGS_LME RT_BIT_32(8)
|
---|
958 | /** Whether nested paging is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE). */
|
---|
959 | #define DBGFPGDMP_FLAGS_NP RT_BIT_32(9)
|
---|
960 | /** Whether extended nested page tables are enabled
|
---|
961 | * (!DBGFPGDMP_FLAGS_CURRENT_STATE). */
|
---|
962 | #define DBGFPGDMP_FLAGS_EPT RT_BIT_32(10)
|
---|
963 | /** Whether no-execution is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
964 | * Same value as MSR_K6_EFER_NXE. */
|
---|
965 | #define DBGFPGDMP_FLAGS_NXE RT_BIT_32(11)
|
---|
966 | /** Whether to print the CR3. */
|
---|
967 | #define DBGFPGDMP_FLAGS_PRINT_CR3 RT_BIT_32(27)
|
---|
968 | /** Whether to print the header. */
|
---|
969 | #define DBGFPGDMP_FLAGS_HEADER RT_BIT_32(28)
|
---|
970 | /** Whether to dump additional page information. */
|
---|
971 | #define DBGFPGDMP_FLAGS_PAGE_INFO RT_BIT_32(29)
|
---|
972 | /** Dump the shadow tables if set.
|
---|
973 | * Cannot be used together with DBGFPGDMP_FLAGS_GUEST. */
|
---|
974 | #define DBGFPGDMP_FLAGS_SHADOW RT_BIT_32(30)
|
---|
975 | /** Dump the guest tables if set.
|
---|
976 | * Cannot be used together with DBGFPGDMP_FLAGS_SHADOW. */
|
---|
977 | #define DBGFPGDMP_FLAGS_GUEST RT_BIT_32(31)
|
---|
978 | /** Mask of valid bits. */
|
---|
979 | #define DBGFPGDMP_FLAGS_VALID_MASK UINT32_C(0xf8000f33)
|
---|
980 | /** The mask of bits controlling the paging mode. */
|
---|
981 | #define DBGFPGDMP_FLAGS_MODE_MASK UINT32_C(0x00000f32)
|
---|
982 | /** @} */
|
---|
983 | VMMDECL(int) DBGFR3PagingDumpEx(PVM pVM, VMCPUID idCpu, uint32_t fFlags, uint64_t cr3, uint64_t u64FirstAddr,
|
---|
984 | uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
|
---|
985 |
|
---|
986 |
|
---|
987 | /** @name DBGFR3SelQueryInfo flags.
|
---|
988 | * @{ */
|
---|
989 | /** Get the info from the guest descriptor table. */
|
---|
990 | #define DBGFSELQI_FLAGS_DT_GUEST UINT32_C(0)
|
---|
991 | /** Get the info from the shadow descriptor table.
|
---|
992 | * Only works in raw-mode. */
|
---|
993 | #define DBGFSELQI_FLAGS_DT_SHADOW UINT32_C(1)
|
---|
994 | /** If currently executing in in 64-bit mode, blow up data selectors. */
|
---|
995 | #define DBGFSELQI_FLAGS_DT_ADJ_64BIT_MODE UINT32_C(2)
|
---|
996 | /** @} */
|
---|
997 | VMMR3DECL(int) DBGFR3SelQueryInfo(PVM pVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo);
|
---|
998 |
|
---|
999 |
|
---|
1000 | /**
|
---|
1001 | * Register identifiers.
|
---|
1002 | */
|
---|
1003 | typedef enum DBGFREG
|
---|
1004 | {
|
---|
1005 | /* General purpose registers: */
|
---|
1006 | DBGFREG_AL = 0,
|
---|
1007 | DBGFREG_AX = DBGFREG_AL,
|
---|
1008 | DBGFREG_EAX = DBGFREG_AL,
|
---|
1009 | DBGFREG_RAX = DBGFREG_AL,
|
---|
1010 |
|
---|
1011 | DBGFREG_CL,
|
---|
1012 | DBGFREG_CX = DBGFREG_CL,
|
---|
1013 | DBGFREG_ECX = DBGFREG_CL,
|
---|
1014 | DBGFREG_RCX = DBGFREG_CL,
|
---|
1015 |
|
---|
1016 | DBGFREG_DL,
|
---|
1017 | DBGFREG_DX = DBGFREG_DL,
|
---|
1018 | DBGFREG_EDX = DBGFREG_DL,
|
---|
1019 | DBGFREG_RDX = DBGFREG_DL,
|
---|
1020 |
|
---|
1021 | DBGFREG_BL,
|
---|
1022 | DBGFREG_BX = DBGFREG_BL,
|
---|
1023 | DBGFREG_EBX = DBGFREG_BL,
|
---|
1024 | DBGFREG_RBX = DBGFREG_BL,
|
---|
1025 |
|
---|
1026 | DBGFREG_SPL,
|
---|
1027 | DBGFREG_SP = DBGFREG_SPL,
|
---|
1028 | DBGFREG_ESP = DBGFREG_SPL,
|
---|
1029 | DBGFREG_RSP = DBGFREG_SPL,
|
---|
1030 |
|
---|
1031 | DBGFREG_BPL,
|
---|
1032 | DBGFREG_BP = DBGFREG_BPL,
|
---|
1033 | DBGFREG_EBP = DBGFREG_BPL,
|
---|
1034 | DBGFREG_RBP = DBGFREG_BPL,
|
---|
1035 |
|
---|
1036 | DBGFREG_SIL,
|
---|
1037 | DBGFREG_SI = DBGFREG_SIL,
|
---|
1038 | DBGFREG_ESI = DBGFREG_SIL,
|
---|
1039 | DBGFREG_RSI = DBGFREG_SIL,
|
---|
1040 |
|
---|
1041 | DBGFREG_DIL,
|
---|
1042 | DBGFREG_DI = DBGFREG_DIL,
|
---|
1043 | DBGFREG_EDI = DBGFREG_DIL,
|
---|
1044 | DBGFREG_RDI = DBGFREG_DIL,
|
---|
1045 |
|
---|
1046 | DBGFREG_R8,
|
---|
1047 | DBGFREG_R8B = DBGFREG_R8,
|
---|
1048 | DBGFREG_R8W = DBGFREG_R8,
|
---|
1049 | DBGFREG_R8D = DBGFREG_R8,
|
---|
1050 |
|
---|
1051 | DBGFREG_R9,
|
---|
1052 | DBGFREG_R9B = DBGFREG_R9,
|
---|
1053 | DBGFREG_R9W = DBGFREG_R9,
|
---|
1054 | DBGFREG_R9D = DBGFREG_R9,
|
---|
1055 |
|
---|
1056 | DBGFREG_R10,
|
---|
1057 | DBGFREG_R10B = DBGFREG_R10,
|
---|
1058 | DBGFREG_R10W = DBGFREG_R10,
|
---|
1059 | DBGFREG_R10D = DBGFREG_R10,
|
---|
1060 |
|
---|
1061 | DBGFREG_R11,
|
---|
1062 | DBGFREG_R11B = DBGFREG_R11,
|
---|
1063 | DBGFREG_R11W = DBGFREG_R11,
|
---|
1064 | DBGFREG_R11D = DBGFREG_R11,
|
---|
1065 |
|
---|
1066 | DBGFREG_R12,
|
---|
1067 | DBGFREG_R12B = DBGFREG_R12,
|
---|
1068 | DBGFREG_R12W = DBGFREG_R12,
|
---|
1069 | DBGFREG_R12D = DBGFREG_R12,
|
---|
1070 |
|
---|
1071 | DBGFREG_R13,
|
---|
1072 | DBGFREG_R13B = DBGFREG_R13,
|
---|
1073 | DBGFREG_R13W = DBGFREG_R13,
|
---|
1074 | DBGFREG_R13D = DBGFREG_R13,
|
---|
1075 |
|
---|
1076 | DBGFREG_R14,
|
---|
1077 | DBGFREG_R14B = DBGFREG_R14,
|
---|
1078 | DBGFREG_R14W = DBGFREG_R14,
|
---|
1079 | DBGFREG_R14D = DBGFREG_R14,
|
---|
1080 |
|
---|
1081 | DBGFREG_R15,
|
---|
1082 | DBGFREG_R15B = DBGFREG_R15,
|
---|
1083 | DBGFREG_R15W = DBGFREG_R15,
|
---|
1084 | DBGFREG_R15D = DBGFREG_R15,
|
---|
1085 |
|
---|
1086 | /* Segments and other special registers: */
|
---|
1087 | DBGFREG_CS,
|
---|
1088 | DBGFREG_CS_ATTR,
|
---|
1089 | DBGFREG_CS_BASE,
|
---|
1090 | DBGFREG_CS_LIMIT,
|
---|
1091 |
|
---|
1092 | DBGFREG_DS,
|
---|
1093 | DBGFREG_DS_ATTR,
|
---|
1094 | DBGFREG_DS_BASE,
|
---|
1095 | DBGFREG_DS_LIMIT,
|
---|
1096 |
|
---|
1097 | DBGFREG_ES,
|
---|
1098 | DBGFREG_ES_ATTR,
|
---|
1099 | DBGFREG_ES_BASE,
|
---|
1100 | DBGFREG_ES_LIMIT,
|
---|
1101 |
|
---|
1102 | DBGFREG_FS,
|
---|
1103 | DBGFREG_FS_ATTR,
|
---|
1104 | DBGFREG_FS_BASE,
|
---|
1105 | DBGFREG_FS_LIMIT,
|
---|
1106 |
|
---|
1107 | DBGFREG_GS,
|
---|
1108 | DBGFREG_GS_ATTR,
|
---|
1109 | DBGFREG_GS_BASE,
|
---|
1110 | DBGFREG_GS_LIMIT,
|
---|
1111 |
|
---|
1112 | DBGFREG_SS,
|
---|
1113 | DBGFREG_SS_ATTR,
|
---|
1114 | DBGFREG_SS_BASE,
|
---|
1115 | DBGFREG_SS_LIMIT,
|
---|
1116 |
|
---|
1117 | DBGFREG_IP,
|
---|
1118 | DBGFREG_EIP = DBGFREG_IP,
|
---|
1119 | DBGFREG_RIP = DBGFREG_IP,
|
---|
1120 |
|
---|
1121 | DBGFREG_FLAGS,
|
---|
1122 | DBGFREG_EFLAGS = DBGFREG_FLAGS,
|
---|
1123 | DBGFREG_RFLAGS = DBGFREG_FLAGS,
|
---|
1124 |
|
---|
1125 | /* FPU: */
|
---|
1126 | DBGFREG_FCW,
|
---|
1127 | DBGFREG_FSW,
|
---|
1128 | DBGFREG_FTW,
|
---|
1129 | DBGFREG_FOP,
|
---|
1130 | DBGFREG_FPUIP,
|
---|
1131 | DBGFREG_FPUCS,
|
---|
1132 | DBGFREG_FPUDP,
|
---|
1133 | DBGFREG_FPUDS,
|
---|
1134 | DBGFREG_MXCSR,
|
---|
1135 | DBGFREG_MXCSR_MASK,
|
---|
1136 |
|
---|
1137 | DBGFREG_ST0,
|
---|
1138 | DBGFREG_ST1,
|
---|
1139 | DBGFREG_ST2,
|
---|
1140 | DBGFREG_ST3,
|
---|
1141 | DBGFREG_ST4,
|
---|
1142 | DBGFREG_ST5,
|
---|
1143 | DBGFREG_ST6,
|
---|
1144 | DBGFREG_ST7,
|
---|
1145 |
|
---|
1146 | DBGFREG_MM0,
|
---|
1147 | DBGFREG_MM1,
|
---|
1148 | DBGFREG_MM2,
|
---|
1149 | DBGFREG_MM3,
|
---|
1150 | DBGFREG_MM4,
|
---|
1151 | DBGFREG_MM5,
|
---|
1152 | DBGFREG_MM6,
|
---|
1153 | DBGFREG_MM7,
|
---|
1154 |
|
---|
1155 | /* SSE: */
|
---|
1156 | DBGFREG_XMM0,
|
---|
1157 | DBGFREG_XMM1,
|
---|
1158 | DBGFREG_XMM2,
|
---|
1159 | DBGFREG_XMM3,
|
---|
1160 | DBGFREG_XMM4,
|
---|
1161 | DBGFREG_XMM5,
|
---|
1162 | DBGFREG_XMM6,
|
---|
1163 | DBGFREG_XMM7,
|
---|
1164 | DBGFREG_XMM8,
|
---|
1165 | DBGFREG_XMM9,
|
---|
1166 | DBGFREG_XMM10,
|
---|
1167 | DBGFREG_XMM11,
|
---|
1168 | DBGFREG_XMM12,
|
---|
1169 | DBGFREG_XMM13,
|
---|
1170 | DBGFREG_XMM14,
|
---|
1171 | DBGFREG_XMM15,
|
---|
1172 | /** @todo add XMM aliases. */
|
---|
1173 |
|
---|
1174 | /* System registers: */
|
---|
1175 | DBGFREG_GDTR_BASE,
|
---|
1176 | DBGFREG_GDTR_LIMIT,
|
---|
1177 | DBGFREG_IDTR_BASE,
|
---|
1178 | DBGFREG_IDTR_LIMIT,
|
---|
1179 | DBGFREG_LDTR,
|
---|
1180 | DBGFREG_LDTR_ATTR,
|
---|
1181 | DBGFREG_LDTR_BASE,
|
---|
1182 | DBGFREG_LDTR_LIMIT,
|
---|
1183 | DBGFREG_TR,
|
---|
1184 | DBGFREG_TR_ATTR,
|
---|
1185 | DBGFREG_TR_BASE,
|
---|
1186 | DBGFREG_TR_LIMIT,
|
---|
1187 |
|
---|
1188 | DBGFREG_CR0,
|
---|
1189 | DBGFREG_CR2,
|
---|
1190 | DBGFREG_CR3,
|
---|
1191 | DBGFREG_CR4,
|
---|
1192 | DBGFREG_CR8,
|
---|
1193 |
|
---|
1194 | DBGFREG_DR0,
|
---|
1195 | DBGFREG_DR1,
|
---|
1196 | DBGFREG_DR2,
|
---|
1197 | DBGFREG_DR3,
|
---|
1198 | DBGFREG_DR6,
|
---|
1199 | DBGFREG_DR7,
|
---|
1200 |
|
---|
1201 | /* MSRs: */
|
---|
1202 | DBGFREG_MSR_IA32_APICBASE,
|
---|
1203 | DBGFREG_MSR_IA32_CR_PAT,
|
---|
1204 | DBGFREG_MSR_IA32_PERF_STATUS,
|
---|
1205 | DBGFREG_MSR_IA32_SYSENTER_CS,
|
---|
1206 | DBGFREG_MSR_IA32_SYSENTER_EIP,
|
---|
1207 | DBGFREG_MSR_IA32_SYSENTER_ESP,
|
---|
1208 | DBGFREG_MSR_IA32_TSC,
|
---|
1209 | DBGFREG_MSR_K6_EFER,
|
---|
1210 | DBGFREG_MSR_K6_STAR,
|
---|
1211 | DBGFREG_MSR_K8_CSTAR,
|
---|
1212 | DBGFREG_MSR_K8_FS_BASE,
|
---|
1213 | DBGFREG_MSR_K8_GS_BASE,
|
---|
1214 | DBGFREG_MSR_K8_KERNEL_GS_BASE,
|
---|
1215 | DBGFREG_MSR_K8_LSTAR,
|
---|
1216 | DBGFREG_MSR_K8_SF_MASK,
|
---|
1217 | DBGFREG_MSR_K8_TSC_AUX,
|
---|
1218 |
|
---|
1219 | /** The number of registers to pass to DBGFR3RegQueryAll. */
|
---|
1220 | DBGFREG_ALL_COUNT,
|
---|
1221 |
|
---|
1222 | /* Misc aliases that doesn't need be part of the 'all' query: */
|
---|
1223 | DBGFREG_AH = DBGFREG_ALL_COUNT,
|
---|
1224 | DBGFREG_CH,
|
---|
1225 | DBGFREG_DH,
|
---|
1226 | DBGFREG_BH,
|
---|
1227 | DBGFREG_GDTR,
|
---|
1228 | DBGFREG_IDTR,
|
---|
1229 |
|
---|
1230 | /** The end of the registers. */
|
---|
1231 | DBGFREG_END,
|
---|
1232 | /** The usual 32-bit type hack. */
|
---|
1233 | DBGFREG_32BIT_HACK = 0x7fffffff
|
---|
1234 | } DBGFREG;
|
---|
1235 | /** Pointer to a register identifier. */
|
---|
1236 | typedef DBGFREG *PDBGFREG;
|
---|
1237 | /** Pointer to a const register identifier. */
|
---|
1238 | typedef DBGFREG const *PCDBGFREG;
|
---|
1239 |
|
---|
1240 | /**
|
---|
1241 | * Register value type.
|
---|
1242 | */
|
---|
1243 | typedef enum DBGFREGVALTYPE
|
---|
1244 | {
|
---|
1245 | DBGFREGVALTYPE_INVALID = 0,
|
---|
1246 | /** Unsigned 8-bit register value. */
|
---|
1247 | DBGFREGVALTYPE_U8,
|
---|
1248 | /** Unsigned 16-bit register value. */
|
---|
1249 | DBGFREGVALTYPE_U16,
|
---|
1250 | /** Unsigned 32-bit register value. */
|
---|
1251 | DBGFREGVALTYPE_U32,
|
---|
1252 | /** Unsigned 64-bit register value. */
|
---|
1253 | DBGFREGVALTYPE_U64,
|
---|
1254 | /** Unsigned 128-bit register value. */
|
---|
1255 | DBGFREGVALTYPE_U128,
|
---|
1256 | /** Long double register value. */
|
---|
1257 | DBGFREGVALTYPE_R80,
|
---|
1258 | /** Descriptor table register value. */
|
---|
1259 | DBGFREGVALTYPE_DTR,
|
---|
1260 | /** End of the valid register value types. */
|
---|
1261 | DBGFREGVALTYPE_END,
|
---|
1262 | /** The usual 32-bit type hack. */
|
---|
1263 | DBGFREGVALTYPE_32BIT_HACK = 0x7fffffff
|
---|
1264 | } DBGFREGVALTYPE;
|
---|
1265 | /** Pointer to a register value type. */
|
---|
1266 | typedef DBGFREGVALTYPE *PDBGFREGVALTYPE;
|
---|
1267 |
|
---|
1268 | /**
|
---|
1269 | * A generic register value type.
|
---|
1270 | */
|
---|
1271 | typedef union DBGFREGVAL
|
---|
1272 | {
|
---|
1273 | uint8_t u8; /**< The 8-bit view. */
|
---|
1274 | uint16_t u16; /**< The 16-bit view. */
|
---|
1275 | uint32_t u32; /**< The 32-bit view. */
|
---|
1276 | uint64_t u64; /**< The 64-bit view. */
|
---|
1277 | RTUINT128U u128; /**< The 128-bit view. */
|
---|
1278 | RTFLOAT80U r80; /**< The 80-bit floating point view. */
|
---|
1279 | RTFLOAT80U2 r80Ex; /**< The 80-bit floating point view v2. */
|
---|
1280 | /** GDTR or LDTR (DBGFREGVALTYPE_DTR). */
|
---|
1281 | struct
|
---|
1282 | {
|
---|
1283 | /** The table address. */
|
---|
1284 | uint64_t u64Base;
|
---|
1285 | /** The table limit (length minus 1). */
|
---|
1286 | uint32_t u32Limit;
|
---|
1287 | } dtr;
|
---|
1288 |
|
---|
1289 | uint8_t au8[16]; /**< The 8-bit array view. */
|
---|
1290 | uint16_t au16[8]; /**< The 16-bit array view. */
|
---|
1291 | uint32_t au32[4]; /**< The 32-bit array view. */
|
---|
1292 | uint64_t au64[2]; /**< The 64-bit array view. */
|
---|
1293 | RTUINT128U u;
|
---|
1294 | } DBGFREGVAL;
|
---|
1295 | /** Pointer to a generic register value type. */
|
---|
1296 | typedef DBGFREGVAL *PDBGFREGVAL;
|
---|
1297 | /** Pointer to a const generic register value type. */
|
---|
1298 | typedef DBGFREGVAL const *PCDBGFREGVAL;
|
---|
1299 |
|
---|
1300 | VMMDECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial);
|
---|
1301 | VMMDECL(ssize_t) DBGFR3RegFormatValueEx(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType,
|
---|
1302 | unsigned uBase, signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
|
---|
1303 |
|
---|
1304 | /**
|
---|
1305 | * Register sub-field descriptor.
|
---|
1306 | */
|
---|
1307 | typedef struct DBGFREGSUBFIELD
|
---|
1308 | {
|
---|
1309 | /** The name of the sub-field. NULL is used to terminate the array. */
|
---|
1310 | const char *pszName;
|
---|
1311 | /** The index of the first bit. Ignored if pfnGet is set. */
|
---|
1312 | uint8_t iFirstBit;
|
---|
1313 | /** The number of bits. Mandatory. */
|
---|
1314 | uint8_t cBits;
|
---|
1315 | /** The shift count. Not applied when pfnGet is set, but used to
|
---|
1316 | * calculate the minimum type. */
|
---|
1317 | int8_t cShift;
|
---|
1318 | /** Sub-field flags, DBGFREGSUBFIELD_FLAGS_XXX. */
|
---|
1319 | uint8_t fFlags;
|
---|
1320 | /** Getter (optional). */
|
---|
1321 | DECLCALLBACKMEMBER(int, pfnGet)(void *pvUser, struct DBGFREGSUBFIELD const *pSubField, PRTUINT128U puValue);
|
---|
1322 | /** Setter (optional). */
|
---|
1323 | DECLCALLBACKMEMBER(int, pfnSet)(void *pvUser, struct DBGFREGSUBFIELD const *pSubField, RTUINT128U uValue, RTUINT128U fMask);
|
---|
1324 | } DBGFREGSUBFIELD;
|
---|
1325 | /** Pointer to a const register sub-field descriptor. */
|
---|
1326 | typedef DBGFREGSUBFIELD const *PCDBGFREGSUBFIELD;
|
---|
1327 |
|
---|
1328 | /** @name DBGFREGSUBFIELD_FLAGS_XXX
|
---|
1329 | * @{ */
|
---|
1330 | /** The sub-field is read-only. */
|
---|
1331 | #define DBGFREGSUBFIELD_FLAGS_READ_ONLY UINT8_C(0x01)
|
---|
1332 | /** @} */
|
---|
1333 |
|
---|
1334 | /** Macro for creating a read-write sub-field entry without getters. */
|
---|
1335 | #define DBGFREGSUBFIELD_RW(a_szName, a_iFirstBit, a_cBits, a_cShift) \
|
---|
1336 | { a_szName, a_iFirstBit, a_cBits, a_cShift, 0 /*fFlags*/, NULL /*pfnGet*/, NULL /*pfnSet*/ }
|
---|
1337 | /** Macro for creating a read-write sub-field entry with getters. */
|
---|
1338 | #define DBGFREGSUBFIELD_RW_SG(a_szName, a_cBits, a_cShift, a_pfnGet, a_pfnSet) \
|
---|
1339 | { a_szName, 0 /*iFirstBit*/, a_cBits, a_cShift, 0 /*fFlags*/, a_pfnGet, a_pfnSet }
|
---|
1340 | /** Macro for creating a terminator sub-field entry. */
|
---|
1341 | #define DBGFREGSUBFIELD_TERMINATOR() \
|
---|
1342 | { NULL, 0, 0, 0, 0, NULL, NULL }
|
---|
1343 |
|
---|
1344 | /**
|
---|
1345 | * Register alias descriptor.
|
---|
1346 | */
|
---|
1347 | typedef struct DBGFREGALIAS
|
---|
1348 | {
|
---|
1349 | /** The alias name. NULL is used to terminate the array. */
|
---|
1350 | const char *pszName;
|
---|
1351 | /** Set to a valid type if the alias has a different type. */
|
---|
1352 | DBGFREGVALTYPE enmType;
|
---|
1353 | } DBGFREGALIAS;
|
---|
1354 | /** Pointer to a const register alias descriptor. */
|
---|
1355 | typedef DBGFREGALIAS const *PCDBGFREGALIAS;
|
---|
1356 |
|
---|
1357 | /**
|
---|
1358 | * Register descriptor.
|
---|
1359 | */
|
---|
1360 | typedef struct DBGFREGDESC
|
---|
1361 | {
|
---|
1362 | /** The normal register name. */
|
---|
1363 | const char *pszName;
|
---|
1364 | /** The register identifier if this is a CPU register. */
|
---|
1365 | DBGFREG enmReg;
|
---|
1366 | /** The default register type. */
|
---|
1367 | DBGFREGVALTYPE enmType;
|
---|
1368 | /** Flags, see DBGFREG_FLAGS_XXX. */
|
---|
1369 | uint32_t fFlags;
|
---|
1370 | /** The internal register indicator.
|
---|
1371 | * For CPU registers this is the offset into the CPUMCTX structure,
|
---|
1372 | * thuse the 'off' prefix. */
|
---|
1373 | uint32_t offRegister;
|
---|
1374 | /** Getter. */
|
---|
1375 | DECLCALLBACKMEMBER(int, pfnGet)(void *pvUser, struct DBGFREGDESC const *pDesc, PDBGFREGVAL pValue);
|
---|
1376 | /** Setter. */
|
---|
1377 | DECLCALLBACKMEMBER(int, pfnSet)(void *pvUser, struct DBGFREGDESC const *pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask);
|
---|
1378 | /** Aliases (optional). */
|
---|
1379 | PCDBGFREGALIAS paAliases;
|
---|
1380 | /** Sub fields (optional). */
|
---|
1381 | PCDBGFREGSUBFIELD paSubFields;
|
---|
1382 | } DBGFREGDESC;
|
---|
1383 |
|
---|
1384 | /** @name Macros for constructing DBGFREGDESC arrays.
|
---|
1385 | * @{ */
|
---|
1386 | #define DBGFREGDESC_RW(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet) \
|
---|
1387 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, NULL /*paAlises*/, NULL /*paSubFields*/ }
|
---|
1388 | #define DBGFREGDESC_RO(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet) \
|
---|
1389 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, NULL /*paAlises*/, NULL /*paSubFields*/ }
|
---|
1390 | #define DBGFREGDESC_RW_A(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases) \
|
---|
1391 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, NULL /*paSubFields*/ }
|
---|
1392 | #define DBGFREGDESC_RO_A(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases) \
|
---|
1393 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, NULL /*paSubFields*/ }
|
---|
1394 | #define DBGFREGDESC_RW_S(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paSubFields) \
|
---|
1395 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, /*paAliases*/, a_paSubFields }
|
---|
1396 | #define DBGFREGDESC_RO_S(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paSubFields) \
|
---|
1397 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, /*paAliases*/, a_paSubFields }
|
---|
1398 | #define DBGFREGDESC_RW_AS(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
|
---|
1399 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
|
---|
1400 | #define DBGFREGDESC_RO_AS(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
|
---|
1401 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
|
---|
1402 | #define DBGFREGDESC_TERMINATOR() \
|
---|
1403 | { NULL, DBGFREG_END, DBGFREGVALTYPE_INVALID, 0, 0, NULL, NULL, NULL, NULL }
|
---|
1404 | /** @} */
|
---|
1405 |
|
---|
1406 |
|
---|
1407 | /** @name DBGFREG_FLAGS_XXX
|
---|
1408 | * @{ */
|
---|
1409 | /** The register is read-only. */
|
---|
1410 | #define DBGFREG_FLAGS_READ_ONLY RT_BIT_32(0)
|
---|
1411 | /** @} */
|
---|
1412 |
|
---|
1413 | /**
|
---|
1414 | * Entry in a batch query or set operation.
|
---|
1415 | */
|
---|
1416 | typedef struct DBGFREGENTRY
|
---|
1417 | {
|
---|
1418 | /** The register identifier. */
|
---|
1419 | DBGFREG enmReg;
|
---|
1420 | /** The size of the value in bytes. */
|
---|
1421 | DBGFREGVALTYPE enmType;
|
---|
1422 | /** The register value. The valid view is indicated by enmType. */
|
---|
1423 | DBGFREGVAL Val;
|
---|
1424 | } DBGFREGENTRY;
|
---|
1425 | /** Pointer to a register entry in a batch operation. */
|
---|
1426 | typedef DBGFREGENTRY *PDBGFREGENTRY;
|
---|
1427 | /** Pointer to a const register entry in a batch operation. */
|
---|
1428 | typedef DBGFREGENTRY const *PCDBGFREGENTRY;
|
---|
1429 |
|
---|
1430 | /** Used with DBGFR3Reg* to indicate the hypervisor register set instead of the
|
---|
1431 | * guest. */
|
---|
1432 | #define DBGFREG_HYPER_VMCPUID UINT32_C(0x01000000)
|
---|
1433 |
|
---|
1434 | VMMR3DECL(int) DBGFR3RegCpuQueryU8( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8);
|
---|
1435 | VMMR3DECL(int) DBGFR3RegCpuQueryU16( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16);
|
---|
1436 | VMMR3DECL(int) DBGFR3RegCpuQueryU32( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32);
|
---|
1437 | VMMR3DECL(int) DBGFR3RegCpuQueryU64( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64);
|
---|
1438 | VMMR3DECL(int) DBGFR3RegCpuQueryU128(PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint128_t *pu128);
|
---|
1439 | VMMR3DECL(int) DBGFR3RegCpuQueryLrd( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, long double *plrd);
|
---|
1440 | VMMR3DECL(int) DBGFR3RegCpuQueryXdtr(PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64Base, uint16_t *pu16Limit);
|
---|
1441 | #if 0
|
---|
1442 | VMMR3DECL(int) DBGFR3RegCpuQueryBatch(PVM pVM,VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs);
|
---|
1443 | VMMR3DECL(int) DBGFR3RegCpuQueryAll( PVM pVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs);
|
---|
1444 |
|
---|
1445 | VMMR3DECL(int) DBGFR3RegCpuSetU8( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t u8);
|
---|
1446 | VMMR3DECL(int) DBGFR3RegCpuSetU16( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t u16);
|
---|
1447 | VMMR3DECL(int) DBGFR3RegCpuSetU32( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t u32);
|
---|
1448 | VMMR3DECL(int) DBGFR3RegCpuSetU64( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t u64);
|
---|
1449 | VMMR3DECL(int) DBGFR3RegCpuSetU128( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, uint128_t u128);
|
---|
1450 | VMMR3DECL(int) DBGFR3RegCpuSetLrd( PVM pVM, VMCPUID idCpu, DBGFREG enmReg, long double lrd);
|
---|
1451 | VMMR3DECL(int) DBGFR3RegCpuSetBatch( PVM pVM, VMCPUID idCpu, PCDBGFREGENTRY paRegs, size_t cRegs);
|
---|
1452 | #endif
|
---|
1453 |
|
---|
1454 | VMMR3DECL(const char *) DBGFR3RegCpuName(PVM pVM, DBGFREG enmReg, DBGFREGVALTYPE enmType);
|
---|
1455 |
|
---|
1456 | VMMR3_INT_DECL(int) DBGFR3RegRegisterCpu(PVM pVM, PVMCPU pVCpu, PCDBGFREGDESC paRegisters, bool fGuestRegs);
|
---|
1457 | VMMR3DECL(int) DBGFR3RegRegisterDevice(PVM pVM, PCDBGFREGDESC paRegisters, PPDMDEVINS pDevIns, const char *pszPrefix, uint32_t iInstance);
|
---|
1458 |
|
---|
1459 | /**
|
---|
1460 | * Entry in a named batch query or set operation.
|
---|
1461 | */
|
---|
1462 | typedef struct DBGFREGENTRYNM
|
---|
1463 | {
|
---|
1464 | /** The register name. */
|
---|
1465 | const char *pszName;
|
---|
1466 | /** The size of the value in bytes. */
|
---|
1467 | DBGFREGVALTYPE enmType;
|
---|
1468 | /** The register value. The valid view is indicated by enmType. */
|
---|
1469 | DBGFREGVAL Val;
|
---|
1470 | } DBGFREGENTRYNM;
|
---|
1471 | /** Pointer to a named register entry in a batch operation. */
|
---|
1472 | typedef DBGFREGENTRYNM *PDBGFREGENTRYNM;
|
---|
1473 | /** Pointer to a const named register entry in a batch operation. */
|
---|
1474 | typedef DBGFREGENTRYNM const *PCDBGFREGENTRYNM;
|
---|
1475 |
|
---|
1476 | VMMR3DECL(int) DBGFR3RegNmValidate( PVM pVM, VMCPUID idDefCpu, const char *pszReg);
|
---|
1477 |
|
---|
1478 | VMMR3DECL(int) DBGFR3RegNmQuery( PVM pVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType);
|
---|
1479 | VMMR3DECL(int) DBGFR3RegNmQueryU8( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint8_t *pu8);
|
---|
1480 | VMMR3DECL(int) DBGFR3RegNmQueryU16( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint16_t *pu16);
|
---|
1481 | VMMR3DECL(int) DBGFR3RegNmQueryU32( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint32_t *pu32);
|
---|
1482 | VMMR3DECL(int) DBGFR3RegNmQueryU64( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64);
|
---|
1483 | VMMR3DECL(int) DBGFR3RegNmQueryU128(PVM pVM, VMCPUID idDefCpu, const char *pszReg, PRTUINT128U pu128);
|
---|
1484 | /*VMMR3DECL(int) DBGFR3RegNmQueryLrd( PVM pVM, VMCPUID idDefCpu, const char *pszReg, long double *plrd);*/
|
---|
1485 | VMMR3DECL(int) DBGFR3RegNmQueryXdtr(PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64Base, uint16_t *pu16Limit);
|
---|
1486 | VMMR3DECL(int) DBGFR3RegNmQueryBatch(PVM pVM,VMCPUID idDefCpu, PDBGFREGENTRYNM paRegs, size_t cRegs);
|
---|
1487 | VMMR3DECL(int) DBGFR3RegNmQueryAllCount(PVM pVM, size_t *pcRegs);
|
---|
1488 | VMMR3DECL(int) DBGFR3RegNmQueryAll( PVM pVM, PDBGFREGENTRYNM paRegs, size_t cRegs);
|
---|
1489 |
|
---|
1490 | VMMR3DECL(int) DBGFR3RegNmSet( PVM pVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType);
|
---|
1491 | VMMR3DECL(int) DBGFR3RegNmSetU8( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint8_t u8);
|
---|
1492 | VMMR3DECL(int) DBGFR3RegNmSetU16( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint16_t u16);
|
---|
1493 | VMMR3DECL(int) DBGFR3RegNmSetU32( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint32_t u32);
|
---|
1494 | VMMR3DECL(int) DBGFR3RegNmSetU64( PVM pVM, VMCPUID idDefCpu, const char *pszReg, uint64_t u64);
|
---|
1495 | VMMR3DECL(int) DBGFR3RegNmSetU128( PVM pVM, VMCPUID idDefCpu, const char *pszReg, RTUINT128U u128);
|
---|
1496 | VMMR3DECL(int) DBGFR3RegNmSetLrd( PVM pVM, VMCPUID idDefCpu, const char *pszReg, long double lrd);
|
---|
1497 | VMMR3DECL(int) DBGFR3RegNmSetBatch( PVM pVM, VMCPUID idDefCpu, PCDBGFREGENTRYNM paRegs, size_t cRegs);
|
---|
1498 |
|
---|
1499 | /** @todo add enumeration methods. */
|
---|
1500 |
|
---|
1501 | VMMR3DECL(int) DBGFR3RegPrintf( PVM pVM, VMCPUID idDefCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...);
|
---|
1502 | VMMR3DECL(int) DBGFR3RegPrintfV(PVM pVM, VMCPUID idDefCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, va_list va);
|
---|
1503 |
|
---|
1504 |
|
---|
1505 | /**
|
---|
1506 | * Guest OS digger interface identifier.
|
---|
1507 | *
|
---|
1508 | * This is for use together with PDBGFR3QueryInterface and is used to
|
---|
1509 | * obtain access to optional interfaces.
|
---|
1510 | */
|
---|
1511 | typedef enum DBGFOSINTERFACE
|
---|
1512 | {
|
---|
1513 | /** The usual invalid entry. */
|
---|
1514 | DBGFOSINTERFACE_INVALID = 0,
|
---|
1515 | /** Process info. */
|
---|
1516 | DBGFOSINTERFACE_PROCESS,
|
---|
1517 | /** Thread info. */
|
---|
1518 | DBGFOSINTERFACE_THREAD,
|
---|
1519 | /** The end of the valid entries. */
|
---|
1520 | DBGFOSINTERFACE_END,
|
---|
1521 | /** The usual 32-bit type blowup. */
|
---|
1522 | DBGFOSINTERFACE_32BIT_HACK = 0x7fffffff
|
---|
1523 | } DBGFOSINTERFACE;
|
---|
1524 | /** Pointer to a Guest OS digger interface identifier. */
|
---|
1525 | typedef DBGFOSINTERFACE *PDBGFOSINTERFACE;
|
---|
1526 | /** Pointer to a const Guest OS digger interface identifier. */
|
---|
1527 | typedef DBGFOSINTERFACE const *PCDBGFOSINTERFACE;
|
---|
1528 |
|
---|
1529 |
|
---|
1530 | /**
|
---|
1531 | * Guest OS Digger Registration Record.
|
---|
1532 | *
|
---|
1533 | * This is used with the DBGFR3OSRegister() API.
|
---|
1534 | */
|
---|
1535 | typedef struct DBGFOSREG
|
---|
1536 | {
|
---|
1537 | /** Magic value (DBGFOSREG_MAGIC). */
|
---|
1538 | uint32_t u32Magic;
|
---|
1539 | /** Flags. Reserved. */
|
---|
1540 | uint32_t fFlags;
|
---|
1541 | /** The size of the instance data. */
|
---|
1542 | uint32_t cbData;
|
---|
1543 | /** Operative System name. */
|
---|
1544 | char szName[24];
|
---|
1545 |
|
---|
1546 | /**
|
---|
1547 | * Constructs the instance.
|
---|
1548 | *
|
---|
1549 | * @returns VBox status code.
|
---|
1550 | * @param pVM Pointer to the shared VM structure.
|
---|
1551 | * @param pvData Pointer to the instance data.
|
---|
1552 | */
|
---|
1553 | DECLCALLBACKMEMBER(int, pfnConstruct)(PVM pVM, void *pvData);
|
---|
1554 |
|
---|
1555 | /**
|
---|
1556 | * Destroys the instance.
|
---|
1557 | *
|
---|
1558 | * @param pVM Pointer to the shared VM structure.
|
---|
1559 | * @param pvData Pointer to the instance data.
|
---|
1560 | */
|
---|
1561 | DECLCALLBACKMEMBER(void, pfnDestruct)(PVM pVM, void *pvData);
|
---|
1562 |
|
---|
1563 | /**
|
---|
1564 | * Probes the guest memory for OS finger prints.
|
---|
1565 | *
|
---|
1566 | * No setup or so is performed, it will be followed by a call to pfnInit
|
---|
1567 | * or pfnRefresh that should take care of that.
|
---|
1568 | *
|
---|
1569 | * @returns true if is an OS handled by this module, otherwise false.
|
---|
1570 | * @param pVM Pointer to the shared VM structure.
|
---|
1571 | * @param pvData Pointer to the instance data.
|
---|
1572 | */
|
---|
1573 | DECLCALLBACKMEMBER(bool, pfnProbe)(PVM pVM, void *pvData);
|
---|
1574 |
|
---|
1575 | /**
|
---|
1576 | * Initializes a fresly detected guest, loading symbols and such useful stuff.
|
---|
1577 | *
|
---|
1578 | * This is called after pfnProbe.
|
---|
1579 | *
|
---|
1580 | * @returns VBox status code.
|
---|
1581 | * @param pVM Pointer to the shared VM structure.
|
---|
1582 | * @param pvData Pointer to the instance data.
|
---|
1583 | */
|
---|
1584 | DECLCALLBACKMEMBER(int, pfnInit)(PVM pVM, void *pvData);
|
---|
1585 |
|
---|
1586 | /**
|
---|
1587 | * Refreshes symbols and stuff following a redetection of the same OS.
|
---|
1588 | *
|
---|
1589 | * This is called after pfnProbe.
|
---|
1590 | *
|
---|
1591 | * @returns VBox status code.
|
---|
1592 | * @param pVM Pointer to the shared VM structure.
|
---|
1593 | * @param pvData Pointer to the instance data.
|
---|
1594 | */
|
---|
1595 | DECLCALLBACKMEMBER(int, pfnRefresh)(PVM pVM, void *pvData);
|
---|
1596 |
|
---|
1597 | /**
|
---|
1598 | * Terminates an OS when a new (or none) OS has been detected,
|
---|
1599 | * and before destruction.
|
---|
1600 | *
|
---|
1601 | * This is called after pfnProbe and if needed before pfnDestruct.
|
---|
1602 | *
|
---|
1603 | * @param pVM Pointer to the shared VM structure.
|
---|
1604 | * @param pvData Pointer to the instance data.
|
---|
1605 | */
|
---|
1606 | DECLCALLBACKMEMBER(void, pfnTerm)(PVM pVM, void *pvData);
|
---|
1607 |
|
---|
1608 | /**
|
---|
1609 | * Queries the version of the running OS.
|
---|
1610 | *
|
---|
1611 | * This is only called after pfnInit().
|
---|
1612 | *
|
---|
1613 | * @returns VBox status code.
|
---|
1614 | * @param pVM Pointer to the shared VM structure.
|
---|
1615 | * @param pvData Pointer to the instance data.
|
---|
1616 | * @param pszVersion Where to store the version string.
|
---|
1617 | * @param cchVersion The size of the version string buffer.
|
---|
1618 | */
|
---|
1619 | DECLCALLBACKMEMBER(int, pfnQueryVersion)(PVM pVM, void *pvData, char *pszVersion, size_t cchVersion);
|
---|
1620 |
|
---|
1621 | /**
|
---|
1622 | * Queries the pointer to a interface.
|
---|
1623 | *
|
---|
1624 | * This is called after pfnProbe.
|
---|
1625 | *
|
---|
1626 | * @returns Pointer to the interface if available, NULL if not available.
|
---|
1627 | * @param pVM Pointer to the shared VM structure.
|
---|
1628 | * @param pvData Pointer to the instance data.
|
---|
1629 | * @param enmIf The interface identifier.
|
---|
1630 | */
|
---|
1631 | DECLCALLBACKMEMBER(void *, pfnQueryInterface)(PVM pVM, void *pvData, DBGFOSINTERFACE enmIf);
|
---|
1632 |
|
---|
1633 | /** Trailing magic (DBGFOSREG_MAGIC). */
|
---|
1634 | uint32_t u32EndMagic;
|
---|
1635 | } DBGFOSREG;
|
---|
1636 | /** Pointer to a Guest OS digger registration record. */
|
---|
1637 | typedef DBGFOSREG *PDBGFOSREG;
|
---|
1638 | /** Pointer to a const Guest OS digger registration record. */
|
---|
1639 | typedef DBGFOSREG const *PCDBGFOSREG;
|
---|
1640 |
|
---|
1641 | /** Magic value for DBGFOSREG::u32Magic and DBGFOSREG::u32EndMagic. (Hitomi Kanehara) */
|
---|
1642 | #define DBGFOSREG_MAGIC 0x19830808
|
---|
1643 |
|
---|
1644 | VMMR3DECL(int) DBGFR3OSRegister(PVM pVM, PCDBGFOSREG pReg);
|
---|
1645 | VMMR3DECL(int) DBGFR3OSDeregister(PVM pVM, PCDBGFOSREG pReg);
|
---|
1646 | VMMR3DECL(int) DBGFR3OSDetect(PVM pVM, char *pszName, size_t cchName);
|
---|
1647 | VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PVM pVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion);
|
---|
1648 | VMMR3DECL(void *) DBGFR3OSQueryInterface(PVM pVM, DBGFOSINTERFACE enmIf);
|
---|
1649 |
|
---|
1650 |
|
---|
1651 | VMMR3DECL(int) DBGFR3CoreWrite(PVM pVM, const char *pszFilename, bool fReplaceFile);
|
---|
1652 |
|
---|
1653 | /** @} */
|
---|
1654 |
|
---|
1655 |
|
---|
1656 | RT_C_DECLS_END
|
---|
1657 |
|
---|
1658 | #endif
|
---|
1659 |
|
---|