-
Notifications
You must be signed in to change notification settings - Fork 1
/
lkcd_vmdump_v2_v3.h
246 lines (186 loc) · 7.39 KB
/
lkcd_vmdump_v2_v3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/* lkcd_vmdump_v2_v3.h - core analysis suite
*
* Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
* Copyright (C) 2002, 2003, 2004, 2005, 2006 David Anderson
* Copyright (C) 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/*
* Kernel header file for Linux crash dumps.
*
* Created by: Matt Robinson (yakker@sgi.com)
*
* Copyright 1999 Silicon Graphics, Inc. All rights reserved.
*
*/
/* This header file includes all structure definitions for crash dumps. */
#ifndef _VMDUMP_H
#define _VMDUMP_H
/* necessary header files */
#ifndef MCLX
#include <linux/utsname.h> /* for utsname structure */
#include <asm/vmdump.h> /* for architecture-specific header */
#endif
#if defined(ARM) || defined(X86) || defined(PPC) || defined(S390) || \
defined(S390X) || defined(ARM64) || defined(MIPS) || defined(MIPS64) \
|| defined(SPARC64)
/*
* Kernel header file for Linux crash dumps.
*
* Created by: Matt Robinson (yakker@sgi.com)
*
* Copyright 1999 Silicon Graphics, Inc. All rights reserved.
*
*/
/* This header file holds the architecture specific crash dump header */
#ifndef _ASM_VMDUMP_H
#define _ASM_VMDUMP_H
/* necessary header files */
typedef unsigned int u32;
#include <asm/ptrace.h> /* for pt_regs */
/* definitions */
#define DUMP_ASM_MAGIC_NUMBER 0xdeaddeadULL /* magic number */
#define DUMP_ASM_VERSION_NUMBER 0x1 /* version number */
/*
* Structure: dump_header_asm_t
* Function: This is the header for architecture-specific stuff. It
* follows right after the dump header.
*/
typedef struct _dump_header_asm_s {
/* the dump magic number -- unique to verify dump is valid */
uint64_t dha_magic_number;
/* the version number of this dump */
uint32_t dha_version;
/* the size of this header (in case we can't read it) */
uint32_t dha_header_size;
/* the esp for i386 systems */
uint32_t dha_esp;
/* the eip for i386 systems */
uint32_t dha_eip;
/* the dump registers */
#ifndef S390
#ifndef S390X
#ifndef ARM64
struct pt_regs dha_regs;
#endif
#endif
#endif
} dump_header_asm_t;
#endif /* _ASM_VMDUMP_H */
#endif /* ARM || X86 || PPC */
#if defined(ALPHA) || defined(IA64) || defined(X86_64) || defined(PPC64)
/*
* Plug in the real ../arch/alpha/vmdump.h when available. For now the
* data here are just placeholders...
*/
#ifndef IA64
typedef unsigned int u32;
#include <asm/ptrace.h> /* for pt_regs */
#endif
/* definitions */
#define DUMP_ASM_MAGIC_NUMBER 0xdeaddeadULL /* magic number */
#define DUMP_ASM_VERSION_NUMBER 0x1 /* version number */
typedef struct _dump_header_asm_s {
/* the dump magic number -- unique to verify dump is valid */
uint64_t dha_magic_number;
/* the version number of this dump */
uint32_t dha_version;
/* the size of this header (in case we can't read it) */
uint32_t dha_header_size;
/* the esp for i386 systems */
uint32_t dha_esp;
/* the eip for i386 systems */
uint32_t dha_eip;
/* the dump registers */
#ifndef IA64
struct pt_regs dha_regs;
#endif
} dump_header_asm_t;
#endif /* ALPHA or IA64 (?) */
/* necessary header definitions in all cases */
#define DUMP_KIOBUF_NUMBER 0xdeadbeef /* special number for kiobuf maps */
#ifdef CONFIG_VMDUMP
/* size of a dump header page */
#define DUMP_PAGE_SZ 64 * 1024 /* size of dump page buffer */
/* standard header definitions */
#define DUMP_MAGIC_NUMBER 0xa8190173618f23edULL /* dump magic number */
#define DUMP_VERSION_NUMBER 0x2 /* dump version number */
#define DUMP_PANIC_LEN 0x100 /* dump panic string length */
/* dump flags -- add as necessary */
#define DUMP_RAW 0x1 /* raw page (no compression) */
#define DUMP_COMPRESSED 0x2 /* page is compressed */
#define DUMP_END 0x4 /* end marker on a full dump */
/* dump types - type specific stuff added later for page typing */
#define DUMP_NONE 0 /* no dumping at all -- just bail */
#define DUMP_HEADER 1 /* kernel dump header only */
#define DUMP_KERN 2 /* dump header and kernel pages */
#define DUMP_USED 3 /* dump header, kernel/user pages */
#define DUMP_ALL 4 /* dump header, all memory pages */
/*
* Structure: dump_header_t
* Function: This is the header dumped at the top of every valid crash
* dump.
* easy reassembly of each crash dump page. The address bits
* are split to make things easier for 64-bit/32-bit system
* conversions.
*/
typedef struct _dump_header_s {
/* the dump magic number -- unique to verify dump is valid */
uint64_t dh_magic_number;
/* the version number of this dump */
uint32_t dh_version;
/* the size of this header (in case we can't read it) */
uint32_t dh_header_size;
/* the level of this dump (just a header?) */
uint32_t dh_dump_level;
/* the size of a Linux memory page (4K, 8K, 16K, etc.) */
uint32_t dh_page_size;
/* the size of all physical memory */
uint64_t dh_memory_size;
/* the start of physical memory */
uint64_t dh_memory_start;
/* the end of physical memory */
uint64_t dh_memory_end;
/* the number of pages in this dump specifically */
uint32_t dh_num_pages;
/* the panic string, if available */
char dh_panic_string[DUMP_PANIC_LEN];
/* the time of the system crash */
struct timeval dh_time;
/* the utsname (uname) information */
struct new_utsname dh_utsname;
/* the address of the current task */
struct task_struct *dh_current_task;
} dump_header_t;
/*
* Structure: dump_page_t
* Function: To act as the header associated to each physical page of
* memory saved in the system crash dump. This allows for
* easy reassembly of each crash dump page. The address bits
* are split to make things easier for 64-bit/32-bit system
* conversions.
*/
typedef struct _dump_page_s {
/* the address of this dump page */
uint64_t dp_address;
/* the size of this dump page */
uint32_t dp_size;
/* flags (currently DUMP_COMPRESSED, DUMP_RAW or DUMP_END) */
uint32_t dp_flags;
} dump_page_t;
#endif /* CONFIG_VMDUMP */
#ifdef __KERNEL__
extern void dump_init(uint64_t, uint64_t);
extern void dump_open(char *);
extern void dump_execute(char *, struct pt_regs *);
#endif
#endif /* _VMDUMP_H */