VirtualBox

source: vbox/trunk/include/VBox/vmm/dbgf.h@ 86452

Last change on this file since 86452 was 86361, checked in by vboxsync, 5 years ago

VMM,DBGC: Prevent leaks detection triggering in tstCFGM. bugref:9841

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 121.9 KB
Line 
1/** @file
2 * DBGF - Debugger Facility.
3 */
4
5/*
6 * Copyright (C) 2006-2020 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_INCLUDED_vmm_dbgf_h
27#define VBOX_INCLUDED_vmm_dbgf_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/types.h>
33#include <VBox/log.h> /* LOG_ENABLED */
34#include <VBox/vmm/vmm.h>
35#include <VBox/vmm/dbgfsel.h>
36
37#include <iprt/stdarg.h>
38#include <iprt/dbg.h>
39
40RT_C_DECLS_BEGIN
41
42
43/** @defgroup grp_dbgf The Debugger Facility API
44 * @ingroup grp_vmm
45 * @{
46 */
47
48#if defined(IN_RC) || defined(IN_RING0)
49/** @defgroup grp_dbgf_rz The RZ DBGF API
50 * @{
51 */
52VMMRZ_INT_DECL(int) DBGFRZTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6, bool fAltStepping);
53VMMRZ_INT_DECL(int) DBGFRZTrap03Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
54/** @} */
55#endif
56
57
58/** @defgroup grp_dbgf_r0 The R0 DBGF API
59 * @{
60 */
61/**
62 * Request buffer for DBGFR0TracerCreateReqHandler / VMMR0_DO_DBGF_TRACER_CREATE.
63 * @see DBGFR0TracerCreateReqHandler.
64 */
65typedef struct DBGFTRACERCREATEREQ
66{
67 /** The header. */
68 SUPVMMR0REQHDR Hdr;
69 /** Out: Where to return the address of the ring-3 tracer instance. */
70 PDBGFTRACERINSR3 pTracerInsR3;
71
72 /** Number of bytes for the shared event ring buffer. */
73 uint32_t cbRingBuf;
74
75 /** Set if the raw-mode component is desired. */
76 bool fRCEnabled;
77 /** Explicit padding. */
78 bool afReserved[3];
79
80} DBGFTRACERCREATEREQ;
81/** Pointer to a DBGFR0TracerCreate / VMMR0_DO_DBGF_TRACER_CREATE request buffer. */
82typedef DBGFTRACERCREATEREQ *PDBGFTRACERCREATEREQ;
83
84VMMR0_INT_DECL(int) DBGFR0TracerCreateReqHandler(PGVM pGVM, PDBGFTRACERCREATEREQ pReq);
85/** @} */
86
87
88#ifdef IN_RING3
89
90/**
91 * Mixed address.
92 */
93typedef struct DBGFADDRESS
94{
95 /** The flat address. */
96 RTGCUINTPTR FlatPtr;
97 /** The selector offset address. */
98 RTGCUINTPTR off;
99 /** The selector. DBGF_SEL_FLAT is a legal value. */
100 RTSEL Sel;
101 /** Flags describing further details about the address. */
102 uint16_t fFlags;
103} DBGFADDRESS;
104/** Pointer to a mixed address. */
105typedef DBGFADDRESS *PDBGFADDRESS;
106/** Pointer to a const mixed address. */
107typedef const DBGFADDRESS *PCDBGFADDRESS;
108
109/** @name DBGFADDRESS Flags.
110 * @{ */
111/** A 16:16 far address. */
112#define DBGFADDRESS_FLAGS_FAR16 0
113/** A 16:32 far address. */
114#define DBGFADDRESS_FLAGS_FAR32 1
115/** A 16:64 far address. */
116#define DBGFADDRESS_FLAGS_FAR64 2
117/** A flat address. */
118#define DBGFADDRESS_FLAGS_FLAT 3
119/** A physical address. */
120#define DBGFADDRESS_FLAGS_PHYS 4
121/** A ring-0 host address (internal use only). */
122#define DBGFADDRESS_FLAGS_RING0 5
123/** The address type mask. */
124#define DBGFADDRESS_FLAGS_TYPE_MASK 7
125
126/** Set if the address is valid. */
127#define DBGFADDRESS_FLAGS_VALID RT_BIT(3)
128
129/** Checks if the mixed address is flat or not. */
130#define DBGFADDRESS_IS_FLAT(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FLAT )
131/** Checks if the mixed address is flat or not. */
132#define DBGFADDRESS_IS_PHYS(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_PHYS )
133/** Checks if the mixed address is far 16:16 or not. */
134#define DBGFADDRESS_IS_FAR16(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR16 )
135/** Checks if the mixed address is far 16:32 or not. */
136#define DBGFADDRESS_IS_FAR32(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR32 )
137/** Checks if the mixed address is far 16:64 or not. */
138#define DBGFADDRESS_IS_FAR64(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR64 )
139/** Checks if the mixed address is any kind of far address. */
140#define DBGFADDRESS_IS_FAR(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) <= DBGFADDRESS_FLAGS_FAR64 )
141/** Checks if the mixed address host context ring-0 (special). */
142#define DBGFADDRESS_IS_R0_HC(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_RING0 )
143/** Checks if the mixed address a virtual guest context address (incl HMA). */
144#define DBGFADDRESS_IS_VIRT_GC(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) <= DBGFADDRESS_FLAGS_FLAT )
145/** Checks if the mixed address is valid. */
146#define DBGFADDRESS_IS_VALID(pAddress) RT_BOOL((pAddress)->fFlags & DBGFADDRESS_FLAGS_VALID)
147/** @} */
148
149VMMR3DECL(int) DBGFR3AddrFromSelOff(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off);
150VMMR3DECL(int) DBGFR3AddrFromSelInfoOff(PUVM pUVM, PDBGFADDRESS pAddress, PCDBGFSELINFO pSelInfo, RTUINTPTR off);
151VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromFlat(PUVM pUVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr);
152VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromPhys(PUVM pUVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr);
153VMMR3_INT_DECL(PDBGFADDRESS) DBGFR3AddrFromHostR0(PDBGFADDRESS pAddress, RTR0UINTPTR R0Ptr);
154VMMR3DECL(bool) DBGFR3AddrIsValid(PUVM pUVM, PCDBGFADDRESS pAddress);
155VMMR3DECL(int) DBGFR3AddrToPhys(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, PRTGCPHYS pGCPhys);
156VMMR3DECL(int) DBGFR3AddrToHostPhys(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys);
157VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr);
158VMMR3DECL(PDBGFADDRESS) DBGFR3AddrAdd(PDBGFADDRESS pAddress, RTGCUINTPTR uAddend);
159VMMR3DECL(PDBGFADDRESS) DBGFR3AddrSub(PDBGFADDRESS pAddress, RTGCUINTPTR uSubtrahend);
160
161#endif /* IN_RING3 */
162
163
164
165/**
166 * VMM Debug Event Type.
167 */
168typedef enum DBGFEVENTTYPE
169{
170 /** Halt completed.
171 * This notifies that a halt command have been successfully completed.
172 */
173 DBGFEVENT_HALT_DONE = 0,
174 /** Detach completed.
175 * This notifies that the detach command have been successfully completed.
176 */
177 DBGFEVENT_DETACH_DONE,
178 /** The command from the debugger is not recognized.
179 * This means internal error or half implemented features.
180 */
181 DBGFEVENT_INVALID_COMMAND,
182
183 /** Fatal error.
184 * This notifies a fatal error in the VMM and that the debugger get's a
185 * chance to first hand information about the the problem.
186 */
187 DBGFEVENT_FATAL_ERROR,
188 /** Breakpoint Hit.
189 * This notifies that a breakpoint installed by the debugger was hit. The
190 * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
191 */
192 DBGFEVENT_BREAKPOINT,
193 /** I/O port breakpoint.
194 * @todo not yet implemented. */
195 DBGFEVENT_BREAKPOINT_IO,
196 /** MMIO breakpoint.
197 * @todo not yet implemented. */
198 DBGFEVENT_BREAKPOINT_MMIO,
199 /** Breakpoint Hit in the Hypervisor.
200 * This notifies that a breakpoint installed by the debugger was hit. The
201 * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
202 * @todo raw-mode: remove this
203 */
204 DBGFEVENT_BREAKPOINT_HYPER,
205 /** Assertion in the Hypervisor (breakpoint instruction).
206 * This notifies that a breakpoint instruction was hit in the hypervisor context.
207 */
208 DBGFEVENT_ASSERTION_HYPER,
209 /** Single Stepped.
210 * This notifies that a single step operation was completed.
211 */
212 DBGFEVENT_STEPPED,
213 /** Single Stepped.
214 * This notifies that a hypervisor single step operation was completed.
215 */
216 DBGFEVENT_STEPPED_HYPER,
217 /** The developer have used the DBGFSTOP macro or the PDMDeviceDBGFSTOP function
218 * to bring up the debugger at a specific place.
219 */
220 DBGFEVENT_DEV_STOP,
221 /** The VM is powering off.
222 * When this notification is received, the debugger thread should detach ASAP.
223 */
224 DBGFEVENT_POWERING_OFF,
225
226 /** Hardware Interrupt break.
227 * @todo not yet implemented. */
228 DBGFEVENT_INTERRUPT_HARDWARE,
229 /** Software Interrupt break.
230 * @todo not yet implemented. */
231 DBGFEVENT_INTERRUPT_SOFTWARE,
232
233 /** The first selectable event.
234 * Whether the debugger wants or doesn't want these events can be configured
235 * via DBGFR3xxx and queried via DBGFR3yyy. */
236 DBGFEVENT_FIRST_SELECTABLE,
237 /** Tripple fault. */
238 DBGFEVENT_TRIPLE_FAULT = DBGFEVENT_FIRST_SELECTABLE,
239
240 /** @name Exception events
241 * The exception events normally represents guest exceptions, but depending on
242 * the execution mode some virtualization exceptions may occure (no nested
243 * paging, raw-mode, ++). When necessary, we will request additional VM exits.
244 * @{ */
245 DBGFEVENT_XCPT_FIRST, /**< The first exception event. */
246 DBGFEVENT_XCPT_DE /**< 0x00 - \#DE - Fault - NoErr - Integer divide error (zero/overflow). */
247 = DBGFEVENT_XCPT_FIRST,
248 DBGFEVENT_XCPT_DB, /**< 0x01 - \#DB - trap/fault - NoErr - debug event. */
249 DBGFEVENT_XCPT_02, /**< 0x02 - Reserved for NMI, see interrupt events. */
250 DBGFEVENT_XCPT_BP, /**< 0x03 - \#BP - Trap - NoErr - Breakpoint, INT 3 instruction. */
251 DBGFEVENT_XCPT_OF, /**< 0x04 - \#OF - Trap - NoErr - Overflow, INTO instruction. */
252 DBGFEVENT_XCPT_BR, /**< 0x05 - \#BR - Fault - NoErr - BOUND Range Exceeded, BOUND instruction. */
253 DBGFEVENT_XCPT_UD, /**< 0x06 - \#UD - Fault - NoErr - Undefined(/Invalid) Opcode. */
254 DBGFEVENT_XCPT_NM, /**< 0x07 - \#NM - Fault - NoErr - Device not available, FP or (F)WAIT instruction. */
255 DBGFEVENT_XCPT_DF, /**< 0x08 - \#DF - Abort - Err=0 - Double fault. */
256 DBGFEVENT_XCPT_09, /**< 0x09 - Int9 - Fault - NoErr - Coprocessor Segment Overrun (obsolete). */
257 DBGFEVENT_XCPT_TS, /**< 0x0a - \#TS - Fault - ErrCd - Invalid TSS, Taskswitch or TSS access. */
258 DBGFEVENT_XCPT_NP, /**< 0x0b - \#NP - Fault - ErrCd - Segment not present. */
259 DBGFEVENT_XCPT_SS, /**< 0x0c - \#SS - Fault - ErrCd - Stack-Segment fault. */
260 DBGFEVENT_XCPT_GP, /**< 0x0d - \#GP - Fault - ErrCd - General protection fault. */
261 DBGFEVENT_XCPT_PF, /**< 0x0e - \#PF - Fault - ErrCd - Page fault. - interrupt gate!!! */
262 DBGFEVENT_XCPT_0f, /**< 0x0f - Rsvd - Resvd - Resvd - Intel Reserved. */
263 DBGFEVENT_XCPT_MF, /**< 0x10 - \#MF - Fault - NoErr - x86 FPU Floating-Point Error (Math fault), FP or (F)WAIT instruction. */
264 DBGFEVENT_XCPT_AC, /**< 0x11 - \#AC - Fault - Err=0 - Alignment Check. */
265 DBGFEVENT_XCPT_MC, /**< 0x12 - \#MC - Abort - NoErr - Machine Check. */
266 DBGFEVENT_XCPT_XF, /**< 0x13 - \#XF - Fault - NoErr - SIMD Floating-Point Exception. */
267 DBGFEVENT_XCPT_VE, /**< 0x14 - \#VE - Fault - Noerr - Virtualization exception. */
268 DBGFEVENT_XCPT_15, /**< 0x15 - Intel Reserved. */
269 DBGFEVENT_XCPT_16, /**< 0x16 - Intel Reserved. */
270 DBGFEVENT_XCPT_17, /**< 0x17 - Intel Reserved. */
271 DBGFEVENT_XCPT_18, /**< 0x18 - Intel Reserved. */
272 DBGFEVENT_XCPT_19, /**< 0x19 - Intel Reserved. */
273 DBGFEVENT_XCPT_1a, /**< 0x1a - Intel Reserved. */
274 DBGFEVENT_XCPT_1b, /**< 0x1b - Intel Reserved. */
275 DBGFEVENT_XCPT_1c, /**< 0x1c - Intel Reserved. */
276 DBGFEVENT_XCPT_1d, /**< 0x1d - Intel Reserved. */
277 DBGFEVENT_XCPT_SX, /**< 0x1e - \#SX - Fault - ErrCd - Security Exception. */
278 DBGFEVENT_XCPT_1f, /**< 0x1f - Intel Reserved. */
279 DBGFEVENT_XCPT_LAST /**< The last exception event. */
280 = DBGFEVENT_XCPT_1f,
281 /** @} */
282
283 /** @name Instruction events
284 * The instruction events exerts all possible effort to intercept the
285 * relevant instructions. However, in some execution modes we won't be able
286 * to catch them. So it goes.
287 * @{ */
288 DBGFEVENT_INSTR_FIRST, /**< The first VM instruction event. */
289 DBGFEVENT_INSTR_HALT /**< Instruction: HALT */
290 = DBGFEVENT_INSTR_FIRST,
291 DBGFEVENT_INSTR_MWAIT, /**< Instruction: MWAIT */
292 DBGFEVENT_INSTR_MONITOR, /**< Instruction: MONITOR */
293 DBGFEVENT_INSTR_CPUID, /**< Instruction: CPUID (missing stuff in raw-mode). */
294 DBGFEVENT_INSTR_INVD, /**< Instruction: INVD */
295 DBGFEVENT_INSTR_WBINVD, /**< Instruction: WBINVD */
296 DBGFEVENT_INSTR_INVLPG, /**< Instruction: INVLPG */
297 DBGFEVENT_INSTR_RDTSC, /**< Instruction: RDTSC */
298 DBGFEVENT_INSTR_RDTSCP, /**< Instruction: RDTSCP */
299 DBGFEVENT_INSTR_RDPMC, /**< Instruction: RDPMC */
300 DBGFEVENT_INSTR_RDMSR, /**< Instruction: RDMSR */
301 DBGFEVENT_INSTR_WRMSR, /**< Instruction: WRMSR */
302 DBGFEVENT_INSTR_CRX_READ, /**< Instruction: CRx read instruction (missing smsw in raw-mode, and reads in general in VT-x). */
303 DBGFEVENT_INSTR_CRX_WRITE, /**< Instruction: CRx write */
304 DBGFEVENT_INSTR_DRX_READ, /**< Instruction: DRx read */
305 DBGFEVENT_INSTR_DRX_WRITE, /**< Instruction: DRx write */
306 DBGFEVENT_INSTR_PAUSE, /**< Instruction: PAUSE instruction (not in raw-mode). */
307 DBGFEVENT_INSTR_XSETBV, /**< Instruction: XSETBV */
308 DBGFEVENT_INSTR_SIDT, /**< Instruction: SIDT */
309 DBGFEVENT_INSTR_LIDT, /**< Instruction: LIDT */
310 DBGFEVENT_INSTR_SGDT, /**< Instruction: SGDT */
311 DBGFEVENT_INSTR_LGDT, /**< Instruction: LGDT */
312 DBGFEVENT_INSTR_SLDT, /**< Instruction: SLDT */
313 DBGFEVENT_INSTR_LLDT, /**< Instruction: LLDT */
314 DBGFEVENT_INSTR_STR, /**< Instruction: STR */
315 DBGFEVENT_INSTR_LTR, /**< Instruction: LTR */
316 DBGFEVENT_INSTR_GETSEC, /**< Instruction: GETSEC */
317 DBGFEVENT_INSTR_RSM, /**< Instruction: RSM */
318 DBGFEVENT_INSTR_RDRAND, /**< Instruction: RDRAND */
319 DBGFEVENT_INSTR_RDSEED, /**< Instruction: RDSEED */
320 DBGFEVENT_INSTR_XSAVES, /**< Instruction: XSAVES */
321 DBGFEVENT_INSTR_XRSTORS, /**< Instruction: XRSTORS */
322 DBGFEVENT_INSTR_VMM_CALL, /**< Instruction: VMCALL (intel) or VMMCALL (AMD) */
323 DBGFEVENT_INSTR_LAST_COMMON /**< Instruction: the last common event. */
324 = DBGFEVENT_INSTR_VMM_CALL,
325 DBGFEVENT_INSTR_VMX_FIRST, /**< Instruction: VT-x - First. */
326 DBGFEVENT_INSTR_VMX_VMCLEAR /**< Instruction: VT-x VMCLEAR */
327 = DBGFEVENT_INSTR_VMX_FIRST,
328 DBGFEVENT_INSTR_VMX_VMLAUNCH, /**< Instruction: VT-x VMLAUNCH */
329 DBGFEVENT_INSTR_VMX_VMPTRLD, /**< Instruction: VT-x VMPTRLD */
330 DBGFEVENT_INSTR_VMX_VMPTRST, /**< Instruction: VT-x VMPTRST */
331 DBGFEVENT_INSTR_VMX_VMREAD, /**< Instruction: VT-x VMREAD */
332 DBGFEVENT_INSTR_VMX_VMRESUME, /**< Instruction: VT-x VMRESUME */
333 DBGFEVENT_INSTR_VMX_VMWRITE, /**< Instruction: VT-x VMWRITE */
334 DBGFEVENT_INSTR_VMX_VMXOFF, /**< Instruction: VT-x VMXOFF */
335 DBGFEVENT_INSTR_VMX_VMXON, /**< Instruction: VT-x VMXON */
336 DBGFEVENT_INSTR_VMX_VMFUNC, /**< Instruction: VT-x VMFUNC */
337 DBGFEVENT_INSTR_VMX_INVEPT, /**< Instruction: VT-x INVEPT */
338 DBGFEVENT_INSTR_VMX_INVVPID, /**< Instruction: VT-x INVVPID */
339 DBGFEVENT_INSTR_VMX_INVPCID, /**< Instruction: VT-x INVPCID */
340 DBGFEVENT_INSTR_VMX_LAST /**< Instruction: VT-x - Last. */
341 = DBGFEVENT_INSTR_VMX_INVPCID,
342 DBGFEVENT_INSTR_SVM_FIRST, /**< Instruction: AMD-V - first */
343 DBGFEVENT_INSTR_SVM_VMRUN /**< Instruction: AMD-V VMRUN */
344 = DBGFEVENT_INSTR_SVM_FIRST,
345 DBGFEVENT_INSTR_SVM_VMLOAD, /**< Instruction: AMD-V VMLOAD */
346 DBGFEVENT_INSTR_SVM_VMSAVE, /**< Instruction: AMD-V VMSAVE */
347 DBGFEVENT_INSTR_SVM_STGI, /**< Instruction: AMD-V STGI */
348 DBGFEVENT_INSTR_SVM_CLGI, /**< Instruction: AMD-V CLGI */
349 DBGFEVENT_INSTR_SVM_LAST /**< Instruction: The last ADM-V VM exit event. */
350 = DBGFEVENT_INSTR_SVM_CLGI,
351 DBGFEVENT_INSTR_LAST /**< Instruction: The last instruction event. */
352 = DBGFEVENT_INSTR_SVM_LAST,
353 /** @} */
354
355
356 /** @name VM exit events.
357 * VM exits events for VT-x and AMD-V execution mode. Many of the VM exits
358 * behind these events are also directly translated into instruction events, but
359 * the difference here is that the exit events will not try provoke the exits.
360 * @{ */
361 DBGFEVENT_EXIT_FIRST, /**< The first VM exit event. */
362 DBGFEVENT_EXIT_TASK_SWITCH /**< Exit: Task switch. */
363 = DBGFEVENT_EXIT_FIRST,
364 DBGFEVENT_EXIT_HALT, /**< Exit: HALT instruction. */
365 DBGFEVENT_EXIT_MWAIT, /**< Exit: MWAIT instruction. */
366 DBGFEVENT_EXIT_MONITOR, /**< Exit: MONITOR instruction. */
367 DBGFEVENT_EXIT_CPUID, /**< Exit: CPUID instruction (missing stuff in raw-mode). */
368 DBGFEVENT_EXIT_INVD, /**< Exit: INVD instruction. */
369 DBGFEVENT_EXIT_WBINVD, /**< Exit: WBINVD instruction. */
370 DBGFEVENT_EXIT_INVLPG, /**< Exit: INVLPG instruction. */
371 DBGFEVENT_EXIT_RDTSC, /**< Exit: RDTSC instruction. */
372 DBGFEVENT_EXIT_RDTSCP, /**< Exit: RDTSCP instruction. */
373 DBGFEVENT_EXIT_RDPMC, /**< Exit: RDPMC instruction. */
374 DBGFEVENT_EXIT_RDMSR, /**< Exit: RDMSR instruction. */
375 DBGFEVENT_EXIT_WRMSR, /**< Exit: WRMSR instruction. */
376 DBGFEVENT_EXIT_CRX_READ, /**< Exit: CRx read instruction (missing smsw in raw-mode, and reads in general in VT-x). */
377 DBGFEVENT_EXIT_CRX_WRITE, /**< Exit: CRx write instruction. */
378 DBGFEVENT_EXIT_DRX_READ, /**< Exit: DRx read instruction. */
379 DBGFEVENT_EXIT_DRX_WRITE, /**< Exit: DRx write instruction. */
380 DBGFEVENT_EXIT_PAUSE, /**< Exit: PAUSE instruction (not in raw-mode). */
381 DBGFEVENT_EXIT_XSETBV, /**< Exit: XSETBV instruction. */
382 DBGFEVENT_EXIT_SIDT, /**< Exit: SIDT instruction. */
383 DBGFEVENT_EXIT_LIDT, /**< Exit: LIDT instruction. */
384 DBGFEVENT_EXIT_SGDT, /**< Exit: SGDT instruction. */
385 DBGFEVENT_EXIT_LGDT, /**< Exit: LGDT instruction. */
386 DBGFEVENT_EXIT_SLDT, /**< Exit: SLDT instruction. */
387 DBGFEVENT_EXIT_LLDT, /**< Exit: LLDT instruction. */
388 DBGFEVENT_EXIT_STR, /**< Exit: STR instruction. */
389 DBGFEVENT_EXIT_LTR, /**< Exit: LTR instruction. */
390 DBGFEVENT_EXIT_GETSEC, /**< Exit: GETSEC instruction. */
391 DBGFEVENT_EXIT_RSM, /**< Exit: RSM instruction. */
392 DBGFEVENT_EXIT_RDRAND, /**< Exit: RDRAND instruction. */
393 DBGFEVENT_EXIT_RDSEED, /**< Exit: RDSEED instruction. */
394 DBGFEVENT_EXIT_XSAVES, /**< Exit: XSAVES instruction. */
395 DBGFEVENT_EXIT_XRSTORS, /**< Exit: XRSTORS instruction. */
396 DBGFEVENT_EXIT_VMM_CALL, /**< Exit: VMCALL (intel) or VMMCALL (AMD) instruction. */
397 DBGFEVENT_EXIT_LAST_COMMON /**< Exit: the last common event. */
398 = DBGFEVENT_EXIT_VMM_CALL,
399 DBGFEVENT_EXIT_VMX_FIRST, /**< Exit: VT-x - First. */
400 DBGFEVENT_EXIT_VMX_VMCLEAR /**< Exit: VT-x VMCLEAR instruction. */
401 = DBGFEVENT_EXIT_VMX_FIRST,
402 DBGFEVENT_EXIT_VMX_VMLAUNCH, /**< Exit: VT-x VMLAUNCH instruction. */
403 DBGFEVENT_EXIT_VMX_VMPTRLD, /**< Exit: VT-x VMPTRLD instruction. */
404 DBGFEVENT_EXIT_VMX_VMPTRST, /**< Exit: VT-x VMPTRST instruction. */
405 DBGFEVENT_EXIT_VMX_VMREAD, /**< Exit: VT-x VMREAD instruction. */
406 DBGFEVENT_EXIT_VMX_VMRESUME, /**< Exit: VT-x VMRESUME instruction. */
407 DBGFEVENT_EXIT_VMX_VMWRITE, /**< Exit: VT-x VMWRITE instruction. */
408 DBGFEVENT_EXIT_VMX_VMXOFF, /**< Exit: VT-x VMXOFF instruction. */
409 DBGFEVENT_EXIT_VMX_VMXON, /**< Exit: VT-x VMXON instruction. */
410 DBGFEVENT_EXIT_VMX_VMFUNC, /**< Exit: VT-x VMFUNC instruction. */
411 DBGFEVENT_EXIT_VMX_INVEPT, /**< Exit: VT-x INVEPT instruction. */
412 DBGFEVENT_EXIT_VMX_INVVPID, /**< Exit: VT-x INVVPID instruction. */
413 DBGFEVENT_EXIT_VMX_INVPCID, /**< Exit: VT-x INVPCID instruction. */
414 DBGFEVENT_EXIT_VMX_EPT_VIOLATION, /**< Exit: VT-x EPT violation. */
415 DBGFEVENT_EXIT_VMX_EPT_MISCONFIG, /**< Exit: VT-x EPT misconfiguration. */
416 DBGFEVENT_EXIT_VMX_VAPIC_ACCESS, /**< Exit: VT-x Virtual APIC page access. */
417 DBGFEVENT_EXIT_VMX_VAPIC_WRITE, /**< Exit: VT-x Virtual APIC write. */
418 DBGFEVENT_EXIT_VMX_LAST /**< Exit: VT-x - Last. */
419 = DBGFEVENT_EXIT_VMX_VAPIC_WRITE,
420 DBGFEVENT_EXIT_SVM_FIRST, /**< Exit: AMD-V - first */
421 DBGFEVENT_EXIT_SVM_VMRUN /**< Exit: AMD-V VMRUN instruction. */
422 = DBGFEVENT_EXIT_SVM_FIRST,
423 DBGFEVENT_EXIT_SVM_VMLOAD, /**< Exit: AMD-V VMLOAD instruction. */
424 DBGFEVENT_EXIT_SVM_VMSAVE, /**< Exit: AMD-V VMSAVE instruction. */
425 DBGFEVENT_EXIT_SVM_STGI, /**< Exit: AMD-V STGI instruction. */
426 DBGFEVENT_EXIT_SVM_CLGI, /**< Exit: AMD-V CLGI instruction. */
427 DBGFEVENT_EXIT_SVM_LAST /**< Exit: The last ADM-V VM exit event. */
428 = DBGFEVENT_EXIT_SVM_CLGI,
429 DBGFEVENT_EXIT_LAST /**< Exit: The last VM exit event. */
430 = DBGFEVENT_EXIT_SVM_LAST,
431 /** @} */
432
433
434 /** Access to an unassigned I/O port.
435 * @todo not yet implemented. */
436 DBGFEVENT_IOPORT_UNASSIGNED,
437 /** Access to an unused I/O port on a device.
438 * @todo not yet implemented. */
439 DBGFEVENT_IOPORT_UNUSED,
440 /** Unassigned memory event.
441 * @todo not yet implemented. */
442 DBGFEVENT_MEMORY_UNASSIGNED,
443 /** Attempt to write to unshadowed ROM.
444 * @todo not yet implemented. */
445 DBGFEVENT_MEMORY_ROM_WRITE,
446
447 /** Windows guest reported BSOD via hyperv MSRs. */
448 DBGFEVENT_BSOD_MSR,
449 /** Windows guest reported BSOD via EFI variables. */
450 DBGFEVENT_BSOD_EFI,
451 /** Windows guest reported BSOD via VMMDev. */
452 DBGFEVENT_BSOD_VMMDEV,
453
454 /** End of valid event values. */
455 DBGFEVENT_END,
456 /** The usual 32-bit hack. */
457 DBGFEVENT_32BIT_HACK = 0x7fffffff
458} DBGFEVENTTYPE;
459AssertCompile(DBGFEVENT_XCPT_LAST - DBGFEVENT_XCPT_FIRST == 0x1f);
460
461/**
462 * The context of an event.
463 */
464typedef enum DBGFEVENTCTX
465{
466 /** The usual invalid entry. */
467 DBGFEVENTCTX_INVALID = 0,
468 /** Raw mode. */
469 DBGFEVENTCTX_RAW,
470 /** Recompiled mode. */
471 DBGFEVENTCTX_REM,
472 /** VMX / AVT mode. */
473 DBGFEVENTCTX_HM,
474 /** Hypervisor context. */
475 DBGFEVENTCTX_HYPER,
476 /** Other mode */
477 DBGFEVENTCTX_OTHER,
478
479 /** The usual 32-bit hack */
480 DBGFEVENTCTX_32BIT_HACK = 0x7fffffff
481} DBGFEVENTCTX;
482
483/**
484 * VMM Debug Event.
485 */
486typedef struct DBGFEVENT
487{
488 /** Type. */
489 DBGFEVENTTYPE enmType;
490 /** Context */
491 DBGFEVENTCTX enmCtx;
492 /** The vCPU/EMT which generated the event. */
493 VMCPUID idCpu;
494 /** Reserved. */
495 uint32_t uReserved;
496 /** Type specific data. */
497 union
498 {
499 /** Fatal error details. */
500 struct
501 {
502 /** The GC return code. */
503 int rc;
504 } FatalError;
505
506 /** Source location. */
507 struct
508 {
509 /** File name. */
510 R3PTRTYPE(const char *) pszFile;
511 /** Function name. */
512 R3PTRTYPE(const char *) pszFunction;
513 /** Message. */
514 R3PTRTYPE(const char *) pszMessage;
515 /** Line number. */
516 unsigned uLine;
517 } Src;
518
519 /** Assertion messages. */
520 struct
521 {
522 /** The first message. */
523 R3PTRTYPE(const char *) pszMsg1;
524 /** The second message. */
525 R3PTRTYPE(const char *) pszMsg2;
526 } Assert;
527
528 /** Breakpoint. */
529 struct DBGFEVENTBP
530 {
531 /** The identifier of the breakpoint which was hit. */
532 RTUINT iBp;
533 } Bp;
534
535 /** Generic debug event. */
536 struct DBGFEVENTGENERIC
537 {
538 /** Number of arguments. */
539 uint8_t cArgs;
540 /** Alignment padding. */
541 uint8_t uPadding[7];
542 /** Arguments. */
543 uint64_t auArgs[5];
544 } Generic;
545
546 /** Padding for ensuring that the structure is 8 byte aligned. */
547 uint64_t au64Padding[6];
548 } u;
549} DBGFEVENT;
550AssertCompileSizeAlignment(DBGFEVENT, 8);
551AssertCompileSize(DBGFEVENT, 64);
552/** Pointer to VMM Debug Event. */
553typedef DBGFEVENT *PDBGFEVENT;
554/** Pointer to const VMM Debug Event. */
555typedef const DBGFEVENT *PCDBGFEVENT;
556
557#ifdef IN_RING3 /* The event API only works in ring-3. */
558
559/** @def DBGFSTOP
560 * Stops the debugger raising a DBGFEVENT_DEVELOPER_STOP event.
561 *
562 * @returns VBox status code which must be propagated up to EM if not VINF_SUCCESS.
563 * @param pVM The cross context VM structure.
564 */
565# ifdef VBOX_STRICT
566# define DBGFSTOP(pVM) DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL)
567# else
568# define DBGFSTOP(pVM) VINF_SUCCESS
569# endif
570
571VMMR3_INT_DECL(int) DBGFR3Init(PVM pVM);
572VMMR3_INT_DECL(int) DBGFR3Term(PVM pVM);
573VMMR3DECL(void) DBGFR3TermUVM(PUVM pUVM);
574VMMR3_INT_DECL(void) DBGFR3PowerOff(PVM pVM);
575VMMR3_INT_DECL(void) DBGFR3Relocate(PVM pVM, RTGCINTPTR offDelta);
576
577VMMR3_INT_DECL(int) DBGFR3VMMForcedAction(PVM pVM, PVMCPU pVCpu);
578VMMR3_INT_DECL(VBOXSTRICTRC) DBGFR3EventHandlePending(PVM pVM, PVMCPU pVCpu);
579VMMR3DECL(int) DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent);
580VMMR3DECL(int) DBGFR3EventSrc(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine,
581 const char *pszFunction, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);
582VMMR3DECL(int) DBGFR3EventSrcV(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine,
583 const char *pszFunction, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 0);
584VMMR3_INT_DECL(int) DBGFR3EventAssertion(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszMsg1, const char *pszMsg2);
585VMMR3_INT_DECL(int) DBGFR3EventBreakpoint(PVM pVM, DBGFEVENTTYPE enmEvent);
586
587VMMR3_INT_DECL(int) DBGFR3PrgStep(PVMCPU pVCpu);
588
589VMMR3DECL(int) DBGFR3Attach(PUVM pUVM);
590VMMR3DECL(int) DBGFR3Detach(PUVM pUVM);
591VMMR3DECL(int) DBGFR3EventWait(PUVM pUVM, RTMSINTERVAL cMillies, PDBGFEVENT pEvent);
592VMMR3DECL(int) DBGFR3Halt(PUVM pUVM, VMCPUID idCpu);
593VMMR3DECL(bool) DBGFR3IsHalted(PUVM pUVM, VMCPUID idCpu);
594VMMR3DECL(int) DBGFR3QueryWaitable(PUVM pUVM);
595VMMR3DECL(int) DBGFR3Resume(PUVM pUVM, VMCPUID idCpu);
596VMMR3DECL(int) DBGFR3InjectNMI(PUVM pUVM, VMCPUID idCpu);
597VMMR3DECL(int) DBGFR3Step(PUVM pUVM, VMCPUID idCpu);
598VMMR3DECL(int) DBGFR3StepEx(PUVM pUVM, VMCPUID idCpu, uint32_t fFlags, PCDBGFADDRESS pStopPcAddr,
599 PCDBGFADDRESS pStopPopAddr, RTGCUINTPTR cbStopPop, uint32_t cMaxSteps);
600
601/** @name DBGF_STEP_F_XXX - Flags for DBGFR3StepEx.
602 *
603 * @note The stop filters are not applied to the starting instruction.
604 *
605 * @{ */
606/** Step into CALL, INT, SYSCALL and SYSENTER instructions. */
607#define DBGF_STEP_F_INTO RT_BIT_32(0)
608/** Step over CALL, INT, SYSCALL and SYSENTER instruction when considering
609 * what's "next". */
610#define DBGF_STEP_F_OVER RT_BIT_32(1)
611
612/** Stop on the next CALL, INT, SYSCALL, SYSENTER instruction. */
613#define DBGF_STEP_F_STOP_ON_CALL RT_BIT_32(8)
614/** Stop on the next RET, IRET, SYSRET, SYSEXIT instruction. */
615#define DBGF_STEP_F_STOP_ON_RET RT_BIT_32(9)
616/** Stop after the next RET, IRET, SYSRET, SYSEXIT instruction. */
617#define DBGF_STEP_F_STOP_AFTER_RET RT_BIT_32(10)
618/** Stop on the given address.
619 * The comparison will be made using effective (flat) addresses. */
620#define DBGF_STEP_F_STOP_ON_ADDRESS RT_BIT_32(11)
621/** Stop when the stack pointer pops to or past the given address.
622 * The comparison will be made using effective (flat) addresses. */
623#define DBGF_STEP_F_STOP_ON_STACK_POP RT_BIT_32(12)
624/** Mask of stop filter flags. */
625#define DBGF_STEP_F_STOP_FILTER_MASK UINT32_C(0x00001f00)
626
627/** Mask of valid flags. */
628#define DBGF_STEP_F_VALID_MASK UINT32_C(0x00001f03)
629/** @} */
630
631/**
632 * Event configuration array element, see DBGFR3EventConfigEx.
633 */
634typedef struct DBGFEVENTCONFIG
635{
636 /** The event to configure */
637 DBGFEVENTTYPE enmType;
638 /** The new state. */
639 bool fEnabled;
640 /** Unused. */
641 uint8_t abUnused[3];
642} DBGFEVENTCONFIG;
643/** Pointer to an event config. */
644typedef DBGFEVENTCONFIG *PDBGFEVENTCONFIG;
645/** Pointer to a const event config. */
646typedef const DBGFEVENTCONFIG *PCDBGFEVENTCONFIG;
647
648VMMR3DECL(int) DBGFR3EventConfigEx(PUVM pUVM, PCDBGFEVENTCONFIG paConfigs, size_t cConfigs);
649VMMR3DECL(int) DBGFR3EventConfig(PUVM pUVM, DBGFEVENTTYPE enmEvent, bool fEnabled);
650VMMR3DECL(bool) DBGFR3EventIsEnabled(PUVM pUVM, DBGFEVENTTYPE enmEvent);
651VMMR3DECL(int) DBGFR3EventQuery(PUVM pUVM, PDBGFEVENTCONFIG paConfigs, size_t cConfigs);
652
653/** @name DBGFINTERRUPTSTATE_XXX - interrupt break state.
654 * @{ */
655#define DBGFINTERRUPTSTATE_DISABLED 0
656#define DBGFINTERRUPTSTATE_ENABLED 1
657#define DBGFINTERRUPTSTATE_DONT_TOUCH 2
658/** @} */
659
660/**
661 * Interrupt break state configuration entry.
662 */
663typedef struct DBGFINTERRUPTCONFIG
664{
665 /** The interrupt number. */
666 uint8_t iInterrupt;
667 /** The hardware interrupt state (DBGFINTERRUPTSTATE_XXX). */
668 uint8_t enmHardState;
669 /** The software interrupt state (DBGFINTERRUPTSTATE_XXX). */
670 uint8_t enmSoftState;
671} DBGFINTERRUPTCONFIG;
672/** Pointer to an interrupt break state config entyr. */
673typedef DBGFINTERRUPTCONFIG *PDBGFINTERRUPTCONFIG;
674/** Pointer to a const interrupt break state config entyr. */
675typedef DBGFINTERRUPTCONFIG const *PCDBGFINTERRUPTCONFIG;
676
677VMMR3DECL(int) DBGFR3InterruptConfigEx(PUVM pUVM, PCDBGFINTERRUPTCONFIG paConfigs, size_t cConfigs);
678VMMR3DECL(int) DBGFR3InterruptHardwareConfig(PUVM pUVM, uint8_t iInterrupt, bool fEnabled);
679VMMR3DECL(int) DBGFR3InterruptSoftwareConfig(PUVM pUVM, uint8_t iInterrupt, bool fEnabled);
680VMMR3DECL(int) DBGFR3InterruptHardwareIsEnabled(PUVM pUVM, uint8_t iInterrupt);
681VMMR3DECL(int) DBGFR3InterruptSoftwareIsEnabled(PUVM pUVM, uint8_t iInterrupt);
682
683#endif /* IN_RING3 */
684
685/** @def DBGF_IS_EVENT_ENABLED
686 * Checks if a selectable debug event is enabled or not (fast).
687 *
688 * @returns true/false.
689 * @param a_pVM Pointer to the cross context VM structure.
690 * @param a_enmEvent The selectable event to check.
691 * @remarks Only for use internally in the VMM. Use DBGFR3EventIsEnabled elsewhere.
692 */
693#if defined(VBOX_STRICT) && defined(RT_COMPILER_SUPPORTS_LAMBDA)
694# define DBGF_IS_EVENT_ENABLED(a_pVM, a_enmEvent) \
695 ([](PVM a_pLambdaVM, DBGFEVENTTYPE a_enmLambdaEvent) -> bool { \
696 Assert( a_enmLambdaEvent >= DBGFEVENT_FIRST_SELECTABLE \
697 || a_enmLambdaEvent == DBGFEVENT_INTERRUPT_HARDWARE \
698 || a_enmLambdaEvent == DBGFEVENT_INTERRUPT_SOFTWARE); \
699 Assert(a_enmLambdaEvent < DBGFEVENT_END); \
700 return ASMBitTest(&a_pLambdaVM->dbgf.ro.bmSelectedEvents, a_enmLambdaEvent); \
701 }(a_pVM, a_enmEvent))
702#elif defined(VBOX_STRICT) && defined(__GNUC__)
703# define DBGF_IS_EVENT_ENABLED(a_pVM, a_enmEvent) \
704 __extension__ ({ \
705 Assert( (a_enmEvent) >= DBGFEVENT_FIRST_SELECTABLE \
706 || (a_enmEvent) == DBGFEVENT_INTERRUPT_HARDWARE \
707 || (a_enmEvent) == DBGFEVENT_INTERRUPT_SOFTWARE); \
708 Assert((a_enmEvent) < DBGFEVENT_END); \
709 ASMBitTest(&(a_pVM)->dbgf.ro.bmSelectedEvents, (a_enmEvent)); \
710 })
711#else
712# define DBGF_IS_EVENT_ENABLED(a_pVM, a_enmEvent) \
713 ASMBitTest(&(a_pVM)->dbgf.ro.bmSelectedEvents, (a_enmEvent))
714#endif
715
716
717/** @def DBGF_IS_HARDWARE_INT_ENABLED
718 * Checks if hardware interrupt interception is enabled or not for an interrupt.
719 *
720 * @returns true/false.
721 * @param a_pVM Pointer to the cross context VM structure.
722 * @param a_iInterrupt Interrupt to check.
723 * @remarks Only for use internally in the VMM. Use
724 * DBGFR3InterruptHardwareIsEnabled elsewhere.
725 */
726#define DBGF_IS_HARDWARE_INT_ENABLED(a_pVM, a_iInterrupt) \
727 ASMBitTest(&(a_pVM)->dbgf.ro.bmHardIntBreakpoints, (uint8_t)(a_iInterrupt))
728
729/** @def DBGF_IS_SOFTWARE_INT_ENABLED
730 * Checks if software interrupt interception is enabled or not for an interrupt.
731 *
732 * @returns true/false.
733 * @param a_pVM Pointer to the cross context VM structure.
734 * @param a_iInterrupt Interrupt to check.
735 * @remarks Only for use internally in the VMM. Use
736 * DBGFR3InterruptSoftwareIsEnabled elsewhere.
737 */
738#define DBGF_IS_SOFTWARE_INT_ENABLED(a_pVM, a_iInterrupt) \
739 ASMBitTest(&(a_pVM)->dbgf.ro.bmSoftIntBreakpoints, (uint8_t)(a_iInterrupt))
740
741
742
743/** Breakpoint type. */
744typedef enum DBGFBPTYPE
745{
746 /** Free breakpoint entry. */
747 DBGFBPTYPE_FREE = 0,
748 /** Debug register. */
749 DBGFBPTYPE_REG,
750 /** INT 3 instruction. */
751 DBGFBPTYPE_INT3,
752 /** Recompiler. */
753 DBGFBPTYPE_REM,
754 /** Port I/O breakpoint. */
755 DBGFBPTYPE_PORT_IO,
756 /** Memory mapped I/O breakpoint. */
757 DBGFBPTYPE_MMIO,
758 /** ensure 32-bit size. */
759 DBGFBPTYPE_32BIT_HACK = 0x7fffffff
760} DBGFBPTYPE;
761
762
763/** @name DBGFBPIOACCESS_XXX - I/O (port + mmio) access types.
764 * @{ */
765/** Byte sized read accesses. */
766#define DBGFBPIOACCESS_READ_BYTE UINT32_C(0x00000001)
767/** Word sized accesses. */
768#define DBGFBPIOACCESS_READ_WORD UINT32_C(0x00000002)
769/** Double word sized accesses. */
770#define DBGFBPIOACCESS_READ_DWORD UINT32_C(0x00000004)
771/** Quad word sized accesses - not available for I/O ports. */
772#define DBGFBPIOACCESS_READ_QWORD UINT32_C(0x00000008)
773/** Other sized accesses - not available for I/O ports. */
774#define DBGFBPIOACCESS_READ_OTHER UINT32_C(0x00000010)
775/** Read mask. */
776#define DBGFBPIOACCESS_READ_MASK UINT32_C(0x0000001f)
777
778/** Byte sized write accesses. */
779#define DBGFBPIOACCESS_WRITE_BYTE UINT32_C(0x00000100)
780/** Word sized write accesses. */
781#define DBGFBPIOACCESS_WRITE_WORD UINT32_C(0x00000200)
782/** Double word sized write accesses. */
783#define DBGFBPIOACCESS_WRITE_DWORD UINT32_C(0x00000400)
784/** Quad word sized write accesses - not available for I/O ports. */
785#define DBGFBPIOACCESS_WRITE_QWORD UINT32_C(0x00000800)
786/** Other sized write accesses - not available for I/O ports. */
787#define DBGFBPIOACCESS_WRITE_OTHER UINT32_C(0x00001000)
788/** Write mask. */
789#define DBGFBPIOACCESS_WRITE_MASK UINT32_C(0x00001f00)
790
791/** All kind of access (read, write, all sizes). */
792#define DBGFBPIOACCESS_ALL UINT32_C(0x00001f1f)
793
794/** The acceptable mask for I/O ports. */
795#define DBGFBPIOACCESS_VALID_MASK_PORT_IO UINT32_C(0x00000303)
796/** The acceptable mask for MMIO. */
797#define DBGFBPIOACCESS_VALID_MASK_MMIO UINT32_C(0x00001f1f)
798/** @} */
799
800/**
801 * A Breakpoint.
802 */
803typedef struct DBGFBP
804{
805 /** The number of breakpoint hits. */
806 uint64_t cHits;
807 /** The hit number which starts to trigger the breakpoint. */
808 uint64_t iHitTrigger;
809 /** The hit number which stops triggering the breakpoint (disables it).
810 * Use ~(uint64_t)0 if it should never stop. */
811 uint64_t iHitDisable;
812 /** The breakpoint id. */
813 uint16_t iBp;
814 /** The breakpoint status - enabled or disabled. */
815 bool fEnabled;
816 /** The breakpoint type. */
817 DBGFBPTYPE enmType;
818
819 /** Union of type specific data. */
820 union
821 {
822 /** The flat GC address breakpoint address for REG, INT3 and REM breakpoints. */
823 RTGCUINTPTR GCPtr;
824
825 /** Debug register data. */
826 struct DBGFBPREG
827 {
828 /** The flat GC address of the breakpoint. */
829 RTGCUINTPTR GCPtr;
830 /** The debug register number. */
831 uint8_t iReg;
832 /** The access type (one of the X86_DR7_RW_* value). */
833 uint8_t fType;
834 /** The access size. */
835 uint8_t cb;
836 } Reg;
837
838 /** INT3 breakpoint data. */
839 struct DBGFBPINT3
840 {
841 /** The flat GC address of the breakpoint. */
842 RTGCUINTPTR GCPtr;
843 /** The physical address of the breakpoint. */
844 RTGCPHYS PhysAddr;
845 /** The byte value we replaced by the INT 3 instruction. */
846 uint8_t bOrg;
847 } Int3;
848
849 /** Recompiler breakpoint data. */
850 struct DBGFBPREM
851 {
852 /** The flat GC address of the breakpoint.
853 * (PC register value?) */
854 RTGCUINTPTR GCPtr;
855 } Rem;
856
857 /** I/O port breakpoint data. */
858 struct DBGFBPPORTIO
859 {
860 /** The first port. */
861 RTIOPORT uPort;
862 /** The number of ports. */
863 RTIOPORT cPorts;
864 /** Valid DBGFBPIOACCESS_XXX selection, max DWORD size. */
865 uint32_t fAccess;
866 } PortIo;
867
868 /** Memory mapped I/O breakpoint data. */
869 struct DBGFBPMMIO
870 {
871 /** The first MMIO address. */
872 RTGCPHYS PhysAddr;
873 /** The size of the MMIO range in bytes. */
874 uint32_t cb;
875 /** Valid DBGFBPIOACCESS_XXX selection, max DWORD size. */
876 uint32_t fAccess;
877 } Mmio;
878
879 /** Paddind to ensure that the size is identical on win32 and linux. */
880 uint64_t u64Padding[3];
881 } u;
882} DBGFBP;
883AssertCompileMembersAtSameOffset(DBGFBP, u.GCPtr, DBGFBP, u.Reg.GCPtr);
884AssertCompileMembersAtSameOffset(DBGFBP, u.GCPtr, DBGFBP, u.Int3.GCPtr);
885AssertCompileMembersAtSameOffset(DBGFBP, u.GCPtr, DBGFBP, u.Rem.GCPtr);
886
887/** Pointer to a breakpoint. */
888typedef DBGFBP *PDBGFBP;
889/** Pointer to a const breakpoint. */
890typedef const DBGFBP *PCDBGFBP;
891
892#ifdef IN_RING3 /* The breakpoint management API is only available in ring-3. */
893VMMR3DECL(int) DBGFR3BpSetInt3(PUVM pUVM, VMCPUID idSrcCpu, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp);
894VMMR3DECL(int) DBGFR3BpSetReg(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
895 uint8_t fType, uint8_t cb, uint32_t *piBp);
896VMMR3DECL(int) DBGFR3BpSetREM(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp);
897VMMR3DECL(int) DBGFR3BpSetPortIo(PUVM pUVM, RTIOPORT uPort, RTIOPORT cPorts, uint32_t fAccess,
898 uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp);
899VMMR3DECL(int) DBGFR3BpSetMmio(PUVM pUVM, RTGCPHYS GCPhys, uint32_t cb, uint32_t fAccess,
900 uint64_t iHitTrigger, uint64_t iHitDisable, uint32_t *piBp);
901VMMR3DECL(int) DBGFR3BpClear(PUVM pUVM, uint32_t iBp);
902VMMR3DECL(int) DBGFR3BpEnable(PUVM pUVM, uint32_t iBp);
903VMMR3DECL(int) DBGFR3BpDisable(PUVM pUVM, uint32_t iBp);
904
905/**
906 * Breakpoint enumeration callback function.
907 *
908 * @returns VBox status code.
909 * The enumeration stops on failure status and VINF_CALLBACK_RETURN.
910 * @param pUVM The user mode VM handle.
911 * @param pvUser The user argument.
912 * @param pBp Pointer to the breakpoint information. (readonly)
913 */
914typedef DECLCALLBACKTYPE(int, FNDBGFBPENUM,(PUVM pUVM, void *pvUser, PCDBGFBP pBp));
915/** Pointer to a breakpoint enumeration callback function. */
916typedef FNDBGFBPENUM *PFNDBGFBPENUM;
917
918VMMR3DECL(int) DBGFR3BpEnum(PUVM pUVM, PFNDBGFBPENUM pfnCallback, void *pvUser);
919#endif /* IN_RING3 */
920
921VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM);
922VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM);
923VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM);
924VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM);
925VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM);
926VMM_INT_DECL(bool) DBGFBpIsHwArmed(PVM pVM);
927VMM_INT_DECL(bool) DBGFBpIsHwIoArmed(PVM pVM);
928VMM_INT_DECL(bool) DBGFBpIsInt3Armed(PVM pVM);
929VMM_INT_DECL(bool) DBGFIsStepping(PVMCPU pVCpu);
930VMM_INT_DECL(VBOXSTRICTRC) DBGFBpCheckIo(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTIOPORT uIoPort, uint8_t cbValue);
931VMM_INT_DECL(VBOXSTRICTRC) DBGFEventGenericWithArgs(PVM pVM, PVMCPU pVCpu, DBGFEVENTTYPE enmEvent, DBGFEVENTCTX enmCtx,
932 unsigned cArgs, ...);
933
934
935#ifdef IN_RING3 /* The CPU mode API only works in ring-3. */
936VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PUVM pUVM, VMCPUID idCpu);
937VMMR3DECL(VMCPUID) DBGFR3CpuGetCount(PUVM pUVM);
938VMMR3DECL(bool) DBGFR3CpuIsIn64BitCode(PUVM pUVM, VMCPUID idCpu);
939VMMR3DECL(bool) DBGFR3CpuIsInV86Code(PUVM pUVM, VMCPUID idCpu);
940VMMR3DECL(const char *) DBGFR3CpuGetState(PUVM pUVM, VMCPUID idCpu);
941#endif
942
943
944
945#ifdef IN_RING3 /* The info callbacks API only works in ring-3. */
946
947struct RTGETOPTSTATE;
948union RTGETOPTUNION;
949
950/**
951 * Info helper callback structure.
952 */
953typedef struct DBGFINFOHLP
954{
955 /**
956 * Print formatted string.
957 *
958 * @param pHlp Pointer to this structure.
959 * @param pszFormat The format string.
960 * @param ... Arguments.
961 */
962 DECLCALLBACKMEMBER(void, pfnPrintf,(PCDBGFINFOHLP pHlp, const char *pszFormat, ...)) RT_IPRT_FORMAT_ATTR(2, 3);
963
964 /**
965 * Print formatted string.
966 *
967 * @param pHlp Pointer to this structure.
968 * @param pszFormat The format string.
969 * @param args Argument list.
970 */
971 DECLCALLBACKMEMBER(void, pfnPrintfV,(PCDBGFINFOHLP pHlp, const char *pszFormat, va_list args)) RT_IPRT_FORMAT_ATTR(2, 0);
972
973 /**
974 * Report getopt parsing trouble
975 *
976 * @param pHlp Pointer to this structure.
977 * @param rc The RTGetOpt return value.
978 * @param pValueUnion The value union.
979 * @param pState The getopt state.
980 */
981 DECLCALLBACKMEMBER(void, pfnGetOptError,(PCDBGFINFOHLP pHlp, int rc, union RTGETOPTUNION *pValueUnion,
982 struct RTGETOPTSTATE *pState));
983} DBGFINFOHLP;
984
985
986/**
987 * Info handler, device version.
988 *
989 * @param pDevIns The device instance which registered the info.
990 * @param pHlp Callback functions for doing output.
991 * @param pszArgs Argument string. Optional and specific to the handler.
992 */
993typedef DECLCALLBACKTYPE(void, FNDBGFHANDLERDEV,(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs));
994/** Pointer to a FNDBGFHANDLERDEV function. */
995typedef FNDBGFHANDLERDEV *PFNDBGFHANDLERDEV;
996
997/**
998 * Info handler, driver version.
999 *
1000 * @param pDrvIns The driver instance which registered the info.
1001 * @param pHlp Callback functions for doing output.
1002 * @param pszArgs Argument string. Optional and specific to the handler.
1003 */
1004typedef DECLCALLBACKTYPE(void, FNDBGFHANDLERDRV,(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs));
1005/** Pointer to a FNDBGFHANDLERDRV function. */
1006typedef FNDBGFHANDLERDRV *PFNDBGFHANDLERDRV;
1007
1008/**
1009 * Info handler, internal version.
1010 *
1011 * @param pVM The cross context VM structure.
1012 * @param pHlp Callback functions for doing output.
1013 * @param pszArgs Argument string. Optional and specific to the handler.
1014 */
1015typedef DECLCALLBACKTYPE(void, FNDBGFHANDLERINT,(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs));
1016/** Pointer to a FNDBGFHANDLERINT function. */
1017typedef FNDBGFHANDLERINT *PFNDBGFHANDLERINT;
1018
1019/**
1020 * Info handler, external version.
1021 *
1022 * @param pvUser User argument.
1023 * @param pHlp Callback functions for doing output.
1024 * @param pszArgs Argument string. Optional and specific to the handler.
1025 */
1026typedef DECLCALLBACKTYPE(void, FNDBGFHANDLEREXT,(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs));
1027/** Pointer to a FNDBGFHANDLEREXT function. */
1028typedef FNDBGFHANDLEREXT *PFNDBGFHANDLEREXT;
1029
1030/**
1031 * Info handler, device version with argv.
1032 *
1033 * @param pDevIns The device instance which registered the info.
1034 * @param pHlp Callback functions for doing output.
1035 * @param cArgs Number of arguments.
1036 * @param papszArgs Argument vector.
1037 */
1038typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVDEV,(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
1039/** Pointer to a FNDBGFINFOARGVDEV function. */
1040typedef FNDBGFINFOARGVDEV *PFNDBGFINFOARGVDEV;
1041
1042/**
1043 * Info handler, USB device version with argv.
1044 *
1045 * @param pUsbIns The USB device instance which registered the info.
1046 * @param pHlp Callback functions for doing output.
1047 * @param cArgs Number of arguments.
1048 * @param papszArgs Argument vector.
1049 */
1050typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVUSB,(PPDMUSBINS pUsbIns, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
1051/** Pointer to a FNDBGFINFOARGVUSB function. */
1052typedef FNDBGFINFOARGVUSB *PFNDBGFINFOARGVUSB;
1053
1054/**
1055 * Info handler, driver version with argv.
1056 *
1057 * @param pDrvIns The driver instance which registered the info.
1058 * @param pHlp Callback functions for doing output.
1059 * @param cArgs Number of arguments.
1060 * @param papszArgs Argument vector.
1061 */
1062typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVDRV,(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
1063/** Pointer to a FNDBGFINFOARGVDRV function. */
1064typedef FNDBGFINFOARGVDRV *PFNDBGFINFOARGVDRV;
1065
1066/**
1067 * Info handler, internal version with argv.
1068 *
1069 * @param pVM The cross context VM structure.
1070 * @param pHlp Callback functions for doing output.
1071 * @param cArgs Number of arguments.
1072 * @param papszArgs Argument vector.
1073 */
1074typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVINT,(PVM pVM, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
1075/** Pointer to a FNDBGFINFOARGVINT function. */
1076typedef FNDBGFINFOARGVINT *PFNDBGFINFOARGVINT;
1077
1078/**
1079 * Info handler, external version with argv.
1080 *
1081 * @param pvUser User argument.
1082 * @param pHlp Callback functions for doing output.
1083 * @param cArgs Number of arguments.
1084 * @param papszArgs Argument vector.
1085 */
1086typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVEXT,(void *pvUser, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
1087/** Pointer to a FNDBGFINFOARGVEXT function. */
1088typedef FNDBGFINFOARGVEXT *PFNDBGFINFOARGVEXT;
1089
1090
1091/** @name Flags for the info registration functions.
1092 * @{ */
1093/** The handler must run on the EMT. */
1094#define DBGFINFO_FLAGS_RUN_ON_EMT RT_BIT(0)
1095/** Call on all EMTs when a specific isn't specified. */
1096#define DBGFINFO_FLAGS_ALL_EMTS RT_BIT(1)
1097/** @} */
1098
1099VMMR3_INT_DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler, PPDMDEVINS pDevIns);
1100VMMR3_INT_DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns);
1101VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler);
1102VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags);
1103VMMR3DECL(int) DBGFR3InfoRegisterExternal(PUVM pUVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser);
1104
1105VMMR3_INT_DECL(int) DBGFR3InfoRegisterDeviceArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVDEV pfnHandler, PPDMDEVINS pDevIns);
1106VMMR3_INT_DECL(int) DBGFR3InfoRegisterDriverArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVDRV pfnHandler, PPDMDRVINS pDrvIns);
1107VMMR3_INT_DECL(int) DBGFR3InfoRegisterUsbArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVUSB pfnHandler, PPDMUSBINS pUsbIns);
1108VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternalArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVINT pfnHandler, uint32_t fFlags);
1109VMMR3DECL(int) DBGFR3InfoRegisterExternalArgv(PUVM pUVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVEXT pfnHandler, void *pvUser);
1110
1111VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName);
1112VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName);
1113VMMR3_INT_DECL(int) DBGFR3InfoDeregisterUsb(PVM pVM, PPDMUSBINS pDrvIns, const char *pszName);
1114VMMR3_INT_DECL(int) DBGFR3InfoDeregisterInternal(PVM pVM, const char *pszName);
1115VMMR3DECL(int) DBGFR3InfoDeregisterExternal(PUVM pUVM, const char *pszName);
1116
1117VMMR3DECL(int) DBGFR3Info(PUVM pUVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
1118VMMR3DECL(int) DBGFR3InfoEx(PUVM pUVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
1119VMMR3DECL(int) DBGFR3InfoLogRel(PUVM pUVM, const char *pszName, const char *pszArgs);
1120VMMR3DECL(int) DBGFR3InfoStdErr(PUVM pUVM, const char *pszName, const char *pszArgs);
1121VMMR3_INT_DECL(int) DBGFR3InfoMulti(PVM pVM, const char *pszIncludePat, const char *pszExcludePat,
1122 const char *pszSepFmt, PCDBGFINFOHLP pHlp);
1123
1124/** @def DBGFR3_INFO_LOG
1125 * Display a piece of info writing to the log if enabled.
1126 *
1127 * This is for execution on EMTs and will only show the items on the calling
1128 * EMT. This is to avoid deadlocking against other CPUs if a rendezvous is
1129 * initiated in parallel to this call. (Besides, nobody really wants or need
1130 * info for the other EMTs when using this macro.)
1131 *
1132 * @param a_pVM The shared VM handle.
1133 * @param a_pVCpu The cross context per CPU structure of the calling EMT.
1134 * @param a_pszName The identifier of the info to display.
1135 * @param a_pszArgs Arguments to the info handler.
1136 */
1137#ifdef LOG_ENABLED
1138# define DBGFR3_INFO_LOG(a_pVM, a_pVCpu, a_pszName, a_pszArgs) \
1139 do { \
1140 if (LogIsEnabled()) \
1141 DBGFR3InfoEx((a_pVM)->pUVM, (a_pVCpu)->idCpu, a_pszName, a_pszArgs, NULL); \
1142 } while (0)
1143#else
1144# define DBGFR3_INFO_LOG(a_pVM, a_pVCpu, a_pszName, a_pszArgs) do { } while (0)
1145#endif
1146
1147/** @def DBGFR3_INFO_LOG_SAFE
1148 * Display a piece of info (rendezvous safe) writing to the log if enabled.
1149 *
1150 * @param a_pVM The shared VM handle.
1151 * @param a_pszName The identifier of the info to display.
1152 * @param a_pszArgs Arguments to the info handler.
1153 *
1154 * @remarks Use DBGFR3_INFO_LOG where ever possible!
1155 */
1156#ifdef LOG_ENABLED
1157# define DBGFR3_INFO_LOG_SAFE(a_pVM, a_pszName, a_pszArgs) \
1158 do { \
1159 if (LogIsEnabled()) \
1160 DBGFR3Info((a_pVM)->pUVM, a_pszName, a_pszArgs, NULL); \
1161 } while (0)
1162#else
1163# define DBGFR3_INFO_LOG_SAFE(a_pVM, a_pszName, a_pszArgs) do { } while (0)
1164#endif
1165
1166/**
1167 * Enumeration callback for use with DBGFR3InfoEnum.
1168 *
1169 * @returns VBox status code.
1170 * A status code indicating failure will end the enumeration
1171 * and DBGFR3InfoEnum will return with that status code.
1172 * @param pUVM The user mode VM handle.
1173 * @param pszName Info identifier name.
1174 * @param pszDesc The description.
1175 */
1176typedef DECLCALLBACKTYPE(int, FNDBGFINFOENUM,(PUVM pUVM, const char *pszName, const char *pszDesc, void *pvUser));
1177/** Pointer to a FNDBGFINFOENUM function. */
1178typedef FNDBGFINFOENUM *PFNDBGFINFOENUM;
1179
1180VMMR3DECL(int) DBGFR3InfoEnum(PUVM pUVM, PFNDBGFINFOENUM pfnCallback, void *pvUser);
1181VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogHlp(void);
1182VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogRelHlp(void);
1183VMMR3DECL(void) DBGFR3InfoGenricGetOptError(PCDBGFINFOHLP pHlp, int rc, union RTGETOPTUNION *pValueUnion,
1184 struct RTGETOPTSTATE *pState);
1185
1186#endif /* IN_RING3 */
1187
1188
1189#ifdef IN_RING3 /* The log contrl API only works in ring-3. */
1190VMMR3DECL(int) DBGFR3LogModifyGroups(PUVM pUVM, const char *pszGroupSettings);
1191VMMR3DECL(int) DBGFR3LogModifyFlags(PUVM pUVM, const char *pszFlagSettings);
1192VMMR3DECL(int) DBGFR3LogModifyDestinations(PUVM pUVM, const char *pszDestSettings);
1193#endif /* IN_RING3 */
1194
1195#ifdef IN_RING3 /* The debug information management APIs only works in ring-3. */
1196
1197/** Max length (including '\\0') of a symbol name. */
1198#define DBGF_SYMBOL_NAME_LENGTH 512
1199
1200/**
1201 * Debug symbol.
1202 */
1203typedef struct DBGFSYMBOL
1204{
1205 /** Symbol value (address). */
1206 RTGCUINTPTR Value;
1207 /** Symbol size. */
1208 uint32_t cb;
1209 /** Symbol Flags. (reserved). */
1210 uint32_t fFlags;
1211 /** Symbol name. */
1212 char szName[DBGF_SYMBOL_NAME_LENGTH];
1213} DBGFSYMBOL;
1214/** Pointer to debug symbol. */
1215typedef DBGFSYMBOL *PDBGFSYMBOL;
1216/** Pointer to const debug symbol. */
1217typedef const DBGFSYMBOL *PCDBGFSYMBOL;
1218
1219/**
1220 * Debug line number information.
1221 */
1222typedef struct DBGFLINE
1223{
1224 /** Address. */
1225 RTGCUINTPTR Address;
1226 /** Line number. */
1227 uint32_t uLineNo;
1228 /** Filename. */
1229 char szFilename[260];
1230} DBGFLINE;
1231/** Pointer to debug line number. */
1232typedef DBGFLINE *PDBGFLINE;
1233/** Pointer to const debug line number. */
1234typedef const DBGFLINE *PCDBGFLINE;
1235
1236/** @name Address spaces aliases.
1237 * @{ */
1238/** The guest global address space. */
1239#define DBGF_AS_GLOBAL ((RTDBGAS)-1)
1240/** The guest kernel address space.
1241 * This is usually resolves to the same as DBGF_AS_GLOBAL. */
1242#define DBGF_AS_KERNEL ((RTDBGAS)-2)
1243/** The physical address space. */
1244#define DBGF_AS_PHYS ((RTDBGAS)-3)
1245/** Raw-mode context. */
1246#define DBGF_AS_RC ((RTDBGAS)-4)
1247/** Ring-0 context. */
1248#define DBGF_AS_R0 ((RTDBGAS)-5)
1249/** Raw-mode context and then global guest context.
1250 * When used for looking up information, it works as if the call was first made
1251 * with DBGF_AS_RC and then on failure with DBGF_AS_GLOBAL. When called for
1252 * making address space changes, it works as if DBGF_AS_RC was used. */
1253#define DBGF_AS_RC_AND_GC_GLOBAL ((RTDBGAS)-6)
1254
1255/** The first special one. */
1256#define DBGF_AS_FIRST DBGF_AS_RC_AND_GC_GLOBAL
1257/** The last special one. */
1258#define DBGF_AS_LAST DBGF_AS_GLOBAL
1259#endif
1260/** The number of special address space handles. */
1261#define DBGF_AS_COUNT (6U)
1262#ifdef IN_RING3
1263/** Converts an alias handle to an array index. */
1264#define DBGF_AS_ALIAS_2_INDEX(hAlias) \
1265 ( (uintptr_t)(hAlias) - (uintptr_t)DBGF_AS_FIRST )
1266/** Predicat macro that check if the specified handle is an alias. */
1267#define DBGF_AS_IS_ALIAS(hAlias) \
1268 ( DBGF_AS_ALIAS_2_INDEX(hAlias) < DBGF_AS_COUNT )
1269/** Predicat macro that check if the specified alias is a fixed one or not. */
1270#define DBGF_AS_IS_FIXED_ALIAS(hAlias) \
1271 ( DBGF_AS_ALIAS_2_INDEX(hAlias) < (uintptr_t)DBGF_AS_PHYS - (uintptr_t)DBGF_AS_FIRST + 1U )
1272
1273/** @} */
1274
1275VMMR3DECL(RTDBGCFG) DBGFR3AsGetConfig(PUVM pUVM);
1276
1277VMMR3DECL(int) DBGFR3AsAdd(PUVM pUVM, RTDBGAS hDbgAs, RTPROCESS ProcId);
1278VMMR3DECL(int) DBGFR3AsDelete(PUVM pUVM, RTDBGAS hDbgAs);
1279VMMR3DECL(int) DBGFR3AsSetAlias(PUVM pUVM, RTDBGAS hAlias, RTDBGAS hAliasFor);
1280VMMR3DECL(RTDBGAS) DBGFR3AsResolve(PUVM pUVM, RTDBGAS hAlias);
1281VMMR3DECL(RTDBGAS) DBGFR3AsResolveAndRetain(PUVM pUVM, RTDBGAS hAlias);
1282VMMR3DECL(RTDBGAS) DBGFR3AsQueryByName(PUVM pUVM, const char *pszName);
1283VMMR3DECL(RTDBGAS) DBGFR3AsQueryByPid(PUVM pUVM, RTPROCESS ProcId);
1284
1285VMMR3DECL(int) DBGFR3AsLoadImage(PUVM pUVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName,
1286 RTLDRARCH enmArch, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
1287VMMR3DECL(int) DBGFR3AsLoadMap(PUVM pUVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags);
1288VMMR3DECL(int) DBGFR3AsLinkModule(PUVM pUVM, RTDBGAS hDbgAs, RTDBGMOD hMod, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
1289VMMR3DECL(int) DBGFR3AsUnlinkModuleByName(PUVM pUVM, RTDBGAS hDbgAs, const char *pszModName);
1290
1291VMMR3DECL(int) DBGFR3AsSymbolByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, uint32_t fFlags,
1292 PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
1293VMMR3DECL(PRTDBGSYMBOL) DBGFR3AsSymbolByAddrA(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, uint32_t Flags,
1294 PRTGCINTPTR poffDisp, PRTDBGMOD phMod);
1295VMMR3DECL(int) DBGFR3AsSymbolByName(PUVM pUVM, RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
1296
1297VMMR3DECL(int) DBGFR3AsLineByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress,
1298 PRTGCINTPTR poffDisp, PRTDBGLINE pLine, PRTDBGMOD phMod);
1299VMMR3DECL(PRTDBGLINE) DBGFR3AsLineByAddrA(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress,
1300 PRTGCINTPTR poffDisp, PRTDBGMOD phMod);
1301
1302/** @name DBGFMOD_PE_F_XXX - flags for
1303 * @{ */
1304/** NT 3.1 images were a little different, so make allowances for that. */
1305#define DBGFMODINMEM_F_PE_NT31 RT_BIT_32(0)
1306/** No container fallback. */
1307#define DBGFMODINMEM_F_NO_CONTAINER_FALLBACK RT_BIT_32(1)
1308/** No in-memory reader fallback. */
1309#define DBGFMODINMEM_F_NO_READER_FALLBACK RT_BIT_32(2)
1310/** Valid flags. */
1311#define DBGFMODINMEM_F_VALID_MASK UINT32_C(0x00000007)
1312/** @} */
1313VMMR3DECL(int) DBGFR3ModInMem(PUVM pUVM, PCDBGFADDRESS pImageAddr, uint32_t fFlags, const char *pszName,
1314 const char *pszFilename, RTLDRARCH enmArch, uint32_t cbImage,
1315 PRTDBGMOD phDbgMod, PRTERRINFO pErrInfo);
1316
1317#endif /* IN_RING3 */
1318
1319#ifdef IN_RING3 /* The stack API only works in ring-3. */
1320
1321/** Pointer to stack frame info. */
1322typedef struct DBGFSTACKFRAME *PDBGFSTACKFRAME;
1323/** Pointer to const stack frame info. */
1324typedef struct DBGFSTACKFRAME const *PCDBGFSTACKFRAME;
1325/**
1326 * Info about a stack frame.
1327 */
1328typedef struct DBGFSTACKFRAME
1329{
1330 /** Frame number. */
1331 uint32_t iFrame;
1332 /** Frame flags (DBGFSTACKFRAME_FLAGS_XXX). */
1333 uint32_t fFlags;
1334 /** The stack address of the frame.
1335 * The off member is [e|r]sp and the Sel member is ss. */
1336 DBGFADDRESS AddrStack;
1337 /** The program counter (PC) address of the frame.
1338 * The off member is [e|r]ip and the Sel member is cs. */
1339 DBGFADDRESS AddrPC;
1340 /** Pointer to the symbol nearest the program counter (PC). NULL if not found. */
1341 PRTDBGSYMBOL pSymPC;
1342 /** Pointer to the linenumber nearest the program counter (PC). NULL if not found. */
1343 PRTDBGLINE pLinePC;
1344 /** The frame address.
1345 * The off member is [e|r]bp and the Sel member is ss. */
1346 DBGFADDRESS AddrFrame;
1347 /** The way this frame returns to the next one. */
1348 RTDBGRETURNTYPE enmReturnType;
1349
1350 /** The way the next frame returns.
1351 * Only valid when DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET is set. */
1352 RTDBGRETURNTYPE enmReturnFrameReturnType;
1353 /** The return frame address.
1354 * The off member is [e|r]bp and the Sel member is ss. */
1355 DBGFADDRESS AddrReturnFrame;
1356 /** The return stack address.
1357 * The off member is [e|r]sp and the Sel member is ss. */
1358 DBGFADDRESS AddrReturnStack;
1359
1360 /** The program counter (PC) address which the frame returns to.
1361 * The off member is [e|r]ip and the Sel member is cs. */
1362 DBGFADDRESS AddrReturnPC;
1363 /** Pointer to the symbol nearest the return PC. NULL if not found. */
1364 PRTDBGSYMBOL pSymReturnPC;
1365 /** Pointer to the linenumber nearest the return PC. NULL if not found. */
1366 PRTDBGLINE pLineReturnPC;
1367
1368 /** 32-bytes of stack arguments. */
1369 union
1370 {
1371 /** 64-bit view */
1372 uint64_t au64[4];
1373 /** 32-bit view */
1374 uint32_t au32[8];
1375 /** 16-bit view */
1376 uint16_t au16[16];
1377 /** 8-bit view */
1378 uint8_t au8[32];
1379 } Args;
1380
1381 /** Number of registers values we can be sure about.
1382 * @note This is generally zero in the first frame. */
1383 uint32_t cSureRegs;
1384 /** Registers we can be sure about (length given by cSureRegs). */
1385 struct DBGFREGVALEX *paSureRegs;
1386
1387 /** Pointer to the next frame.
1388 * Might not be used in some cases, so consider it internal. */
1389 PCDBGFSTACKFRAME pNextInternal;
1390 /** Pointer to the first frame.
1391 * Might not be used in some cases, so consider it internal. */
1392 PCDBGFSTACKFRAME pFirstInternal;
1393} DBGFSTACKFRAME;
1394
1395/** @name DBGFSTACKFRAME_FLAGS_XXX - DBGFSTACKFRAME Flags.
1396 * @{ */
1397/** This is the last stack frame we can read.
1398 * This flag is not set if the walk stop because of max dept or recursion. */
1399# define DBGFSTACKFRAME_FLAGS_LAST RT_BIT(1)
1400/** This is the last record because we detected a loop. */
1401# define DBGFSTACKFRAME_FLAGS_LOOP RT_BIT(2)
1402/** This is the last record because we reached the maximum depth. */
1403# define DBGFSTACKFRAME_FLAGS_MAX_DEPTH RT_BIT(3)
1404/** 16-bit frame. */
1405# define DBGFSTACKFRAME_FLAGS_16BIT RT_BIT(4)
1406/** 32-bit frame. */
1407# define DBGFSTACKFRAME_FLAGS_32BIT RT_BIT(5)
1408/** 64-bit frame. */
1409# define DBGFSTACKFRAME_FLAGS_64BIT RT_BIT(6)
1410/** Real mode or V86 frame. */
1411# define DBGFSTACKFRAME_FLAGS_REAL_V86 RT_BIT(7)
1412/** Is a trap frame (NT term). */
1413# define DBGFSTACKFRAME_FLAGS_TRAP_FRAME RT_BIT(8)
1414
1415/** Used Odd/even heuristics for far/near return. */
1416# define DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN RT_BIT(29)
1417/** Set if we used unwind info to construct the frame. (Kind of internal.) */
1418# define DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO RT_BIT(30)
1419/** Internal: Unwind info used for the return frame. */
1420# define DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET RT_BIT(31)
1421/** @} */
1422
1423/** @name DBGFCODETYPE
1424 * @{ */
1425typedef enum DBGFCODETYPE
1426{
1427 /** The usual invalid 0 value. */
1428 DBGFCODETYPE_INVALID = 0,
1429 /** Stack walk for guest code. */
1430 DBGFCODETYPE_GUEST,
1431 /** Stack walk for hypervisor code. */
1432 DBGFCODETYPE_HYPER,
1433 /** Stack walk for ring 0 code. */
1434 DBGFCODETYPE_RING0,
1435 /** The usual 32-bit blowup. */
1436 DBGFCODETYPE_32BIT_HACK = 0x7fffffff
1437} DBGFCODETYPE;
1438/** @} */
1439
1440VMMR3DECL(int) DBGFR3StackWalkBegin(PUVM pUVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType,
1441 PCDBGFSTACKFRAME *ppFirstFrame);
1442VMMR3DECL(int) DBGFR3StackWalkBeginEx(PUVM pUVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFADDRESS pAddrFrame,
1443 PCDBGFADDRESS pAddrStack,PCDBGFADDRESS pAddrPC,
1444 RTDBGRETURNTYPE enmReturnType, PCDBGFSTACKFRAME *ppFirstFrame);
1445VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent);
1446VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame);
1447
1448#endif /* IN_RING3 */
1449
1450
1451#ifdef IN_RING3 /* The disassembly API only works in ring-3. */
1452
1453/** @name Flags to pass to DBGFR3DisasInstrEx().
1454 * @{ */
1455/** Disassemble the current guest instruction, with annotations. */
1456#define DBGF_DISAS_FLAGS_CURRENT_GUEST RT_BIT(0)
1457/** No annotations for current context. */
1458#define DBGF_DISAS_FLAGS_NO_ANNOTATION RT_BIT(2)
1459/** No symbol lookup. */
1460#define DBGF_DISAS_FLAGS_NO_SYMBOLS RT_BIT(3)
1461/** No instruction bytes. */
1462#define DBGF_DISAS_FLAGS_NO_BYTES RT_BIT(4)
1463/** No address in the output. */
1464#define DBGF_DISAS_FLAGS_NO_ADDRESS RT_BIT(5)
1465/** Disassemble original unpatched bytes (PATM). */
1466#define DBGF_DISAS_FLAGS_UNPATCHED_BYTES RT_BIT(7)
1467/** Annotate patched instructions. */
1468#define DBGF_DISAS_FLAGS_ANNOTATE_PATCHED RT_BIT(8)
1469/** Disassemble in the default mode of the specific context. */
1470#define DBGF_DISAS_FLAGS_DEFAULT_MODE UINT32_C(0x00000000)
1471/** Disassemble in 16-bit mode. */
1472#define DBGF_DISAS_FLAGS_16BIT_MODE UINT32_C(0x10000000)
1473/** Disassemble in 16-bit mode with real mode address translation. */
1474#define DBGF_DISAS_FLAGS_16BIT_REAL_MODE UINT32_C(0x20000000)
1475/** Disassemble in 32-bit mode. */
1476#define DBGF_DISAS_FLAGS_32BIT_MODE UINT32_C(0x30000000)
1477/** Disassemble in 64-bit mode. */
1478#define DBGF_DISAS_FLAGS_64BIT_MODE UINT32_C(0x40000000)
1479/** The disassembly mode mask. */
1480#define DBGF_DISAS_FLAGS_MODE_MASK UINT32_C(0x70000000)
1481/** Mask containing the valid flags. */
1482#define DBGF_DISAS_FLAGS_VALID_MASK UINT32_C(0x700001ff)
1483/** @} */
1484
1485/** Special flat selector. */
1486#define DBGF_SEL_FLAT 1
1487
1488VMMR3DECL(int) DBGFR3DisasInstrEx(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, uint32_t fFlags,
1489 char *pszOutput, uint32_t cbOutput, uint32_t *pcbInstr);
1490VMMR3_INT_DECL(int) DBGFR3DisasInstrCurrent(PVMCPU pVCpu, char *pszOutput, uint32_t cbOutput);
1491VMMR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVMCPU pVCpu, const char *pszPrefix);
1492
1493/** @def DBGFR3_DISAS_INSTR_CUR_LOG
1494 * Disassembles the current guest context instruction and writes it to the log.
1495 * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
1496 */
1497#ifdef LOG_ENABLED
1498# define DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, pszPrefix) \
1499 do { \
1500 if (LogIsEnabled()) \
1501 DBGFR3DisasInstrCurrentLogInternal(pVCpu, pszPrefix); \
1502 } while (0)
1503#else
1504# define DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, pszPrefix) do { } while (0)
1505#endif
1506
1507VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr, const char *pszPrefix);
1508
1509/** @def DBGFR3_DISAS_INSTR_LOG
1510 * Disassembles the specified guest context instruction and writes it to the log.
1511 * Addresses will be attempted resolved to symbols.
1512 * @thread Any EMT.
1513 */
1514# ifdef LOG_ENABLED
1515# define DBGFR3_DISAS_INSTR_LOG(pVCpu, Sel, GCPtr, pszPrefix) \
1516 do { \
1517 if (LogIsEnabled()) \
1518 DBGFR3DisasInstrLogInternal(pVCpu, Sel, GCPtr, pszPrefix); \
1519 } while (0)
1520# else
1521# define DBGFR3_DISAS_INSTR_LOG(pVCpu, Sel, GCPtr, pszPrefix) do { } while (0)
1522# endif
1523#endif
1524
1525
1526#ifdef IN_RING3
1527VMMR3DECL(int) DBGFR3MemScan(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, RTGCUINTPTR uAlign,
1528 const void *pvNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress);
1529VMMR3DECL(int) DBGFR3MemRead(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead);
1530VMMR3DECL(int) DBGFR3MemReadString(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cbBuf);
1531VMMR3DECL(int) DBGFR3MemWrite(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void const *pvBuf, size_t cbRead);
1532#endif
1533
1534
1535/** @name Flags for DBGFR3PagingDumpEx, PGMR3DumpHierarchyHCEx and
1536 * PGMR3DumpHierarchyGCEx
1537 * @{ */
1538/** The CR3 from the current CPU state. */
1539#define DBGFPGDMP_FLAGS_CURRENT_CR3 RT_BIT_32(0)
1540/** The current CPU paging mode (PSE, PAE, LM, EPT, NX). */
1541#define DBGFPGDMP_FLAGS_CURRENT_MODE RT_BIT_32(1)
1542/** Whether PSE is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
1543 * Same value as X86_CR4_PSE. */
1544#define DBGFPGDMP_FLAGS_PSE RT_BIT_32(4) /* */
1545/** Whether PAE is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
1546 * Same value as X86_CR4_PAE. */
1547#define DBGFPGDMP_FLAGS_PAE RT_BIT_32(5) /* */
1548/** Whether LME is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
1549 * Same value as MSR_K6_EFER_LME. */
1550#define DBGFPGDMP_FLAGS_LME RT_BIT_32(8)
1551/** Whether nested paging is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE). */
1552#define DBGFPGDMP_FLAGS_NP RT_BIT_32(9)
1553/** Whether extended nested page tables are enabled
1554 * (!DBGFPGDMP_FLAGS_CURRENT_STATE). */
1555#define DBGFPGDMP_FLAGS_EPT RT_BIT_32(10)
1556/** Whether no-execution is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
1557 * Same value as MSR_K6_EFER_NXE. */
1558#define DBGFPGDMP_FLAGS_NXE RT_BIT_32(11)
1559/** Whether to print the CR3. */
1560#define DBGFPGDMP_FLAGS_PRINT_CR3 RT_BIT_32(27)
1561/** Whether to print the header. */
1562#define DBGFPGDMP_FLAGS_HEADER RT_BIT_32(28)
1563/** Whether to dump additional page information. */
1564#define DBGFPGDMP_FLAGS_PAGE_INFO RT_BIT_32(29)
1565/** Dump the shadow tables if set.
1566 * Cannot be used together with DBGFPGDMP_FLAGS_GUEST. */
1567#define DBGFPGDMP_FLAGS_SHADOW RT_BIT_32(30)
1568/** Dump the guest tables if set.
1569 * Cannot be used together with DBGFPGDMP_FLAGS_SHADOW. */
1570#define DBGFPGDMP_FLAGS_GUEST RT_BIT_32(31)
1571/** Mask of valid bits. */
1572#define DBGFPGDMP_FLAGS_VALID_MASK UINT32_C(0xf8000f33)
1573/** The mask of bits controlling the paging mode. */
1574#define DBGFPGDMP_FLAGS_MODE_MASK UINT32_C(0x00000f32)
1575/** @} */
1576VMMDECL(int) DBGFR3PagingDumpEx(PUVM pUVM, VMCPUID idCpu, uint32_t fFlags, uint64_t cr3, uint64_t u64FirstAddr,
1577 uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
1578
1579
1580/** @name DBGFR3SelQueryInfo flags.
1581 * @{ */
1582/** Get the info from the guest descriptor table.
1583 * @note This is more or less a given now when raw-mode was kicked out. */
1584#define DBGFSELQI_FLAGS_DT_GUEST UINT32_C(0)
1585/** If currently executing in in 64-bit mode, blow up data selectors. */
1586#define DBGFSELQI_FLAGS_DT_ADJ_64BIT_MODE UINT32_C(2)
1587/** @} */
1588VMMR3DECL(int) DBGFR3SelQueryInfo(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo);
1589
1590
1591/**
1592 * Register identifiers.
1593 */
1594typedef enum DBGFREG
1595{
1596 /* General purpose registers: */
1597 DBGFREG_AL = 0,
1598 DBGFREG_AX = DBGFREG_AL,
1599 DBGFREG_EAX = DBGFREG_AL,
1600 DBGFREG_RAX = DBGFREG_AL,
1601
1602 DBGFREG_CL,
1603 DBGFREG_CX = DBGFREG_CL,
1604 DBGFREG_ECX = DBGFREG_CL,
1605 DBGFREG_RCX = DBGFREG_CL,
1606
1607 DBGFREG_DL,
1608 DBGFREG_DX = DBGFREG_DL,
1609 DBGFREG_EDX = DBGFREG_DL,
1610 DBGFREG_RDX = DBGFREG_DL,
1611
1612 DBGFREG_BL,
1613 DBGFREG_BX = DBGFREG_BL,
1614 DBGFREG_EBX = DBGFREG_BL,
1615 DBGFREG_RBX = DBGFREG_BL,
1616
1617 DBGFREG_SPL,
1618 DBGFREG_SP = DBGFREG_SPL,
1619 DBGFREG_ESP = DBGFREG_SPL,
1620 DBGFREG_RSP = DBGFREG_SPL,
1621
1622 DBGFREG_BPL,
1623 DBGFREG_BP = DBGFREG_BPL,
1624 DBGFREG_EBP = DBGFREG_BPL,
1625 DBGFREG_RBP = DBGFREG_BPL,
1626
1627 DBGFREG_SIL,
1628 DBGFREG_SI = DBGFREG_SIL,
1629 DBGFREG_ESI = DBGFREG_SIL,
1630 DBGFREG_RSI = DBGFREG_SIL,
1631
1632 DBGFREG_DIL,
1633 DBGFREG_DI = DBGFREG_DIL,
1634 DBGFREG_EDI = DBGFREG_DIL,
1635 DBGFREG_RDI = DBGFREG_DIL,
1636
1637 DBGFREG_R8,
1638 DBGFREG_R8B = DBGFREG_R8,
1639 DBGFREG_R8W = DBGFREG_R8,
1640 DBGFREG_R8D = DBGFREG_R8,
1641
1642 DBGFREG_R9,
1643 DBGFREG_R9B = DBGFREG_R9,
1644 DBGFREG_R9W = DBGFREG_R9,
1645 DBGFREG_R9D = DBGFREG_R9,
1646
1647 DBGFREG_R10,
1648 DBGFREG_R10B = DBGFREG_R10,
1649 DBGFREG_R10W = DBGFREG_R10,
1650 DBGFREG_R10D = DBGFREG_R10,
1651
1652 DBGFREG_R11,
1653 DBGFREG_R11B = DBGFREG_R11,
1654 DBGFREG_R11W = DBGFREG_R11,
1655 DBGFREG_R11D = DBGFREG_R11,
1656
1657 DBGFREG_R12,
1658 DBGFREG_R12B = DBGFREG_R12,
1659 DBGFREG_R12W = DBGFREG_R12,
1660 DBGFREG_R12D = DBGFREG_R12,
1661
1662 DBGFREG_R13,
1663 DBGFREG_R13B = DBGFREG_R13,
1664 DBGFREG_R13W = DBGFREG_R13,
1665 DBGFREG_R13D = DBGFREG_R13,
1666
1667 DBGFREG_R14,
1668 DBGFREG_R14B = DBGFREG_R14,
1669 DBGFREG_R14W = DBGFREG_R14,
1670 DBGFREG_R14D = DBGFREG_R14,
1671
1672 DBGFREG_R15,
1673 DBGFREG_R15B = DBGFREG_R15,
1674 DBGFREG_R15W = DBGFREG_R15,
1675 DBGFREG_R15D = DBGFREG_R15,
1676
1677 /* Segments and other special registers: */
1678 DBGFREG_CS,
1679 DBGFREG_CS_ATTR,
1680 DBGFREG_CS_BASE,
1681 DBGFREG_CS_LIMIT,
1682
1683 DBGFREG_DS,
1684 DBGFREG_DS_ATTR,
1685 DBGFREG_DS_BASE,
1686 DBGFREG_DS_LIMIT,
1687
1688 DBGFREG_ES,
1689 DBGFREG_ES_ATTR,
1690 DBGFREG_ES_BASE,
1691 DBGFREG_ES_LIMIT,
1692
1693 DBGFREG_FS,
1694 DBGFREG_FS_ATTR,
1695 DBGFREG_FS_BASE,
1696 DBGFREG_FS_LIMIT,
1697
1698 DBGFREG_GS,
1699 DBGFREG_GS_ATTR,
1700 DBGFREG_GS_BASE,
1701 DBGFREG_GS_LIMIT,
1702
1703 DBGFREG_SS,
1704 DBGFREG_SS_ATTR,
1705 DBGFREG_SS_BASE,
1706 DBGFREG_SS_LIMIT,
1707
1708 DBGFREG_IP,
1709 DBGFREG_EIP = DBGFREG_IP,
1710 DBGFREG_RIP = DBGFREG_IP,
1711
1712 DBGFREG_FLAGS,
1713 DBGFREG_EFLAGS = DBGFREG_FLAGS,
1714 DBGFREG_RFLAGS = DBGFREG_FLAGS,
1715
1716 /* FPU: */
1717 DBGFREG_FCW,
1718 DBGFREG_FSW,
1719 DBGFREG_FTW,
1720 DBGFREG_FOP,
1721 DBGFREG_FPUIP,
1722 DBGFREG_FPUCS,
1723 DBGFREG_FPUDP,
1724 DBGFREG_FPUDS,
1725 DBGFREG_MXCSR,
1726 DBGFREG_MXCSR_MASK,
1727
1728 DBGFREG_ST0,
1729 DBGFREG_ST1,
1730 DBGFREG_ST2,
1731 DBGFREG_ST3,
1732 DBGFREG_ST4,
1733 DBGFREG_ST5,
1734 DBGFREG_ST6,
1735 DBGFREG_ST7,
1736
1737 DBGFREG_MM0,
1738 DBGFREG_MM1,
1739 DBGFREG_MM2,
1740 DBGFREG_MM3,
1741 DBGFREG_MM4,
1742 DBGFREG_MM5,
1743 DBGFREG_MM6,
1744 DBGFREG_MM7,
1745
1746 /* SSE: */
1747 DBGFREG_XMM0,
1748 DBGFREG_XMM1,
1749 DBGFREG_XMM2,
1750 DBGFREG_XMM3,
1751 DBGFREG_XMM4,
1752 DBGFREG_XMM5,
1753 DBGFREG_XMM6,
1754 DBGFREG_XMM7,
1755 DBGFREG_XMM8,
1756 DBGFREG_XMM9,
1757 DBGFREG_XMM10,
1758 DBGFREG_XMM11,
1759 DBGFREG_XMM12,
1760 DBGFREG_XMM13,
1761 DBGFREG_XMM14,
1762 DBGFREG_XMM15,
1763 /** @todo add XMM aliases. */
1764
1765 /* AVX: */
1766 DBGFREG_YMM0,
1767 DBGFREG_YMM1,
1768 DBGFREG_YMM2,
1769 DBGFREG_YMM3,
1770 DBGFREG_YMM4,
1771 DBGFREG_YMM5,
1772 DBGFREG_YMM6,
1773 DBGFREG_YMM7,
1774 DBGFREG_YMM8,
1775 DBGFREG_YMM9,
1776 DBGFREG_YMM10,
1777 DBGFREG_YMM11,
1778 DBGFREG_YMM12,
1779 DBGFREG_YMM13,
1780 DBGFREG_YMM14,
1781 DBGFREG_YMM15,
1782
1783 /* System registers: */
1784 DBGFREG_GDTR_BASE,
1785 DBGFREG_GDTR_LIMIT,
1786 DBGFREG_IDTR_BASE,
1787 DBGFREG_IDTR_LIMIT,
1788 DBGFREG_LDTR,
1789 DBGFREG_LDTR_ATTR,
1790 DBGFREG_LDTR_BASE,
1791 DBGFREG_LDTR_LIMIT,
1792 DBGFREG_TR,
1793 DBGFREG_TR_ATTR,
1794 DBGFREG_TR_BASE,
1795 DBGFREG_TR_LIMIT,
1796
1797 DBGFREG_CR0,
1798 DBGFREG_CR2,
1799 DBGFREG_CR3,
1800 DBGFREG_CR4,
1801 DBGFREG_CR8,
1802
1803 DBGFREG_DR0,
1804 DBGFREG_DR1,
1805 DBGFREG_DR2,
1806 DBGFREG_DR3,
1807 DBGFREG_DR6,
1808 DBGFREG_DR7,
1809
1810 /* MSRs: */
1811 DBGFREG_MSR_IA32_APICBASE,
1812 DBGFREG_MSR_IA32_CR_PAT,
1813 DBGFREG_MSR_IA32_PERF_STATUS,
1814 DBGFREG_MSR_IA32_SYSENTER_CS,
1815 DBGFREG_MSR_IA32_SYSENTER_EIP,
1816 DBGFREG_MSR_IA32_SYSENTER_ESP,
1817 DBGFREG_MSR_IA32_TSC,
1818 DBGFREG_MSR_K6_EFER,
1819 DBGFREG_MSR_K6_STAR,
1820 DBGFREG_MSR_K8_CSTAR,
1821 DBGFREG_MSR_K8_FS_BASE,
1822 DBGFREG_MSR_K8_GS_BASE,
1823 DBGFREG_MSR_K8_KERNEL_GS_BASE,
1824 DBGFREG_MSR_K8_LSTAR,
1825 DBGFREG_MSR_K8_SF_MASK,
1826 DBGFREG_MSR_K8_TSC_AUX,
1827
1828 /** The number of registers to pass to DBGFR3RegQueryAll. */
1829 DBGFREG_ALL_COUNT,
1830
1831 /* Misc aliases that doesn't need be part of the 'all' query: */
1832 DBGFREG_AH = DBGFREG_ALL_COUNT,
1833 DBGFREG_CH,
1834 DBGFREG_DH,
1835 DBGFREG_BH,
1836 DBGFREG_GDTR,
1837 DBGFREG_IDTR,
1838
1839 /** The end of the registers. */
1840 DBGFREG_END,
1841 /** The usual 32-bit type hack. */
1842 DBGFREG_32BIT_HACK = 0x7fffffff
1843} DBGFREG;
1844/** Pointer to a register identifier. */
1845typedef DBGFREG *PDBGFREG;
1846/** Pointer to a const register identifier. */
1847typedef DBGFREG const *PCDBGFREG;
1848
1849/**
1850 * Register value type.
1851 */
1852typedef enum DBGFREGVALTYPE
1853{
1854 DBGFREGVALTYPE_INVALID = 0,
1855 /** Unsigned 8-bit register value. */
1856 DBGFREGVALTYPE_U8,
1857 /** Unsigned 16-bit register value. */
1858 DBGFREGVALTYPE_U16,
1859 /** Unsigned 32-bit register value. */
1860 DBGFREGVALTYPE_U32,
1861 /** Unsigned 64-bit register value. */
1862 DBGFREGVALTYPE_U64,
1863 /** Unsigned 128-bit register value. */
1864 DBGFREGVALTYPE_U128,
1865 /** Unsigned 256-bit register value. */
1866 DBGFREGVALTYPE_U256,
1867 /** Unsigned 512-bit register value. */
1868 DBGFREGVALTYPE_U512,
1869 /** Long double register value. */
1870 DBGFREGVALTYPE_R80,
1871 /** Descriptor table register value. */
1872 DBGFREGVALTYPE_DTR,
1873 /** End of the valid register value types. */
1874 DBGFREGVALTYPE_END,
1875 /** The usual 32-bit type hack. */
1876 DBGFREGVALTYPE_32BIT_HACK = 0x7fffffff
1877} DBGFREGVALTYPE;
1878/** Pointer to a register value type. */
1879typedef DBGFREGVALTYPE *PDBGFREGVALTYPE;
1880
1881/**
1882 * A generic register value type.
1883 */
1884typedef union DBGFREGVAL
1885{
1886 uint64_t au64[8]; /**< The 64-bit array view. First because of the initializer. */
1887 uint32_t au32[16]; /**< The 32-bit array view. */
1888 uint16_t au16[32]; /**< The 16-bit array view. */
1889 uint8_t au8[64]; /**< The 8-bit array view. */
1890
1891 uint8_t u8; /**< The 8-bit view. */
1892 uint16_t u16; /**< The 16-bit view. */
1893 uint32_t u32; /**< The 32-bit view. */
1894 uint64_t u64; /**< The 64-bit view. */
1895 RTUINT128U u128; /**< The 128-bit view. */
1896 RTUINT256U u256; /**< The 256-bit view. */
1897 RTUINT512U u512; /**< The 512-bit view. */
1898 RTFLOAT80U r80; /**< The 80-bit floating point view. */
1899 RTFLOAT80U2 r80Ex; /**< The 80-bit floating point view v2. */
1900 /** GDTR or LDTR (DBGFREGVALTYPE_DTR). */
1901 struct
1902 {
1903 /** The table address. */
1904 uint64_t u64Base;
1905 /** The table limit (length minus 1). */
1906 uint32_t u32Limit; /**< @todo Limit should be uint16_t */
1907 } dtr;
1908} DBGFREGVAL;
1909/** Pointer to a generic register value type. */
1910typedef DBGFREGVAL *PDBGFREGVAL;
1911/** Pointer to a const generic register value type. */
1912typedef DBGFREGVAL const *PCDBGFREGVAL;
1913
1914/** Initialize a DBGFREGVAL variable to all zeros. */
1915#define DBGFREGVAL_INITIALIZE_ZERO { { 0, 0, 0, 0, 0, 0, 0, 0 } }
1916/** Initialize a DBGFREGVAL variable to all bits set . */
1917#define DBGFREGVAL_INITIALIZE_FFFF { { UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX } }
1918
1919/**
1920 * Extended register value, including register ID and type.
1921 *
1922 * This is currently only used by the stack walker.
1923 */
1924typedef struct DBGFREGVALEX
1925{
1926 /** The register value. */
1927 DBGFREGVAL Value;
1928 /** The register value type. */
1929 DBGFREGVALTYPE enmType;
1930 /** The register ID, DBGFREG_END if not applicable. */
1931 DBGFREG enmReg;
1932 /** Pointer to read-only register name string if no register ID could be found. */
1933 const char *pszName;
1934} DBGFREGVALEX;
1935/** Pointer to an extended register value struct. */
1936typedef DBGFREGVALEX *PDBGFREGVALEX;
1937/** Pointer to a const extended register value struct. */
1938typedef DBGFREGVALEX const *PCDBGFREGVALEX;
1939
1940
1941VMMDECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial);
1942VMMDECL(ssize_t) DBGFR3RegFormatValueEx(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType,
1943 unsigned uBase, signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
1944
1945/**
1946 * Register sub-field descriptor.
1947 */
1948typedef struct DBGFREGSUBFIELD
1949{
1950 /** The name of the sub-field. NULL is used to terminate the array. */
1951 const char *pszName;
1952 /** The index of the first bit. Ignored if pfnGet is set. */
1953 uint8_t iFirstBit;
1954 /** The number of bits. Mandatory. */
1955 uint8_t cBits;
1956 /** The shift count. Not applied when pfnGet is set, but used to
1957 * calculate the minimum type. */
1958 int8_t cShift;
1959 /** Sub-field flags, DBGFREGSUBFIELD_FLAGS_XXX. */
1960 uint8_t fFlags;
1961 /** Getter (optional).
1962 * @remarks Does not take the device lock or anything like that.
1963 */
1964 DECLCALLBACKMEMBER(int, pfnGet,(void *pvUser, struct DBGFREGSUBFIELD const *pSubField, PRTUINT128U puValue));
1965 /** Setter (optional).
1966 * @remarks Does not take the device lock or anything like that.
1967 */
1968 DECLCALLBACKMEMBER(int, pfnSet,(void *pvUser, struct DBGFREGSUBFIELD const *pSubField, RTUINT128U uValue, RTUINT128U fMask));
1969} DBGFREGSUBFIELD;
1970/** Pointer to a const register sub-field descriptor. */
1971typedef DBGFREGSUBFIELD const *PCDBGFREGSUBFIELD;
1972
1973/** @name DBGFREGSUBFIELD_FLAGS_XXX
1974 * @{ */
1975/** The sub-field is read-only. */
1976#define DBGFREGSUBFIELD_FLAGS_READ_ONLY UINT8_C(0x01)
1977/** @} */
1978
1979/** Macro for creating a read-write sub-field entry without getters. */
1980#define DBGFREGSUBFIELD_RW(a_szName, a_iFirstBit, a_cBits, a_cShift) \
1981 { a_szName, a_iFirstBit, a_cBits, a_cShift, 0 /*fFlags*/, NULL /*pfnGet*/, NULL /*pfnSet*/ }
1982/** Macro for creating a read-write sub-field entry with getters. */
1983#define DBGFREGSUBFIELD_RW_SG(a_szName, a_cBits, a_cShift, a_pfnGet, a_pfnSet) \
1984 { a_szName, 0 /*iFirstBit*/, a_cBits, a_cShift, 0 /*fFlags*/, a_pfnGet, a_pfnSet }
1985/** Macro for creating a read-only sub-field entry without getters. */
1986#define DBGFREGSUBFIELD_RO(a_szName, a_iFirstBit, a_cBits, a_cShift) \
1987 { a_szName, a_iFirstBit, a_cBits, a_cShift, DBGFREGSUBFIELD_FLAGS_READ_ONLY, NULL /*pfnGet*/, NULL /*pfnSet*/ }
1988/** Macro for creating a terminator sub-field entry. */
1989#define DBGFREGSUBFIELD_TERMINATOR() \
1990 { NULL, 0, 0, 0, 0, NULL, NULL }
1991
1992/**
1993 * Register alias descriptor.
1994 */
1995typedef struct DBGFREGALIAS
1996{
1997 /** The alias name. NULL is used to terminate the array. */
1998 const char *pszName;
1999 /** Set to a valid type if the alias has a different type. */
2000 DBGFREGVALTYPE enmType;
2001} DBGFREGALIAS;
2002/** Pointer to a const register alias descriptor. */
2003typedef DBGFREGALIAS const *PCDBGFREGALIAS;
2004
2005/**
2006 * Register descriptor.
2007 */
2008typedef struct DBGFREGDESC
2009{
2010 /** The normal register name. */
2011 const char *pszName;
2012 /** The register identifier if this is a CPU register. */
2013 DBGFREG enmReg;
2014 /** The default register type. */
2015 DBGFREGVALTYPE enmType;
2016 /** Flags, see DBGFREG_FLAGS_XXX. */
2017 uint32_t fFlags;
2018 /** The internal register indicator.
2019 * For CPU registers this is the offset into the CPUMCTX structure,
2020 * thuse the 'off' prefix. */
2021 uint32_t offRegister;
2022 /** Getter.
2023 * @remarks Does not take the device lock or anything like that.
2024 */
2025 DECLCALLBACKMEMBER(int, pfnGet,(void *pvUser, struct DBGFREGDESC const *pDesc, PDBGFREGVAL pValue));
2026 /** Setter.
2027 * @remarks Does not take the device lock or anything like that.
2028 */
2029 DECLCALLBACKMEMBER(int, pfnSet,(void *pvUser, struct DBGFREGDESC const *pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask));
2030 /** Aliases (optional). */
2031 PCDBGFREGALIAS paAliases;
2032 /** Sub fields (optional). */
2033 PCDBGFREGSUBFIELD paSubFields;
2034} DBGFREGDESC;
2035
2036/** @name Macros for constructing DBGFREGDESC arrays.
2037 * @{ */
2038#define DBGFREGDESC_RW(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet) \
2039 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, NULL /*paAlises*/, NULL /*paSubFields*/ }
2040#define DBGFREGDESC_RO(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet) \
2041 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, NULL /*paAlises*/, NULL /*paSubFields*/ }
2042#define DBGFREGDESC_RW_A(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases) \
2043 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, NULL /*paSubFields*/ }
2044#define DBGFREGDESC_RO_A(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases) \
2045 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, NULL /*paSubFields*/ }
2046#define DBGFREGDESC_RW_S(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paSubFields) \
2047 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, /*paAliases*/, a_paSubFields }
2048#define DBGFREGDESC_RO_S(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paSubFields) \
2049 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, /*paAliases*/, a_paSubFields }
2050#define DBGFREGDESC_RW_AS(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
2051 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
2052#define DBGFREGDESC_RO_AS(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
2053 { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
2054#define DBGFREGDESC_TERMINATOR() \
2055 { NULL, DBGFREG_END, DBGFREGVALTYPE_INVALID, 0, 0, NULL, NULL, NULL, NULL }
2056/** @} */
2057
2058
2059/** @name DBGFREG_FLAGS_XXX
2060 * @{ */
2061/** The register is read-only. */
2062#define DBGFREG_FLAGS_READ_ONLY RT_BIT_32(0)
2063/** @} */
2064
2065/**
2066 * Entry in a batch query or set operation.
2067 */
2068typedef struct DBGFREGENTRY
2069{
2070 /** The register identifier. */
2071 DBGFREG enmReg;
2072 /** The size of the value in bytes. */
2073 DBGFREGVALTYPE enmType;
2074 /** The register value. The valid view is indicated by enmType. */
2075 DBGFREGVAL Val;
2076} DBGFREGENTRY;
2077/** Pointer to a register entry in a batch operation. */
2078typedef DBGFREGENTRY *PDBGFREGENTRY;
2079/** Pointer to a const register entry in a batch operation. */
2080typedef DBGFREGENTRY const *PCDBGFREGENTRY;
2081
2082/** Used with DBGFR3Reg* to indicate the hypervisor register set instead of the
2083 * guest. */
2084#define DBGFREG_HYPER_VMCPUID UINT32_C(0x01000000)
2085
2086VMMR3DECL(int) DBGFR3RegCpuQueryU8( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8);
2087VMMR3DECL(int) DBGFR3RegCpuQueryU16( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16);
2088VMMR3DECL(int) DBGFR3RegCpuQueryU32( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32);
2089VMMR3DECL(int) DBGFR3RegCpuQueryU64( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64);
2090VMMR3DECL(int) DBGFR3RegCpuQueryU128(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint128_t *pu128);
2091VMMR3DECL(int) DBGFR3RegCpuQueryLrd( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, long double *plrd);
2092VMMR3DECL(int) DBGFR3RegCpuQueryXdtr(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64Base, uint16_t *pu16Limit);
2093#if 0
2094VMMR3DECL(int) DBGFR3RegCpuQueryBatch(PUVM pUVM,VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs);
2095VMMR3DECL(int) DBGFR3RegCpuQueryAll( PUVM pUVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs);
2096
2097VMMR3DECL(int) DBGFR3RegCpuSetU8( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t u8);
2098VMMR3DECL(int) DBGFR3RegCpuSetU16( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t u16);
2099VMMR3DECL(int) DBGFR3RegCpuSetU32( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t u32);
2100VMMR3DECL(int) DBGFR3RegCpuSetU64( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t u64);
2101VMMR3DECL(int) DBGFR3RegCpuSetU128( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint128_t u128);
2102VMMR3DECL(int) DBGFR3RegCpuSetLrd( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, long double lrd);
2103VMMR3DECL(int) DBGFR3RegCpuSetBatch( PUVM pUVM, VMCPUID idCpu, PCDBGFREGENTRY paRegs, size_t cRegs);
2104#endif
2105
2106VMMR3DECL(const char *) DBGFR3RegCpuName(PUVM pUVM, DBGFREG enmReg, DBGFREGVALTYPE enmType);
2107
2108VMMR3_INT_DECL(int) DBGFR3RegRegisterCpu(PVM pVM, PVMCPU pVCpu, PCDBGFREGDESC paRegisters, bool fGuestRegs);
2109VMMR3_INT_DECL(int) DBGFR3RegRegisterDevice(PVM pVM, PCDBGFREGDESC paRegisters, PPDMDEVINS pDevIns,
2110 const char *pszPrefix, uint32_t iInstance);
2111
2112/**
2113 * Entry in a named batch query or set operation.
2114 */
2115typedef struct DBGFREGENTRYNM
2116{
2117 /** The register name. */
2118 const char *pszName;
2119 /** The size of the value in bytes. */
2120 DBGFREGVALTYPE enmType;
2121 /** The register value. The valid view is indicated by enmType. */
2122 DBGFREGVAL Val;
2123} DBGFREGENTRYNM;
2124/** Pointer to a named register entry in a batch operation. */
2125typedef DBGFREGENTRYNM *PDBGFREGENTRYNM;
2126/** Pointer to a const named register entry in a batch operation. */
2127typedef DBGFREGENTRYNM const *PCDBGFREGENTRYNM;
2128
2129VMMR3DECL(int) DBGFR3RegNmValidate( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg);
2130
2131VMMR3DECL(int) DBGFR3RegNmQuery( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType);
2132VMMR3DECL(int) DBGFR3RegNmQueryU8( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint8_t *pu8);
2133VMMR3DECL(int) DBGFR3RegNmQueryU16( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint16_t *pu16);
2134VMMR3DECL(int) DBGFR3RegNmQueryU32( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint32_t *pu32);
2135VMMR3DECL(int) DBGFR3RegNmQueryU64( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64);
2136VMMR3DECL(int) DBGFR3RegNmQueryU128(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PRTUINT128U pu128);
2137/*VMMR3DECL(int) DBGFR3RegNmQueryLrd( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, long double *plrd);*/
2138VMMR3DECL(int) DBGFR3RegNmQueryXdtr(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64Base, uint16_t *pu16Limit);
2139VMMR3DECL(int) DBGFR3RegNmQueryBatch(PUVM pUVM,VMCPUID idDefCpu, PDBGFREGENTRYNM paRegs, size_t cRegs);
2140VMMR3DECL(int) DBGFR3RegNmQueryAllCount(PUVM pUVM, size_t *pcRegs);
2141VMMR3DECL(int) DBGFR3RegNmQueryAll( PUVM pUVM, PDBGFREGENTRYNM paRegs, size_t cRegs);
2142
2143VMMR3DECL(int) DBGFR3RegNmSet( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType);
2144VMMR3DECL(int) DBGFR3RegNmSetU8( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint8_t u8);
2145VMMR3DECL(int) DBGFR3RegNmSetU16( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint16_t u16);
2146VMMR3DECL(int) DBGFR3RegNmSetU32( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint32_t u32);
2147VMMR3DECL(int) DBGFR3RegNmSetU64( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t u64);
2148VMMR3DECL(int) DBGFR3RegNmSetU128( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, RTUINT128U u128);
2149VMMR3DECL(int) DBGFR3RegNmSetLrd( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, long double lrd);
2150VMMR3DECL(int) DBGFR3RegNmSetBatch( PUVM pUVM, VMCPUID idDefCpu, PCDBGFREGENTRYNM paRegs, size_t cRegs);
2151
2152/** @todo add enumeration methods. */
2153
2154VMMR3DECL(int) DBGFR3RegPrintf( PUVM pUVM, VMCPUID idDefCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...);
2155VMMR3DECL(int) DBGFR3RegPrintfV(PUVM pUVM, VMCPUID idDefCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, va_list va);
2156
2157
2158#ifdef IN_RING3
2159
2160/**
2161 * Guest OS digger interface identifier.
2162 *
2163 * This is for use together with PDBGFR3QueryInterface and is used to
2164 * obtain access to optional interfaces.
2165 */
2166typedef enum DBGFOSINTERFACE
2167{
2168 /** The usual invalid entry. */
2169 DBGFOSINTERFACE_INVALID = 0,
2170 /** Process info. */
2171 DBGFOSINTERFACE_PROCESS,
2172 /** Thread info. */
2173 DBGFOSINTERFACE_THREAD,
2174 /** Kernel message log - DBGFOSIDMESG. */
2175 DBGFOSINTERFACE_DMESG,
2176 /** Windows NT specifics (for the communication with the KD debugger stub). */
2177 DBGFOSINTERFACE_WINNT,
2178 /** The end of the valid entries. */
2179 DBGFOSINTERFACE_END,
2180 /** The usual 32-bit type blowup. */
2181 DBGFOSINTERFACE_32BIT_HACK = 0x7fffffff
2182} DBGFOSINTERFACE;
2183/** Pointer to a Guest OS digger interface identifier. */
2184typedef DBGFOSINTERFACE *PDBGFOSINTERFACE;
2185/** Pointer to a const Guest OS digger interface identifier. */
2186typedef DBGFOSINTERFACE const *PCDBGFOSINTERFACE;
2187
2188
2189/**
2190 * Guest OS Digger Registration Record.
2191 *
2192 * This is used with the DBGFR3OSRegister() API.
2193 */
2194typedef struct DBGFOSREG
2195{
2196 /** Magic value (DBGFOSREG_MAGIC). */
2197 uint32_t u32Magic;
2198 /** Flags. Reserved. */
2199 uint32_t fFlags;
2200 /** The size of the instance data. */
2201 uint32_t cbData;
2202 /** Operative System name. */
2203 char szName[24];
2204
2205 /**
2206 * Constructs the instance.
2207 *
2208 * @returns VBox status code.
2209 * @param pUVM The user mode VM handle.
2210 * @param pvData Pointer to the instance data.
2211 */
2212 DECLCALLBACKMEMBER(int, pfnConstruct,(PUVM pUVM, void *pvData));
2213
2214 /**
2215 * Destroys the instance.
2216 *
2217 * @param pUVM The user mode VM handle.
2218 * @param pvData Pointer to the instance data.
2219 */
2220 DECLCALLBACKMEMBER(void, pfnDestruct,(PUVM pUVM, void *pvData));
2221
2222 /**
2223 * Probes the guest memory for OS finger prints.
2224 *
2225 * No setup or so is performed, it will be followed by a call to pfnInit
2226 * or pfnRefresh that should take care of that.
2227 *
2228 * @returns true if is an OS handled by this module, otherwise false.
2229 * @param pUVM The user mode VM handle.
2230 * @param pvData Pointer to the instance data.
2231 */
2232 DECLCALLBACKMEMBER(bool, pfnProbe,(PUVM pUVM, void *pvData));
2233
2234 /**
2235 * Initializes a fresly detected guest, loading symbols and such useful stuff.
2236 *
2237 * This is called after pfnProbe.
2238 *
2239 * @returns VBox status code.
2240 * @param pUVM The user mode VM handle.
2241 * @param pvData Pointer to the instance data.
2242 */
2243 DECLCALLBACKMEMBER(int, pfnInit,(PUVM pUVM, void *pvData));
2244
2245 /**
2246 * Refreshes symbols and stuff following a redetection of the same OS.
2247 *
2248 * This is called after pfnProbe.
2249 *
2250 * @returns VBox status code.
2251 * @param pUVM The user mode VM handle.
2252 * @param pvData Pointer to the instance data.
2253 */
2254 DECLCALLBACKMEMBER(int, pfnRefresh,(PUVM pUVM, void *pvData));
2255
2256 /**
2257 * Terminates an OS when a new (or none) OS has been detected,
2258 * and before destruction.
2259 *
2260 * This is called after pfnProbe and if needed before pfnDestruct.
2261 *
2262 * @param pUVM The user mode VM handle.
2263 * @param pvData Pointer to the instance data.
2264 */
2265 DECLCALLBACKMEMBER(void, pfnTerm,(PUVM pUVM, void *pvData));
2266
2267 /**
2268 * Queries the version of the running OS.
2269 *
2270 * This is only called after pfnInit().
2271 *
2272 * @returns VBox status code.
2273 * @param pUVM The user mode VM handle.
2274 * @param pvData Pointer to the instance data.
2275 * @param pszVersion Where to store the version string.
2276 * @param cchVersion The size of the version string buffer.
2277 */
2278 DECLCALLBACKMEMBER(int, pfnQueryVersion,(PUVM pUVM, void *pvData, char *pszVersion, size_t cchVersion));
2279
2280 /**
2281 * Queries the pointer to a interface.
2282 *
2283 * This is called after pfnProbe.
2284 *
2285 * The returned interface must be valid until pfnDestruct is called. Two calls
2286 * to this method with the same @a enmIf value must return the same pointer.
2287 *
2288 * @returns Pointer to the interface if available, NULL if not available.
2289 * @param pUVM The user mode VM handle.
2290 * @param pvData Pointer to the instance data.
2291 * @param enmIf The interface identifier.
2292 */
2293 DECLCALLBACKMEMBER(void *, pfnQueryInterface,(PUVM pUVM, void *pvData, DBGFOSINTERFACE enmIf));
2294
2295 /**
2296 * Stack unwind assist callback.
2297 *
2298 * This is only called after pfnInit().
2299 *
2300 * @returns VBox status code (allocation error or something of similar fatality).
2301 * @param pUVM The user mode VM handle.
2302 * @param pvData Pointer to the instance data.
2303 * @param idCpu The CPU that's unwinding it's stack.
2304 * @param pFrame The current frame. Okay to modify it a little.
2305 * @param pState The unwind state. Okay to modify it.
2306 * @param pInitialCtx The initial register context.
2307 * @param hAs The address space being used for the unwind.
2308 * @param puScratch Scratch area (initialized to zero, no dtor).
2309 */
2310 DECLCALLBACKMEMBER(int, pfnStackUnwindAssist,(PUVM pUVM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame,
2311 PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs,
2312 uint64_t *puScratch));
2313
2314 /** Trailing magic (DBGFOSREG_MAGIC). */
2315 uint32_t u32EndMagic;
2316} DBGFOSREG;
2317/** Pointer to a Guest OS digger registration record. */
2318typedef DBGFOSREG *PDBGFOSREG;
2319/** Pointer to a const Guest OS digger registration record. */
2320typedef DBGFOSREG const *PCDBGFOSREG;
2321
2322/** Magic value for DBGFOSREG::u32Magic and DBGFOSREG::u32EndMagic. (Hitomi Kanehara) */
2323#define DBGFOSREG_MAGIC 0x19830808
2324
2325
2326/**
2327 * Interface for querying kernel log messages (DBGFOSINTERFACE_DMESG).
2328 */
2329typedef struct DBGFOSIDMESG
2330{
2331 /** Trailing magic (DBGFOSIDMESG_MAGIC). */
2332 uint32_t u32Magic;
2333
2334 /**
2335 * Query the kernel log.
2336 *
2337 * @returns VBox status code.
2338 * @retval VERR_NOT_FOUND if the messages could not be located.
2339 * @retval VERR_INVALID_STATE if the messages was found to have unknown/invalid
2340 * format.
2341 * @retval VERR_BUFFER_OVERFLOW if the buffer isn't large enough, pcbActual
2342 * will be set to the required buffer size. The buffer, however, will
2343 * be filled with as much data as it can hold (properly zero terminated
2344 * of course).
2345 *
2346 * @param pThis Pointer to the interface structure.
2347 * @param pUVM The user mode VM handle.
2348 * @param fFlags Flags reserved for future use, MBZ.
2349 * @param cMessages The number of messages to retrieve, counting from the
2350 * end of the log (i.e. like tail), use UINT32_MAX for all.
2351 * @param pszBuf The output buffer.
2352 * @param cbBuf The buffer size.
2353 * @param pcbActual Where to store the number of bytes actually returned,
2354 * including zero terminator. On VERR_BUFFER_OVERFLOW this
2355 * holds the necessary buffer size. Optional.
2356 */
2357 DECLCALLBACKMEMBER(int, pfnQueryKernelLog,(struct DBGFOSIDMESG *pThis, PUVM pUVM, uint32_t fFlags, uint32_t cMessages,
2358 char *pszBuf, size_t cbBuf, size_t *pcbActual));
2359 /** Trailing magic (DBGFOSIDMESG_MAGIC). */
2360 uint32_t u32EndMagic;
2361} DBGFOSIDMESG;
2362/** Pointer to the interface for query kernel log messages (DBGFOSINTERFACE_DMESG). */
2363typedef DBGFOSIDMESG *PDBGFOSIDMESG;
2364/** Magic value for DBGFOSIDMESG::32Magic and DBGFOSIDMESG::u32EndMagic. (Kenazburo Oe) */
2365#define DBGFOSIDMESG_MAGIC UINT32_C(0x19350131)
2366
2367
2368/**
2369 * Interface for querying Windows NT guest specifics (DBGFOSINTERFACE_WINNT).
2370 */
2371typedef struct DBGFOSIWINNT
2372{
2373 /** Trailing magic (DBGFOSIWINNT_MAGIC). */
2374 uint32_t u32Magic;
2375
2376 /**
2377 * Queries version information.
2378 *
2379 * @returns VBox status code.
2380 * @param pThis Pointer to the interface structure.
2381 * @param pUVM The user mode VM handle.
2382 * @param puVersMajor Where to store the major version part, optional.
2383 * @param puVersMinor Where to store the minor version part, optional.
2384 * @param puBuildNumber Where to store the build number, optional.
2385 * @param pf32Bit Where to store the flag whether this is a 32bit Windows NT, optional.
2386 */
2387 DECLCALLBACKMEMBER(int, pfnQueryVersion,(struct DBGFOSIWINNT *pThis, PUVM pUVM,
2388 uint32_t *puVersMajor, uint32_t *puVersMinor,
2389 uint32_t *puBuildNumber, bool *pf32Bit));
2390
2391 /**
2392 * Queries some base kernel pointers.
2393 *
2394 * @returns VBox status code.
2395 * @param pThis Pointer to the interface structure.
2396 * @param pUVM The user mode VM handle.
2397 * @param pGCPtrKernBase Where to store the kernel base on success.
2398 * @param pGCPtrPsLoadedModuleList Where to store the pointer to the laoded module list head on success.
2399 */
2400 DECLCALLBACKMEMBER(int, pfnQueryKernelPtrs,(struct DBGFOSIWINNT *pThis, PUVM pUVM,
2401 PRTGCUINTPTR pGCPtrKernBase, PRTGCUINTPTR pGCPtrPsLoadedModuleList));
2402
2403 /**
2404 * Queries KPCR and KPCRB pointers for the given vCPU.
2405 *
2406 * @returns VBox status code.
2407 * @param pThis Pointer to the interface structure.
2408 * @param pUVM The user mode VM handle.
2409 * @param idCpu The vCPU to query the KPCR/KPCRB for.
2410 * @param pKpcr Where to store the KPCR pointer on success, optional.
2411 * @param pKpcrb Where to store the KPCR pointer on success, optional.
2412 */
2413 DECLCALLBACKMEMBER(int, pfnQueryKpcrForVCpu,(struct DBGFOSIWINNT *pThis, PUVM pUVM, VMCPUID idCpu,
2414 PRTGCUINTPTR pKpcr, PRTGCUINTPTR pKpcrb));
2415
2416 /**
2417 * Queries the current thread for the given vCPU.
2418 *
2419 * @returns VBox status code.
2420 * @param pThis Pointer to the interface structure.
2421 * @param pUVM The user mode VM handle.
2422 * @param idCpu The vCPU to query the KPCR/KPCRB for.
2423 * @param pCurThrd Where to store the CurrentThread pointer on success.
2424 */
2425 DECLCALLBACKMEMBER(int, pfnQueryCurThrdForVCpu,(struct DBGFOSIWINNT *pThis, PUVM pUVM, VMCPUID idCpu,
2426 PRTGCUINTPTR pCurThrd));
2427
2428 /** Trailing magic (DBGFOSIWINNT_MAGIC). */
2429 uint32_t u32EndMagic;
2430} DBGFOSIWINNT;
2431/** Pointer to the interface for query kernel log messages (DBGFOSINTERFACE_WINNT). */
2432typedef DBGFOSIWINNT *PDBGFOSIWINNT;
2433/** Magic value for DBGFOSIWINNT::32Magic and DBGFOSIWINNT::u32EndMagic. (Dave Cutler) */
2434#define DBGFOSIWINNT_MAGIC UINT32_C(0x19420313)
2435
2436
2437VMMR3DECL(int) DBGFR3OSRegister(PUVM pUVM, PCDBGFOSREG pReg);
2438VMMR3DECL(int) DBGFR3OSDeregister(PUVM pUVM, PCDBGFOSREG pReg);
2439VMMR3DECL(int) DBGFR3OSDetect(PUVM pUVM, char *pszName, size_t cchName);
2440VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion);
2441VMMR3DECL(void *) DBGFR3OSQueryInterface(PUVM pUVM, DBGFOSINTERFACE enmIf);
2442
2443
2444VMMR3DECL(int) DBGFR3CoreWrite(PUVM pUVM, const char *pszFilename, bool fReplaceFile);
2445
2446
2447
2448/** @defgroup grp_dbgf_plug_in The DBGF Plug-in Interface
2449 * @{
2450 */
2451
2452/** The plug-in module name prefix. */
2453# define DBGF_PLUG_IN_PREFIX "DbgPlugIn"
2454
2455/** The name of the plug-in entry point (FNDBGFPLUGIN) */
2456# define DBGF_PLUG_IN_ENTRYPOINT "DbgPlugInEntry"
2457
2458/**
2459 * DBGF plug-in operations.
2460 */
2461typedef enum DBGFPLUGINOP
2462{
2463 /** The usual invalid first value. */
2464 DBGFPLUGINOP_INVALID,
2465 /** Initialize the plug-in for a VM, register all the stuff.
2466 * The plug-in will be unloaded on failure.
2467 * uArg: The full VirtualBox version, see VBox/version.h. */
2468 DBGFPLUGINOP_INIT,
2469 /** Terminate the plug-ing for a VM, deregister all the stuff.
2470 * The plug-in will be unloaded after this call regardless of the return
2471 * code. */
2472 DBGFPLUGINOP_TERM,
2473 /** The usual 32-bit hack. */
2474 DBGFPLUGINOP_32BIT_HACK = 0x7fffffff
2475} DBGFPLUGINOP;
2476
2477/**
2478 * DBGF plug-in main entry point.
2479 *
2480 * @returns VBox status code.
2481 *
2482 * @param enmOperation The operation.
2483 * @param pUVM The user mode VM handle. This may be NULL.
2484 * @param uArg Extra argument.
2485 */
2486typedef DECLCALLBACKTYPE(int, FNDBGFPLUGIN,(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg));
2487/** Pointer to a FNDBGFPLUGIN. */
2488typedef FNDBGFPLUGIN *PFNDBGFPLUGIN;
2489
2490/** @copydoc FNDBGFPLUGIN */
2491DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg);
2492
2493VMMR3DECL(int) DBGFR3PlugInLoad(PUVM pUVM, const char *pszPlugIn, char *pszActual, size_t cbActual, PRTERRINFO pErrInfo);
2494VMMR3DECL(int) DBGFR3PlugInUnload(PUVM pUVM, const char *pszName);
2495VMMR3DECL(void) DBGFR3PlugInLoadAll(PUVM pUVM);
2496VMMR3DECL(void) DBGFR3PlugInUnloadAll(PUVM pUVM);
2497
2498/** @} */
2499
2500
2501/** @defgroup grp_dbgf_types The DBGF type system Interface.
2502 * @{
2503 */
2504
2505/** A few forward declarations. */
2506/** Pointer to a type registration structure. */
2507typedef struct DBGFTYPEREG *PDBGFTYPEREG;
2508/** Pointer to a const type registration structure. */
2509typedef const struct DBGFTYPEREG *PCDBGFTYPEREG;
2510/** Pointer to a typed buffer. */
2511typedef struct DBGFTYPEVAL *PDBGFTYPEVAL;
2512
2513/**
2514 * DBGF built-in types.
2515 */
2516typedef enum DBGFTYPEBUILTIN
2517{
2518 /** The usual invalid first value. */
2519 DBGFTYPEBUILTIN_INVALID,
2520 /** Unsigned 8bit integer. */
2521 DBGFTYPEBUILTIN_UINT8,
2522 /** Signed 8bit integer. */
2523 DBGFTYPEBUILTIN_INT8,
2524 /** Unsigned 16bit integer. */
2525 DBGFTYPEBUILTIN_UINT16,
2526 /** Signed 16bit integer. */
2527 DBGFTYPEBUILTIN_INT16,
2528 /** Unsigned 32bit integer. */
2529 DBGFTYPEBUILTIN_UINT32,
2530 /** Signed 32bit integer. */
2531 DBGFTYPEBUILTIN_INT32,
2532 /** Unsigned 64bit integer. */
2533 DBGFTYPEBUILTIN_UINT64,
2534 /** Signed 64bit integer. */
2535 DBGFTYPEBUILTIN_INT64,
2536 /** 32bit Guest pointer */
2537 DBGFTYPEBUILTIN_PTR32,
2538 /** 64bit Guest pointer */
2539 DBGFTYPEBUILTIN_PTR64,
2540 /** Guest pointer - size depends on the guest bitness */
2541 DBGFTYPEBUILTIN_PTR,
2542 /** Type indicating a size, like size_t this can have different sizes
2543 * on 32bit and 64bit systems */
2544 DBGFTYPEBUILTIN_SIZE,
2545 /** 32bit float. */
2546 DBGFTYPEBUILTIN_FLOAT32,
2547 /** 64bit float (also known as double). */
2548 DBGFTYPEBUILTIN_FLOAT64,
2549 /** Compund types like structs and unions. */
2550 DBGFTYPEBUILTIN_COMPOUND,
2551 /** The usual 32-bit hack. */
2552 DBGFTYPEBUILTIN_32BIT_HACK = 0x7fffffff
2553} DBGFTYPEBUILTIN;
2554/** Pointer to a built-in type. */
2555typedef DBGFTYPEBUILTIN *PDBGFTYPEBUILTIN;
2556/** Pointer to a const built-in type. */
2557typedef const DBGFTYPEBUILTIN *PCDBGFTYPEBUILTIN;
2558
2559/**
2560 * DBGF type value buffer.
2561 */
2562typedef union DBGFTYPEVALBUF
2563{
2564 uint8_t u8;
2565 int8_t i8;
2566 uint16_t u16;
2567 int16_t i16;
2568 uint32_t u32;
2569 int32_t i32;
2570 uint64_t u64;
2571 int64_t i64;
2572 float f32;
2573 double f64;
2574 uint64_t size; /* For the built-in size_t which can be either 32-bit or 64-bit. */
2575 RTGCPTR GCPtr;
2576 /** For embedded structs. */
2577 PDBGFTYPEVAL pVal;
2578} DBGFTYPEVALBUF;
2579/** Pointer to a value. */
2580typedef DBGFTYPEVALBUF *PDBGFTYPEVALBUF;
2581
2582/**
2583 * DBGF type value entry.
2584 */
2585typedef struct DBGFTYPEVALENTRY
2586{
2587 /** DBGF built-in type. */
2588 DBGFTYPEBUILTIN enmType;
2589 /** Size of the type. */
2590 size_t cbType;
2591 /** Number of entries, for arrays this can be > 1. */
2592 uint32_t cEntries;
2593 /** Value buffer, depends on whether this is an array. */
2594 union
2595 {
2596 /** Single value. */
2597 DBGFTYPEVALBUF Val;
2598 /** Pointer to the array of values. */
2599 PDBGFTYPEVALBUF pVal;
2600 } Buf;
2601} DBGFTYPEVALENTRY;
2602/** Pointer to a type value entry. */
2603typedef DBGFTYPEVALENTRY *PDBGFTYPEVALENTRY;
2604/** Pointer to a const type value entry. */
2605typedef const DBGFTYPEVALENTRY *PCDBGFTYPEVALENTRY;
2606
2607/**
2608 * DBGF typed value.
2609 */
2610typedef struct DBGFTYPEVAL
2611{
2612 /** Pointer to the registration structure for this type. */
2613 PCDBGFTYPEREG pTypeReg;
2614 /** Number of value entries. */
2615 uint32_t cEntries;
2616 /** Variable sized array of value entries. */
2617 DBGFTYPEVALENTRY aEntries[1];
2618} DBGFTYPEVAL;
2619
2620/**
2621 * DBGF type variant.
2622 */
2623typedef enum DBGFTYPEVARIANT
2624{
2625 /** The usual invalid first value. */
2626 DBGFTYPEVARIANT_INVALID,
2627 /** A struct. */
2628 DBGFTYPEVARIANT_STRUCT,
2629 /** Union. */
2630 DBGFTYPEVARIANT_UNION,
2631 /** Alias for an existing type. */
2632 DBGFTYPEVARIANT_ALIAS,
2633 /** The usual 32-bit hack. */
2634 DBGFTYPEVARIANT_32BIT_HACK = 0x7fffffff
2635} DBGFTYPEVARIANT;
2636
2637/** @name DBGFTYPEREGMEMBER Flags.
2638 * @{ */
2639/** The member is an array with a fixed size. */
2640# define DBGFTYPEREGMEMBER_F_ARRAY RT_BIT_32(0)
2641/** The member denotes a pointer. */
2642# define DBGFTYPEREGMEMBER_F_POINTER RT_BIT_32(1)
2643/** @} */
2644
2645/**
2646 * DBGF type member.
2647 */
2648typedef struct DBGFTYPEREGMEMBER
2649{
2650 /** Name of the member. */
2651 const char *pszName;
2652 /** Flags for this member, see DBGFTYPEREGMEMBER_F_XXX. */
2653 uint32_t fFlags;
2654 /** Type identifier. */
2655 const char *pszType;
2656 /** The number of elements in the array, only valid for arrays. */
2657 uint32_t cElements;
2658} DBGFTYPEREGMEMBER;
2659/** Pointer to a member. */
2660typedef DBGFTYPEREGMEMBER *PDBGFTYPEREGMEMBER;
2661/** Pointer to a const member. */
2662typedef const DBGFTYPEREGMEMBER *PCDBGFTYPEREGMEMBER;
2663
2664/** @name DBGFTYPEREG Flags.
2665 * @{ */
2666/** The type is a packed structure. */
2667# define DBGFTYPEREG_F_PACKED RT_BIT_32(0)
2668/** @} */
2669
2670/**
2671 * New type registration structure.
2672 */
2673typedef struct DBGFTYPEREG
2674{
2675 /** Name of the type. */
2676 const char *pszType;
2677 /** The type variant. */
2678 DBGFTYPEVARIANT enmVariant;
2679 /** Some registration flags, see DBGFTYPEREG_F_XXX. */
2680 uint32_t fFlags;
2681 /** Number of members this type has, only valid for structs or unions. */
2682 uint32_t cMembers;
2683 /** Pointer to the member fields, only valid for structs or unions. */
2684 PCDBGFTYPEREGMEMBER paMembers;
2685 /** Name of the aliased type for aliases. */
2686 const char *pszAliasedType;
2687} DBGFTYPEREG;
2688
2689/**
2690 * DBGF typed value dumper callback.
2691 *
2692 * @returns VBox status code. Any non VINF_SUCCESS status code will abort the dumping.
2693 *
2694 * @param off The byte offset of the entry from the start of the type.
2695 * @param pszField The name of the field for the value.
2696 * @param iLvl The current level.
2697 * @param enmType The type enum.
2698 * @param cbType Size of the type.
2699 * @param pValBuf Pointer to the value buffer.
2700 * @param cValBufs Number of value buffers (for arrays).
2701 * @param pvUser Opaque user data.
2702 */
2703typedef DECLCALLBACKTYPE(int, FNDBGFR3TYPEVALDUMP,(uint32_t off, const char *pszField, uint32_t iLvl,
2704 DBGFTYPEBUILTIN enmType, size_t cbType,
2705 PDBGFTYPEVALBUF pValBuf, uint32_t cValBufs, void *pvUser));
2706/** Pointer to a FNDBGFR3TYPEVALDUMP. */
2707typedef FNDBGFR3TYPEVALDUMP *PFNDBGFR3TYPEVALDUMP;
2708
2709/**
2710 * DBGF type information dumper callback.
2711 *
2712 * @returns VBox status code. Any non VINF_SUCCESS status code will abort the dumping.
2713 *
2714 * @param off The byte offset of the entry from the start of the type.
2715 * @param pszField The name of the field for the value.
2716 * @param iLvl The current level.
2717 * @param pszType The type of the field.
2718 * @param fTypeFlags Flags for this type, see DBGFTYPEREGMEMBER_F_XXX.
2719 * @param cElements Number of for the field ( > 0 for arrays).
2720 * @param pvUser Opaque user data.
2721 */
2722typedef DECLCALLBACKTYPE(int, FNDBGFR3TYPEDUMP,(uint32_t off, const char *pszField, uint32_t iLvl,
2723 const char *pszType, uint32_t fTypeFlags,
2724 uint32_t cElements, void *pvUser));
2725/** Pointer to a FNDBGFR3TYPEDUMP. */
2726typedef FNDBGFR3TYPEDUMP *PFNDBGFR3TYPEDUMP;
2727
2728VMMR3DECL(int) DBGFR3TypeRegister( PUVM pUVM, uint32_t cTypes, PCDBGFTYPEREG paTypes);
2729VMMR3DECL(int) DBGFR3TypeDeregister(PUVM pUVM, const char *pszType);
2730VMMR3DECL(int) DBGFR3TypeQueryReg( PUVM pUVM, const char *pszType, PCDBGFTYPEREG *ppTypeReg);
2731
2732VMMR3DECL(int) DBGFR3TypeQuerySize( PUVM pUVM, const char *pszType, size_t *pcbType);
2733VMMR3DECL(int) DBGFR3TypeSetSize( PUVM pUVM, const char *pszType, size_t cbType);
2734VMMR3DECL(int) DBGFR3TypeDumpEx( PUVM pUVM, const char *pszType, uint32_t fFlags,
2735 uint32_t cLvlMax, PFNDBGFR3TYPEDUMP pfnDump, void *pvUser);
2736VMMR3DECL(int) DBGFR3TypeQueryValByType(PUVM pUVM, PCDBGFADDRESS pAddress, const char *pszType,
2737 PDBGFTYPEVAL *ppVal);
2738VMMR3DECL(void) DBGFR3TypeValFree(PDBGFTYPEVAL pVal);
2739VMMR3DECL(int) DBGFR3TypeValDumpEx(PUVM pUVM, PCDBGFADDRESS pAddress, const char *pszType, uint32_t fFlags,
2740 uint32_t cLvlMax, FNDBGFR3TYPEVALDUMP pfnDump, void *pvUser);
2741
2742/** @} */
2743
2744
2745/** @defgroup grp_dbgf_flow The DBGF control flow graph Interface.
2746 * @{
2747 */
2748
2749/** A DBGF control flow graph handle. */
2750typedef struct DBGFFLOWINT *DBGFFLOW;
2751/** Pointer to a DBGF control flow graph handle. */
2752typedef DBGFFLOW *PDBGFFLOW;
2753/** A DBGF control flow graph basic block handle. */
2754typedef struct DBGFFLOWBBINT *DBGFFLOWBB;
2755/** Pointer to a DBGF control flow graph basic block handle. */
2756typedef DBGFFLOWBB *PDBGFFLOWBB;
2757/** A DBGF control flow graph branch table handle. */
2758typedef struct DBGFFLOWBRANCHTBLINT *DBGFFLOWBRANCHTBL;
2759/** Pointer to a DBGF flow control graph branch table handle. */
2760typedef DBGFFLOWBRANCHTBL *PDBGFFLOWBRANCHTBL;
2761/** A DBGF control flow graph iterator. */
2762typedef struct DBGFFLOWITINT *DBGFFLOWIT;
2763/** Pointer to a control flow graph iterator. */
2764typedef DBGFFLOWIT *PDBGFFLOWIT;
2765/** A DBGF control flow graph branch table iterator. */
2766typedef struct DBGFFLOWBRANCHTBLITINT *DBGFFLOWBRANCHTBLIT;
2767/** Pointer to a control flow graph branch table iterator. */
2768typedef DBGFFLOWBRANCHTBLIT *PDBGFFLOWBRANCHTBLIT;
2769
2770/** @name DBGFFLOWBB Flags.
2771 * @{ */
2772/** The basic block is the entry into the owning control flow graph. */
2773#define DBGF_FLOW_BB_F_ENTRY RT_BIT_32(0)
2774/** The basic block was not populated because the limit was reached. */
2775#define DBGF_FLOW_BB_F_EMPTY RT_BIT_32(1)
2776/** The basic block is not complete because an error happened during disassembly. */
2777#define DBGF_FLOW_BB_F_INCOMPLETE_ERR RT_BIT_32(2)
2778/** The basic block is reached through a branch table. */
2779#define DBGF_FLOW_BB_F_BRANCH_TABLE RT_BIT_32(3)
2780/** @} */
2781
2782/** @name Flags controlling the creating of a control flow graph.
2783 * @{ */
2784/** Default options. */
2785#define DBGF_FLOW_CREATE_F_DEFAULT 0
2786/** Tries to resolve indirect branches, useful for code using
2787 * jump tables generated for large switch statements by some compilers. */
2788#define DBGF_FLOW_CREATE_F_TRY_RESOLVE_INDIRECT_BRANCHES RT_BIT_32(0)
2789/** @} */
2790
2791/**
2792 * DBGF control graph basic block end type.
2793 */
2794typedef enum DBGFFLOWBBENDTYPE
2795{
2796 /** Invalid type. */
2797 DBGFFLOWBBENDTYPE_INVALID = 0,
2798 /** Basic block is the exit block and has no successor. */
2799 DBGFFLOWBBENDTYPE_EXIT,
2800 /** Basic block is the last disassembled block because the
2801 * maximum amount to disassemble was reached but is not an
2802 * exit block - no successors.
2803 */
2804 DBGFFLOWBBENDTYPE_LAST_DISASSEMBLED,
2805 /** Unconditional control flow change because the successor is referenced by multiple
2806 * basic blocks. - 1 successor. */
2807 DBGFFLOWBBENDTYPE_UNCOND,
2808 /** Unconditional control flow change because of an direct branch - 1 successor. */
2809 DBGFFLOWBBENDTYPE_UNCOND_JMP,
2810 /** Unconditional control flow change because of an indirect branch - n successors. */
2811 DBGFFLOWBBENDTYPE_UNCOND_INDIRECT_JMP,
2812 /** Conditional control flow change - 2 successors. */
2813 DBGFFLOWBBENDTYPE_COND,
2814 /** 32bit hack. */
2815 DBGFFLOWBBENDTYPE_32BIT_HACK = 0x7fffffff
2816} DBGFFLOWBBENDTYPE;
2817
2818/**
2819 * DBGF control flow graph iteration order.
2820 */
2821typedef enum DBGFFLOWITORDER
2822{
2823 /** Invalid order. */
2824 DBGFFLOWITORDER_INVALID = 0,
2825 /** From lowest to highest basic block start address. */
2826 DBGFFLOWITORDER_BY_ADDR_LOWEST_FIRST,
2827 /** From highest to lowest basic block start address. */
2828 DBGFFLOWITORDER_BY_ADDR_HIGHEST_FIRST,
2829 /** Depth first traversing starting from the entry block. */
2830 DBGFFLOWITORDER_DEPTH_FRIST,
2831 /** Breadth first traversing starting from the entry block. */
2832 DBGFFLOWITORDER_BREADTH_FIRST,
2833 /** Usual 32bit hack. */
2834 DBGFFLOWITORDER_32BIT_HACK = 0x7fffffff
2835} DBGFFLOWITORDER;
2836/** Pointer to a iteration order enum. */
2837typedef DBGFFLOWITORDER *PDBGFFLOWITORDER;
2838
2839
2840VMMR3DECL(int) DBGFR3FlowCreate(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddressStart, uint32_t cbDisasmMax,
2841 uint32_t fFlagsFlow, uint32_t fFlagsDisasm, PDBGFFLOW phFlow);
2842VMMR3DECL(uint32_t) DBGFR3FlowRetain(DBGFFLOW hFlow);
2843VMMR3DECL(uint32_t) DBGFR3FlowRelease(DBGFFLOW hFlow);
2844VMMR3DECL(int) DBGFR3FlowQueryStartBb(DBGFFLOW hFlow, PDBGFFLOWBB phFlowBb);
2845VMMR3DECL(int) DBGFR3FlowQueryBbByAddress(DBGFFLOW hFlow, PDBGFADDRESS pAddr, PDBGFFLOWBB phFlowBb);
2846VMMR3DECL(int) DBGFR3FlowQueryBranchTblByAddress(DBGFFLOW hFlow, PDBGFADDRESS pAddr, PDBGFFLOWBRANCHTBL phFlowBranchTbl);
2847VMMR3DECL(uint32_t) DBGFR3FlowGetBbCount(DBGFFLOW hFlow);
2848VMMR3DECL(uint32_t) DBGFR3FlowGetBranchTblCount(DBGFFLOW hFlow);
2849
2850VMMR3DECL(uint32_t) DBGFR3FlowBbRetain(DBGFFLOWBB hFlowBb);
2851VMMR3DECL(uint32_t) DBGFR3FlowBbRelease(DBGFFLOWBB hFlowBb);
2852VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetStartAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrStart);
2853VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetEndAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrEnd);
2854VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetBranchAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrTarget);
2855VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetFollowingAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrFollow);
2856VMMR3DECL(DBGFFLOWBBENDTYPE) DBGFR3FlowBbGetType(DBGFFLOWBB hFlowBb);
2857VMMR3DECL(uint32_t) DBGFR3FlowBbGetInstrCount(DBGFFLOWBB hFlowBb);
2858VMMR3DECL(uint32_t) DBGFR3FlowBbGetFlags(DBGFFLOWBB hFlowBb);
2859VMMR3DECL(int) DBGFR3FlowBbQueryBranchTbl(DBGFFLOWBB hFlowBb, PDBGFFLOWBRANCHTBL phBranchTbl);
2860VMMR3DECL(int) DBGFR3FlowBbQueryError(DBGFFLOWBB hFlowBb, const char **ppszErr);
2861VMMR3DECL(int) DBGFR3FlowBbQueryInstr(DBGFFLOWBB hFlowBb, uint32_t idxInstr, PDBGFADDRESS pAddrInstr,
2862 uint32_t *pcbInstr, const char **ppszInstr);
2863VMMR3DECL(int) DBGFR3FlowBbQuerySuccessors(DBGFFLOWBB hFlowBb, PDBGFFLOWBB phFlowBbFollow,
2864 PDBGFFLOWBB phFlowBbTarget);
2865VMMR3DECL(uint32_t) DBGFR3FlowBbGetRefBbCount(DBGFFLOWBB hFlowBb);
2866VMMR3DECL(int) DBGFR3FlowBbGetRefBb(DBGFFLOWBB hFlowBb, PDBGFFLOWBB pahFlowBbRef, uint32_t cRef);
2867
2868VMMR3DECL(uint32_t) DBGFR3FlowBranchTblRetain(DBGFFLOWBRANCHTBL hFlowBranchTbl);
2869VMMR3DECL(uint32_t) DBGFR3FlowBranchTblRelease(DBGFFLOWBRANCHTBL hFlowBranchTbl);
2870VMMR3DECL(uint32_t) DBGFR3FlowBranchTblGetSlots(DBGFFLOWBRANCHTBL hFlowBranchTbl);
2871VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBranchTblGetStartAddress(DBGFFLOWBRANCHTBL hFlowBranchTbl, PDBGFADDRESS pAddrStart);
2872VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBranchTblGetAddrAtSlot(DBGFFLOWBRANCHTBL hFlowBranchTbl, uint32_t idxSlot, PDBGFADDRESS pAddrSlot);
2873VMMR3DECL(int) DBGFR3FlowBranchTblQueryAddresses(DBGFFLOWBRANCHTBL hFlowBranchTbl, PDBGFADDRESS paAddrs, uint32_t cAddrs);
2874
2875VMMR3DECL(int) DBGFR3FlowItCreate(DBGFFLOW hFlow, DBGFFLOWITORDER enmOrder, PDBGFFLOWIT phFlowIt);
2876VMMR3DECL(void) DBGFR3FlowItDestroy(DBGFFLOWIT hFlowIt);
2877VMMR3DECL(DBGFFLOWBB) DBGFR3FlowItNext(DBGFFLOWIT hFlowIt);
2878VMMR3DECL(int) DBGFR3FlowItReset(DBGFFLOWIT hFlowIt);
2879
2880VMMR3DECL(int) DBGFR3FlowBranchTblItCreate(DBGFFLOW hFlow, DBGFFLOWITORDER enmOrder, PDBGFFLOWBRANCHTBLIT phFlowBranchTblIt);
2881VMMR3DECL(void) DBGFR3FlowBranchTblItDestroy(DBGFFLOWBRANCHTBLIT hFlowBranchTblIt);
2882VMMR3DECL(DBGFFLOWBRANCHTBL) DBGFR3FlowBranchTblItNext(DBGFFLOWBRANCHTBLIT hFlowBranchTblIt);
2883VMMR3DECL(int) DBGFR3FlowBranchTblItReset(DBGFFLOWBRANCHTBLIT hFlowBranchTblIt);
2884
2885/** @} */
2886
2887
2888/** @defgroup grp_dbgf_misc Misc DBGF interfaces.
2889 * @{ */
2890VMMR3DECL(VBOXSTRICTRC) DBGFR3ReportBugCheck(PVM pVM, PVMCPU pVCpu, DBGFEVENTTYPE enmEvent, uint64_t uBugCheck,
2891 uint64_t uP1, uint64_t uP2, uint64_t uP3, uint64_t uP4);
2892VMMR3DECL(int) DBGFR3FormatBugCheck(PUVM pUVM, char *pszDetails, size_t cbDetails,
2893 uint64_t uP0, uint64_t uP1, uint64_t uP2, uint64_t uP3, uint64_t uP4);
2894/** @} */
2895#endif /* IN_RING3 */
2896
2897
2898/** @defgroup grp_dbgf_tracer DBGF event tracing.
2899 * @{ */
2900#ifdef IN_RING3
2901VMMR3_INT_DECL(int) DBGFR3TracerRegisterEvtSrc(PVM pVM, const char *pszName, PDBGFTRACEREVTSRC phEvtSrc);
2902VMMR3_INT_DECL(int) DBGFR3TracerDeregisterEvtSrc(PVM pVM, DBGFTRACEREVTSRC hEvtSrc);
2903VMMR3_INT_DECL(int) DBGFR3TracerEvtIoPortCreate(PVM pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTIOPORT cPorts, uint32_t fFlags,
2904 uint32_t iPciRegion);
2905VMMR3_INT_DECL(int) DBGFR3TracerEvtMmioCreate(PVM pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS cbRegion, uint32_t fFlags,
2906 uint32_t iPciRegion);
2907#endif
2908
2909VMM_INT_DECL(int) DBGFTracerEvtMmioMap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS GCPhysMmio);
2910VMM_INT_DECL(int) DBGFTracerEvtMmioUnmap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion);
2911VMM_INT_DECL(int) DBGFTracerEvtMmioRead(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS offMmio, const void *pvVal, size_t cbVal);
2912VMM_INT_DECL(int) DBGFTracerEvtMmioWrite(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS offMmio, const void *pvVal, size_t cbVal);
2913VMM_INT_DECL(int) DBGFTracerEvtMmioFill(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS offMmio, uint32_t u32Item, uint32_t cbItem, uint32_t cItems);
2914VMM_INT_DECL(int) DBGFTracerEvtIoPortMap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT IoPortBase);
2915VMM_INT_DECL(int) DBGFTracerEvtIoPortUnmap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts);
2916VMM_INT_DECL(int) DBGFTracerEvtIoPortRead(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pvVal, size_t cbVal);
2917VMM_INT_DECL(int) DBGFTracerEvtIoPortReadStr(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pv, size_t cb,
2918 uint32_t cTransfersReq, uint32_t cTransfersRet);
2919VMM_INT_DECL(int) DBGFTracerEvtIoPortWrite(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pvVal, size_t cbVal);
2920VMM_INT_DECL(int) DBGFTracerEvtIoPortWriteStr(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pv, size_t cb,
2921 uint32_t cTransfersReq, uint32_t cTransfersRet);
2922VMM_INT_DECL(int) DBGFTracerEvtIrq(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, int32_t iIrq, int32_t fIrqLvl);
2923VMM_INT_DECL(int) DBGFTracerEvtIoApicMsi(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, RTGCPHYS GCPhys, uint32_t u32Val);
2924VMM_INT_DECL(int) DBGFTracerEvtGCPhysRead(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, RTGCPHYS GCPhys, const void *pvBuf, size_t cbRead);
2925VMM_INT_DECL(int) DBGFTracerEvtGCPhysWrite(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite);
2926/** @} */
2927
2928/** @} */
2929
2930RT_C_DECLS_END
2931
2932#endif /* !VBOX_INCLUDED_vmm_dbgf_h */
2933
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette