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, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 uint32_t dr6; | 89 uint32_t dr6; |
90 uint32_t dr7; | 90 uint32_t dr7; |
91 }; | 91 }; |
92 | 92 |
93 //! \brief A context structure carrying x86_64 CPU state. | 93 //! \brief A context structure carrying x86_64 CPU state. |
94 struct CPUContextX86_64 { | 94 struct CPUContextX86_64 { |
95 typedef CPUContextX86::X87Register X87Register; | 95 typedef CPUContextX86::X87Register X87Register; |
96 typedef CPUContextX86::X87OrMMXRegister X87OrMMXRegister; | 96 typedef CPUContextX86::X87OrMMXRegister X87OrMMXRegister; |
97 typedef CPUContextX86::XMMRegister XMMRegister; | 97 typedef CPUContextX86::XMMRegister XMMRegister; |
98 | 98 |
99 struct Fxsave64 { | 99 struct Fxsave { |
100 uint16_t fcw; // FPU control word | 100 uint16_t fcw; // FPU control word |
101 uint16_t fsw; // FPU status word | 101 uint16_t fsw; // FPU status word |
102 uint8_t ftw; // abridged FPU tag word | 102 uint8_t ftw; // abridged FPU tag word |
103 uint8_t reserved_1; | 103 uint8_t reserved_1; |
104 uint16_t fop; // FPU opcode | 104 uint16_t fop; // FPU opcode |
105 uint64_t fpu_ip; // FPU instruction pointer | 105 union { |
106 uint64_t fpu_dp; // FPU data pointer | 106 // The expression of these union members is determined by the use of |
| 107 // fxsave/fxrstor or fxsave64/fxrstor64 (fxsaveq/fxrstorq). Mac OS X and |
| 108 // Windows systems use the traditional fxsave/fxrstor structure. |
| 109 struct { |
| 110 // fxsave/fxrstor |
| 111 uint32_t fpu_ip; // FPU instruction pointer offset |
| 112 uint16_t fpu_cs; // FPU instruction pointer segment selector |
| 113 uint16_t reserved_2; |
| 114 uint32_t fpu_dp; // FPU data pointer offset |
| 115 uint16_t fpu_ds; // FPU data pointer segment selector |
| 116 uint16_t reserved_3; |
| 117 }; |
| 118 struct { |
| 119 // fxsave64/fxrstor64 (fxsaveq/fxrstorq) |
| 120 uint64_t fpu_ip_64; // FPU instruction pointer |
| 121 uint64_t fpu_dp_64; // FPU data pointer |
| 122 }; |
| 123 }; |
107 uint32_t mxcsr; // multimedia extensions status and control register | 124 uint32_t mxcsr; // multimedia extensions status and control register |
108 uint32_t mxcsr_mask; // valid bits in mxcsr | 125 uint32_t mxcsr_mask; // valid bits in mxcsr |
109 X87OrMMXRegister st_mm[8]; | 126 X87OrMMXRegister st_mm[8]; |
110 XMMRegister xmm[16]; | 127 XMMRegister xmm[16]; |
111 uint8_t reserved_2[48]; | 128 uint8_t reserved_4[48]; |
112 uint8_t available[48]; | 129 uint8_t available[48]; |
113 }; | 130 }; |
114 | 131 |
115 // Integer registers. | 132 // Integer registers. |
116 uint64_t rax; | 133 uint64_t rax; |
117 uint64_t rbx; | 134 uint64_t rbx; |
118 uint64_t rcx; | 135 uint64_t rcx; |
119 uint64_t rdx; | 136 uint64_t rdx; |
120 uint64_t rdi; // destination index | 137 uint64_t rdi; // destination index |
121 uint64_t rsi; // source index | 138 uint64_t rsi; // source index |
122 uint64_t rbp; // base pointer | 139 uint64_t rbp; // base pointer |
123 uint64_t rsp; // stack pointer | 140 uint64_t rsp; // stack pointer |
124 uint64_t r8; | 141 uint64_t r8; |
125 uint64_t r9; | 142 uint64_t r9; |
126 uint64_t r10; | 143 uint64_t r10; |
127 uint64_t r11; | 144 uint64_t r11; |
128 uint64_t r12; | 145 uint64_t r12; |
129 uint64_t r13; | 146 uint64_t r13; |
130 uint64_t r14; | 147 uint64_t r14; |
131 uint64_t r15; | 148 uint64_t r15; |
132 uint64_t rip; // instruction pointer | 149 uint64_t rip; // instruction pointer |
133 uint64_t rflags; | 150 uint64_t rflags; |
134 uint16_t cs; // code segment selector | 151 uint16_t cs; // code segment selector |
135 uint16_t fs; | 152 uint16_t fs; |
136 uint16_t gs; | 153 uint16_t gs; |
137 | 154 |
138 // Floating-point and vector registers. | 155 // Floating-point and vector registers. |
139 Fxsave64 fxsave64; | 156 Fxsave fxsave; |
140 | 157 |
141 // Debug registers. | 158 // Debug registers. |
142 uint64_t dr0; | 159 uint64_t dr0; |
143 uint64_t dr1; | 160 uint64_t dr1; |
144 uint64_t dr2; | 161 uint64_t dr2; |
145 uint64_t dr3; | 162 uint64_t dr3; |
146 uint64_t dr4; // obsolete, normally an alias for dr6 | 163 uint64_t dr4; // obsolete, normally an alias for dr6 |
147 uint64_t dr5; // obsolete, normally an alias for dr7 | 164 uint64_t dr5; // obsolete, normally an alias for dr7 |
148 uint64_t dr6; | 165 uint64_t dr6; |
149 uint64_t dr7; | 166 uint64_t dr7; |
(...skipping 14 matching lines...) Expand all Loading... |
164 CPUArchitecture architecture; | 181 CPUArchitecture architecture; |
165 union { | 182 union { |
166 CPUContextX86* x86; | 183 CPUContextX86* x86; |
167 CPUContextX86_64* x86_64; | 184 CPUContextX86_64* x86_64; |
168 }; | 185 }; |
169 }; | 186 }; |
170 | 187 |
171 } // namespace crashpad | 188 } // namespace crashpad |
172 | 189 |
173 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ | 190 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ |
OLD | NEW |