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