| 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_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ |
| 16 #define CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ | 16 #define CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ |
| 17 | 17 |
| 18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 | 19 |
| 20 #include "snapshot/cpu_architecture.h" | 20 #include "snapshot/cpu_architecture.h" |
| 21 | 21 |
| 22 namespace crashpad { | 22 namespace crashpad { |
| 23 | 23 |
| 24 //! \brief A context structure carrying 32-bit x86 CPU state. | 24 //! \brief A context structure carrying 32-bit x86 CPU state. |
| 25 struct CPUContextX86 { | 25 struct CPUContextX86 { |
| 26 typedef uint8_t X87Register[10]; | 26 using X87Register = uint8_t[10]; |
| 27 | 27 |
| 28 union X87OrMMXRegister { | 28 union X87OrMMXRegister { |
| 29 struct { | 29 struct { |
| 30 X87Register st; | 30 X87Register st; |
| 31 uint8_t st_reserved[6]; | 31 uint8_t st_reserved[6]; |
| 32 }; | 32 }; |
| 33 struct { | 33 struct { |
| 34 uint8_t mm_value[8]; | 34 uint8_t mm_value[8]; |
| 35 uint8_t mm_reserved[8]; | 35 uint8_t mm_reserved[8]; |
| 36 }; | 36 }; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 typedef uint8_t XMMRegister[16]; | 39 using XMMRegister = uint8_t[16]; |
| 40 | 40 |
| 41 struct Fxsave { | 41 struct Fxsave { |
| 42 uint16_t fcw; // FPU control word | 42 uint16_t fcw; // FPU control word |
| 43 uint16_t fsw; // FPU status word | 43 uint16_t fsw; // FPU status word |
| 44 uint8_t ftw; // abridged FPU tag word | 44 uint8_t ftw; // abridged FPU tag word |
| 45 uint8_t reserved_1; | 45 uint8_t reserved_1; |
| 46 uint16_t fop; // FPU opcode | 46 uint16_t fop; // FPU opcode |
| 47 uint32_t fpu_ip; // FPU instruction pointer offset | 47 uint32_t fpu_ip; // FPU instruction pointer offset |
| 48 uint16_t fpu_cs; // FPU instruction pointer segment selector | 48 uint16_t fpu_cs; // FPU instruction pointer segment selector |
| 49 uint16_t reserved_2; | 49 uint16_t reserved_2; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 uint32_t dr2; | 114 uint32_t dr2; |
| 115 uint32_t dr3; | 115 uint32_t dr3; |
| 116 uint32_t dr4; // obsolete, normally an alias for dr6 | 116 uint32_t dr4; // obsolete, normally an alias for dr6 |
| 117 uint32_t dr5; // obsolete, normally an alias for dr7 | 117 uint32_t dr5; // obsolete, normally an alias for dr7 |
| 118 uint32_t dr6; | 118 uint32_t dr6; |
| 119 uint32_t dr7; | 119 uint32_t dr7; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 //! \brief A context structure carrying x86_64 CPU state. | 122 //! \brief A context structure carrying x86_64 CPU state. |
| 123 struct CPUContextX86_64 { | 123 struct CPUContextX86_64 { |
| 124 typedef CPUContextX86::X87Register X87Register; | 124 using X87Register = CPUContextX86::X87Register; |
| 125 typedef CPUContextX86::X87OrMMXRegister X87OrMMXRegister; | 125 using X87OrMMXRegister = CPUContextX86::X87OrMMXRegister; |
| 126 typedef CPUContextX86::XMMRegister XMMRegister; | 126 using XMMRegister = CPUContextX86::XMMRegister; |
| 127 | 127 |
| 128 struct Fxsave { | 128 struct Fxsave { |
| 129 uint16_t fcw; // FPU control word | 129 uint16_t fcw; // FPU control word |
| 130 uint16_t fsw; // FPU status word | 130 uint16_t fsw; // FPU status word |
| 131 uint8_t ftw; // abridged FPU tag word | 131 uint8_t ftw; // abridged FPU tag word |
| 132 uint8_t reserved_1; | 132 uint8_t reserved_1; |
| 133 uint16_t fop; // FPU opcode | 133 uint16_t fop; // FPU opcode |
| 134 union { | 134 union { |
| 135 // The expression of these union members is determined by the use of | 135 // The expression of these union members is determined by the use of |
| 136 // fxsave/fxrstor or fxsave64/fxrstor64 (fxsaveq/fxrstorq). Mac OS X and | 136 // fxsave/fxrstor or fxsave64/fxrstor64 (fxsaveq/fxrstorq). Mac OS X and |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 CPUArchitecture architecture; | 210 CPUArchitecture architecture; |
| 211 union { | 211 union { |
| 212 CPUContextX86* x86; | 212 CPUContextX86* x86; |
| 213 CPUContextX86_64* x86_64; | 213 CPUContextX86_64* x86_64; |
| 214 }; | 214 }; |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 } // namespace crashpad | 217 } // namespace crashpad |
| 218 | 218 |
| 219 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ | 219 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ |
| OLD | NEW |