OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ | 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ |
16 #define CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ | 16 #define CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 | 19 |
| 20 #include "snapshot/cpu_context.h" |
20 #include "util/numeric/int128.h" | 21 #include "util/numeric/int128.h" |
21 | 22 |
22 namespace crashpad { | 23 namespace crashpad { |
23 | 24 |
24 //! \brief Architecture-independent flags for `context_flags` fields in Minidump | 25 //! \brief Architecture-independent flags for `context_flags` fields in Minidump |
25 //! context structures. | 26 //! context structures. |
26 // | 27 // |
27 // http://zachsaw.blogspot.com/2010/11/wow64-bug-getthreadcontext-may-return.htm
l#c5639760895973344002 | 28 // http://zachsaw.blogspot.com/2010/11/wow64-bug-getthreadcontext-may-return.htm
l#c5639760895973344002 |
28 enum MinidumpContextFlags : uint32_t { | 29 enum MinidumpContextFlags : uint32_t { |
29 //! \brief The thread was executing a trap handler in kernel mode | 30 //! \brief The thread was executing a trap handler in kernel mode |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 uint32_t ecx; | 170 uint32_t ecx; |
170 uint32_t eax; | 171 uint32_t eax; |
171 | 172 |
172 uint32_t ebp; | 173 uint32_t ebp; |
173 uint32_t eip; | 174 uint32_t eip; |
174 uint32_t cs; | 175 uint32_t cs; |
175 uint32_t eflags; | 176 uint32_t eflags; |
176 uint32_t esp; | 177 uint32_t esp; |
177 uint32_t ss; | 178 uint32_t ss; |
178 | 179 |
179 uint8_t extended_registers[512]; | 180 // CPUContextX86::Fxsave has identical layout to what the x86 CONTEXT |
| 181 // structure places here. |
| 182 CPUContextX86::Fxsave fxsave; |
180 }; | 183 }; |
181 | 184 |
182 //! \brief x86_64-specifc flags for MinidumpContextAMD64::context_flags. | 185 //! \brief x86_64-specifc flags for MinidumpContextAMD64::context_flags. |
183 enum MinidumpContextAMD64Flags : uint32_t { | 186 enum MinidumpContextAMD64Flags : uint32_t { |
184 //! \brief Identifies the context structure as x86_64. This is the same as | 187 //! \brief Identifies the context structure as x86_64. This is the same as |
185 //! `CONTEXT_AMD64` on Windows for this architecture. | 188 //! `CONTEXT_AMD64` on Windows for this architecture. |
186 kMinidumpContextAMD64 = 0x00100000, | 189 kMinidumpContextAMD64 = 0x00100000, |
187 | 190 |
188 //! \brief Indicates the validity of control registers (`CONTEXT_CONTROL`). | 191 //! \brief Indicates the validity of control registers (`CONTEXT_CONTROL`). |
189 //! | 192 //! |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 uint64_t r9; | 297 uint64_t r9; |
295 uint64_t r10; | 298 uint64_t r10; |
296 uint64_t r11; | 299 uint64_t r11; |
297 uint64_t r12; | 300 uint64_t r12; |
298 uint64_t r13; | 301 uint64_t r13; |
299 uint64_t r14; | 302 uint64_t r14; |
300 uint64_t r15; | 303 uint64_t r15; |
301 | 304 |
302 uint64_t rip; | 305 uint64_t rip; |
303 | 306 |
304 union { | 307 // CPUContextX86_64::Fxsave has identical layout to what the x86_64 CONTEXT |
305 struct { | 308 // structure places here. |
306 uint16_t control_word; | 309 CPUContextX86_64::Fxsave fxsave; |
307 uint16_t status_word; | |
308 uint8_t tag_word; | |
309 uint8_t reserved_1; | |
310 uint16_t error_opcode; | |
311 uint32_t error_offset; | |
312 uint16_t error_selector; | |
313 uint16_t reserved_2; | |
314 uint32_t data_offset; | |
315 uint16_t data_selector; | |
316 uint16_t reserved_3; | |
317 uint32_t mx_csr; | |
318 uint32_t mx_csr_mask; | |
319 uint128_struct float_registers[8]; | |
320 uint128_struct xmm_registers[16]; | |
321 uint8_t reserved_4[96]; | |
322 } float_save; | |
323 struct { | |
324 uint128_struct header[2]; | |
325 uint128_struct legacy[8]; | |
326 uint128_struct xmm0; | |
327 uint128_struct xmm1; | |
328 uint128_struct xmm2; | |
329 uint128_struct xmm3; | |
330 uint128_struct xmm4; | |
331 uint128_struct xmm5; | |
332 uint128_struct xmm6; | |
333 uint128_struct xmm7; | |
334 uint128_struct xmm8; | |
335 uint128_struct xmm9; | |
336 uint128_struct xmm10; | |
337 uint128_struct xmm11; | |
338 uint128_struct xmm12; | |
339 uint128_struct xmm13; | |
340 uint128_struct xmm14; | |
341 uint128_struct xmm15; | |
342 }; | |
343 }; | |
344 | 310 |
345 uint128_struct vector_register[26]; | 311 uint128_struct vector_register[26]; |
346 uint64_t vector_control; | 312 uint64_t vector_control; |
347 | 313 |
348 //! \brief Model-specific debug extension register. | 314 //! \brief Model-specific debug extension register. |
349 //! | 315 //! |
350 //! See Intel Software Developer’s Manual, Volume 3B: System Programming, Part | 316 //! See Intel Software Developer’s Manual, Volume 3B: System Programming, Part |
351 //! 2 (253669-051), 17.4 “Last Branch, Interrupt, and Exception Recording | 317 //! 2 (253669-051), 17.4 “Last Branch, Interrupt, and Exception Recording |
352 //! Overview”, and AMD Architecture Programmer’s Manual, Volume 2: | 318 //! Overview”, and AMD Architecture Programmer’s Manual, Volume 2: |
353 //! System Programming (24593-3.24), 13.1.6 “Control-Transfer Breakpoint | 319 //! System Programming (24593-3.24), 13.1.6 “Control-Transfer Breakpoint |
354 //! Features”. | 320 //! Features”. |
355 //! | 321 //! |
356 //! \{ | 322 //! \{ |
357 uint64_t debug_control; | 323 uint64_t debug_control; |
358 uint64_t last_branch_to_rip; | 324 uint64_t last_branch_to_rip; |
359 uint64_t last_branch_from_rip; | 325 uint64_t last_branch_from_rip; |
360 uint64_t last_exception_to_rip; | 326 uint64_t last_exception_to_rip; |
361 uint64_t last_exception_from_rip; | 327 uint64_t last_exception_from_rip; |
362 //! \} | 328 //! \} |
363 }; | 329 }; |
364 | 330 |
365 } // namespace crashpad | 331 } // namespace crashpad |
366 | 332 |
367 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ | 333 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ |
OLD | NEW |