4 * Copyright (c) 2018 Virtuozzo International GmbH
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
11 typedef struct WinDumpPhyMemRun64
{
14 } QEMU_PACKED WinDumpPhyMemRun64
;
16 typedef struct WinDumpPhyMemDesc64
{
17 uint32_t NumberOfRuns
;
19 uint64_t NumberOfPages
;
20 WinDumpPhyMemRun64 Run
[43];
21 } QEMU_PACKED WinDumpPhyMemDesc64
;
23 typedef struct WinDumpExceptionRecord
{
24 uint32_t ExceptionCode
;
25 uint32_t ExceptionFlags
;
26 uint64_t ExceptionRecord
;
27 uint64_t ExceptionAddress
;
28 uint32_t NumberParameters
;
30 uint64_t ExceptionInformation
[15];
31 } QEMU_PACKED WinDumpExceptionRecord
;
33 typedef struct WinDumpHeader64
{
36 uint32_t MajorVersion
;
37 uint32_t MinorVersion
;
38 uint64_t DirectoryTableBase
;
40 uint64_t PsLoadedModuleList
;
41 uint64_t PsActiveProcessHead
;
42 uint32_t MachineImageType
;
43 uint32_t NumberProcessors
;
46 uint32_t BugcheckCode
;
48 uint64_t BugcheckParameter1
;
49 uint64_t BugcheckParameter2
;
50 uint64_t BugcheckParameter3
;
51 uint64_t BugcheckParameter4
;
53 uint8_t BugcheckData
[40];
55 uint8_t VersionUser
[32];
56 uint64_t KdDebuggerDataBlock
;
58 WinDumpPhyMemDesc64 PhysicalMemoryBlock
;
59 uint8_t PhysicalMemoryBlockBuffer
[704];
62 uint8_t ContextBuffer
[3000];
64 WinDumpExceptionRecord Exception
;
67 uint64_t RequiredDumpSpace
;
70 uint64_t SystemUpTime
;
71 uint32_t MiniDumpFields
;
72 uint32_t SecondaryDataState
;
75 uint32_t WriterStatus
;
77 uint8_t KdSecondaryVersion
;
78 uint8_t reserved
[4018];
79 } QEMU_PACKED WinDumpHeader64
;
81 void create_win_dump(DumpState
*s
, Error
**errp
);
83 #define KDBG_OWNER_TAG_OFFSET64 0x10
84 #define KDBG_MM_PFN_DATABASE_OFFSET64 0xC0
85 #define KDBG_KI_BUGCHECK_DATA_OFFSET64 0x88
86 #define KDBG_KI_PROCESSOR_BLOCK_OFFSET64 0x218
87 #define KDBG_OFFSET_PRCB_CONTEXT_OFFSET64 0x338
89 #define VMCOREINFO_ELF_NOTE_HDR_SIZE 24
91 #define WIN_CTX_X64 0x00100000L
93 #define WIN_CTX_CTL 0x00000001L
94 #define WIN_CTX_INT 0x00000002L
95 #define WIN_CTX_SEG 0x00000004L
96 #define WIN_CTX_FP 0x00000008L
97 #define WIN_CTX_DBG 0x00000010L
99 #define WIN_CTX_FULL (WIN_CTX_X64 | WIN_CTX_CTL | WIN_CTX_INT | WIN_CTX_FP)
100 #define WIN_CTX_ALL (WIN_CTX_FULL | WIN_CTX_SEG | WIN_CTX_DBG)
102 #define LIVE_SYSTEM_DUMP 0x00000161
104 typedef struct WinM128A
{
107 } QEMU_ALIGNED(16) WinM128A
;
109 typedef struct WinContext
{
112 uint32_t ContextFlags
;
150 uint16_t ControlWord
;
154 uint16_t ErrorOpcode
;
155 uint32_t ErrorOffset
;
156 uint16_t ErrorSelector
;
159 uint16_t DataSelector
;
163 WinM128A FloatRegisters
[8];
164 WinM128A XmmRegisters
[16];
165 uint8_t Reserved4
[96];
168 WinM128A VectorRegister
[26];
169 uint64_t VectorControl
;
171 uint64_t DebugControl
;
172 uint64_t LastBranchToRip
;
173 uint64_t LastBranchFromRip
;
174 uint64_t LastExceptionToRip
;
175 uint64_t LastExceptionFromRip
;
176 } QEMU_ALIGNED(16) WinContext
;