1 | /** @file
|
---|
2 | * DBGF - Debugger Facility, VM Core File Format.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2010-2019 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_dbgfcorefmt_h
|
---|
27 | #define VBOX_INCLUDED_vmm_dbgfcorefmt_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/types.h>
|
---|
33 | #include <VBox/vmm/cpumctx.h>
|
---|
34 | #include <iprt/assert.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 |
|
---|
40 | /** @defgroup grp_dbgf_corefmt VM Core File Format
|
---|
41 | * @ingroup grp_dbgf
|
---|
42 | *
|
---|
43 | * @todo Add description of the core file format and how the structures in this
|
---|
44 | * file relate to it. Point to X86XSAVEAREA in x86.h for the CPU's
|
---|
45 | * FPU/SSE/AVX/XXX state.
|
---|
46 | * @todo Add the note names.
|
---|
47 | *
|
---|
48 | * @{
|
---|
49 | */
|
---|
50 |
|
---|
51 | /** DBGCORECOREDESCRIPTOR::u32Magic. */
|
---|
52 | #define DBGFCORE_MAGIC UINT32_C(0xc01ac0de)
|
---|
53 | /** DBGCORECOREDESCRIPTOR::u32FmtVersion. */
|
---|
54 | #define DBGFCORE_FMT_VERSION UINT32_C(0x00010005)
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * An x86 segment selector.
|
---|
58 | */
|
---|
59 | typedef struct DBGFCORESEL
|
---|
60 | {
|
---|
61 | uint64_t uBase;
|
---|
62 | uint32_t uLimit;
|
---|
63 | uint32_t uAttr;
|
---|
64 | uint16_t uSel;
|
---|
65 | uint16_t uReserved0;
|
---|
66 | uint32_t uReserved1;
|
---|
67 | } DBGFCORESEL;
|
---|
68 | AssertCompileSizeAlignment(DBGFCORESEL, 8);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * A gdtr/ldtr descriptor.
|
---|
72 | */
|
---|
73 | typedef struct DBGFCOREXDTR
|
---|
74 | {
|
---|
75 | uint64_t uAddr;
|
---|
76 | uint32_t cb;
|
---|
77 | uint32_t uReserved0;
|
---|
78 | } DBGFCOREXDTR;
|
---|
79 | AssertCompileSizeAlignment(DBGFCOREXDTR, 8);
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * A simpler to parse CPU dump than CPUMCTX.
|
---|
83 | *
|
---|
84 | * Please bump DBGFCORE_FMT_VERSION by 1 if you make any changes to this
|
---|
85 | * structure.
|
---|
86 | */
|
---|
87 | typedef struct DBGFCORECPU
|
---|
88 | {
|
---|
89 | uint64_t rax;
|
---|
90 | uint64_t rbx;
|
---|
91 | uint64_t rcx;
|
---|
92 | uint64_t rdx;
|
---|
93 | uint64_t rsi;
|
---|
94 | uint64_t rdi;
|
---|
95 | uint64_t r8;
|
---|
96 | uint64_t r9;
|
---|
97 | uint64_t r10;
|
---|
98 | uint64_t r11;
|
---|
99 | uint64_t r12;
|
---|
100 | uint64_t r13;
|
---|
101 | uint64_t r14;
|
---|
102 | uint64_t r15;
|
---|
103 | uint64_t rip;
|
---|
104 | uint64_t rsp;
|
---|
105 | uint64_t rbp;
|
---|
106 | uint64_t rflags;
|
---|
107 | DBGFCORESEL cs;
|
---|
108 | DBGFCORESEL ds;
|
---|
109 | DBGFCORESEL es;
|
---|
110 | DBGFCORESEL fs;
|
---|
111 | DBGFCORESEL gs;
|
---|
112 | DBGFCORESEL ss;
|
---|
113 | uint64_t cr0;
|
---|
114 | uint64_t cr2;
|
---|
115 | uint64_t cr3;
|
---|
116 | uint64_t cr4;
|
---|
117 | uint64_t dr[8];
|
---|
118 | DBGFCOREXDTR gdtr;
|
---|
119 | DBGFCOREXDTR idtr;
|
---|
120 | DBGFCORESEL ldtr;
|
---|
121 | DBGFCORESEL tr;
|
---|
122 | struct
|
---|
123 | {
|
---|
124 | uint64_t cs;
|
---|
125 | uint64_t eip;
|
---|
126 | uint64_t esp;
|
---|
127 | } sysenter;
|
---|
128 | uint64_t msrEFER;
|
---|
129 | uint64_t msrSTAR;
|
---|
130 | uint64_t msrPAT;
|
---|
131 | uint64_t msrLSTAR;
|
---|
132 | uint64_t msrCSTAR;
|
---|
133 | uint64_t msrSFMASK;
|
---|
134 | uint64_t msrKernelGSBase;
|
---|
135 | uint64_t msrApicBase;
|
---|
136 | uint64_t aXcr[2];
|
---|
137 | uint32_t cbExt;
|
---|
138 | uint32_t uPadding0;
|
---|
139 | X86XSAVEAREA ext;
|
---|
140 | } DBGFCORECPU;
|
---|
141 | /** Pointer to a DBGF-core CPU. */
|
---|
142 | typedef DBGFCORECPU *PDBGFCORECPU;
|
---|
143 | /** Pointer to the const DBGF-core CPU. */
|
---|
144 | typedef const DBGFCORECPU *PCDBGFCORECPU;
|
---|
145 | AssertCompileMemberAlignment(DBGFCORECPU, cr0, 8);
|
---|
146 | AssertCompileMemberAlignment(DBGFCORECPU, msrEFER, 8);
|
---|
147 | AssertCompileMemberAlignment(DBGFCORECPU, ext, 8);
|
---|
148 | AssertCompileSizeAlignment(DBGFCORECPU, 8);
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * The DBGF Core descriptor.
|
---|
152 | */
|
---|
153 | typedef struct DBGFCOREDESCRIPTOR
|
---|
154 | {
|
---|
155 | /** The core file magic (DBGFCORE_MAGIC) */
|
---|
156 | uint32_t u32Magic;
|
---|
157 | /** The core file format version (DBGFCORE_FMT_VERSION). */
|
---|
158 | uint32_t u32FmtVersion;
|
---|
159 | /** Size of this structure (sizeof(DBGFCOREDESCRIPTOR)). */
|
---|
160 | uint32_t cbSelf;
|
---|
161 | /** VirtualBox version. */
|
---|
162 | uint32_t u32VBoxVersion;
|
---|
163 | /** VirtualBox revision. */
|
---|
164 | uint32_t u32VBoxRevision;
|
---|
165 | /** Number of CPUs. */
|
---|
166 | uint32_t cCpus;
|
---|
167 | } DBGFCOREDESCRIPTOR;
|
---|
168 | AssertCompileSizeAlignment(DBGFCOREDESCRIPTOR, 8);
|
---|
169 | /** Pointer to DBGFCOREDESCRIPTOR data. */
|
---|
170 | typedef DBGFCOREDESCRIPTOR *PDBGFCOREDESCRIPTOR;
|
---|
171 |
|
---|
172 | /** @} */
|
---|
173 |
|
---|
174 | RT_C_DECLS_END
|
---|
175 |
|
---|
176 | #endif /* !VBOX_INCLUDED_vmm_dbgfcorefmt_h */
|
---|
177 |
|
---|