1 | /** @file
|
---|
2 | * DBGF - Debugger Facility, VM Core File Format.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2010-2022 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_vmm_dbgfcorefmt_h
|
---|
37 | #define VBOX_INCLUDED_vmm_dbgfcorefmt_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 | #include <VBox/vmm/cpumctx.h>
|
---|
44 | #include <iprt/assertcompile.h>
|
---|
45 |
|
---|
46 |
|
---|
47 | RT_C_DECLS_BEGIN
|
---|
48 |
|
---|
49 |
|
---|
50 | /** @defgroup grp_dbgf_corefmt VM Core File Format
|
---|
51 | * @ingroup grp_dbgf
|
---|
52 | *
|
---|
53 | * @todo Add description of the core file format and how the structures in this
|
---|
54 | * file relate to it. Point to X86XSAVEAREA in x86.h for the CPU's
|
---|
55 | * FPU/SSE/AVX/XXX state.
|
---|
56 | * @todo Add the note names.
|
---|
57 | *
|
---|
58 | * @{
|
---|
59 | */
|
---|
60 |
|
---|
61 | /** DBGCORECOREDESCRIPTOR::u32Magic. */
|
---|
62 | #define DBGFCORE_MAGIC UINT32_C(0xc01ac0de)
|
---|
63 | /** DBGCORECOREDESCRIPTOR::u32FmtVersion. */
|
---|
64 | #define DBGFCORE_FMT_VERSION UINT32_C(0x00010006)
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * An x86 segment selector.
|
---|
68 | */
|
---|
69 | typedef struct DBGFCORESEL
|
---|
70 | {
|
---|
71 | uint64_t uBase;
|
---|
72 | uint32_t uLimit;
|
---|
73 | uint32_t uAttr;
|
---|
74 | uint16_t uSel;
|
---|
75 | uint16_t uReserved0;
|
---|
76 | uint32_t uReserved1;
|
---|
77 | } DBGFCORESEL;
|
---|
78 | AssertCompileSizeAlignment(DBGFCORESEL, 8);
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * A gdtr/ldtr descriptor.
|
---|
82 | */
|
---|
83 | typedef struct DBGFCOREXDTR
|
---|
84 | {
|
---|
85 | uint64_t uAddr;
|
---|
86 | uint32_t cb;
|
---|
87 | uint32_t uReserved0;
|
---|
88 | } DBGFCOREXDTR;
|
---|
89 | AssertCompileSizeAlignment(DBGFCOREXDTR, 8);
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * A simpler to parse CPU dump than CPUMCTX.
|
---|
93 | *
|
---|
94 | * Please bump DBGFCORE_FMT_VERSION by 1 if you make any changes to this
|
---|
95 | * structure.
|
---|
96 | */
|
---|
97 | typedef struct DBGFCORECPU
|
---|
98 | {
|
---|
99 | uint64_t rax;
|
---|
100 | uint64_t rbx;
|
---|
101 | uint64_t rcx;
|
---|
102 | uint64_t rdx;
|
---|
103 | uint64_t rsi;
|
---|
104 | uint64_t rdi;
|
---|
105 | uint64_t r8;
|
---|
106 | uint64_t r9;
|
---|
107 | uint64_t r10;
|
---|
108 | uint64_t r11;
|
---|
109 | uint64_t r12;
|
---|
110 | uint64_t r13;
|
---|
111 | uint64_t r14;
|
---|
112 | uint64_t r15;
|
---|
113 | uint64_t rip;
|
---|
114 | uint64_t rsp;
|
---|
115 | uint64_t rbp;
|
---|
116 | uint64_t rflags;
|
---|
117 | DBGFCORESEL cs;
|
---|
118 | DBGFCORESEL ds;
|
---|
119 | DBGFCORESEL es;
|
---|
120 | DBGFCORESEL fs;
|
---|
121 | DBGFCORESEL gs;
|
---|
122 | DBGFCORESEL ss;
|
---|
123 | uint64_t cr0;
|
---|
124 | uint64_t cr2;
|
---|
125 | uint64_t cr3;
|
---|
126 | uint64_t cr4;
|
---|
127 | uint64_t dr[8];
|
---|
128 | DBGFCOREXDTR gdtr;
|
---|
129 | DBGFCOREXDTR idtr;
|
---|
130 | DBGFCORESEL ldtr;
|
---|
131 | DBGFCORESEL tr;
|
---|
132 | struct
|
---|
133 | {
|
---|
134 | uint64_t cs;
|
---|
135 | uint64_t eip;
|
---|
136 | uint64_t esp;
|
---|
137 | } sysenter;
|
---|
138 | uint64_t msrEFER;
|
---|
139 | uint64_t msrSTAR;
|
---|
140 | uint64_t msrPAT;
|
---|
141 | uint64_t msrLSTAR;
|
---|
142 | uint64_t msrCSTAR;
|
---|
143 | uint64_t msrSFMASK;
|
---|
144 | uint64_t msrKernelGSBase;
|
---|
145 | uint64_t msrApicBase;
|
---|
146 | uint64_t msrTscAux;
|
---|
147 | uint64_t aXcr[2];
|
---|
148 | uint32_t cbExt;
|
---|
149 | uint32_t uPadding0;
|
---|
150 | X86XSAVEAREA ext;
|
---|
151 | } DBGFCORECPU;
|
---|
152 | /** Pointer to a DBGF-core CPU. */
|
---|
153 | typedef DBGFCORECPU *PDBGFCORECPU;
|
---|
154 | /** Pointer to the const DBGF-core CPU. */
|
---|
155 | typedef const DBGFCORECPU *PCDBGFCORECPU;
|
---|
156 | AssertCompileMemberAlignment(DBGFCORECPU, cr0, 8);
|
---|
157 | AssertCompileMemberAlignment(DBGFCORECPU, msrEFER, 8);
|
---|
158 | AssertCompileMemberAlignment(DBGFCORECPU, ext, 8);
|
---|
159 | AssertCompileSizeAlignment(DBGFCORECPU, 8);
|
---|
160 |
|
---|
161 | /**
|
---|
162 | * The DBGF Core descriptor.
|
---|
163 | */
|
---|
164 | typedef struct DBGFCOREDESCRIPTOR
|
---|
165 | {
|
---|
166 | /** The core file magic (DBGFCORE_MAGIC) */
|
---|
167 | uint32_t u32Magic;
|
---|
168 | /** The core file format version (DBGFCORE_FMT_VERSION). */
|
---|
169 | uint32_t u32FmtVersion;
|
---|
170 | /** Size of this structure (sizeof(DBGFCOREDESCRIPTOR)). */
|
---|
171 | uint32_t cbSelf;
|
---|
172 | /** VirtualBox version. */
|
---|
173 | uint32_t u32VBoxVersion;
|
---|
174 | /** VirtualBox revision. */
|
---|
175 | uint32_t u32VBoxRevision;
|
---|
176 | /** Number of CPUs. */
|
---|
177 | uint32_t cCpus;
|
---|
178 | } DBGFCOREDESCRIPTOR;
|
---|
179 | AssertCompileSizeAlignment(DBGFCOREDESCRIPTOR, 8);
|
---|
180 | /** Pointer to DBGFCOREDESCRIPTOR data. */
|
---|
181 | typedef DBGFCOREDESCRIPTOR *PDBGFCOREDESCRIPTOR;
|
---|
182 |
|
---|
183 | /** @} */
|
---|
184 |
|
---|
185 | RT_C_DECLS_END
|
---|
186 |
|
---|
187 | #endif /* !VBOX_INCLUDED_vmm_dbgfcorefmt_h */
|
---|
188 |
|
---|