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