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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 uint16_t fpu_ds; // FPU data pointer segment selector | 51 uint16_t fpu_ds; // FPU data pointer segment selector |
52 uint16_t reserved_3; | 52 uint16_t reserved_3; |
53 uint32_t mxcsr; // multimedia extensions status and control register | 53 uint32_t mxcsr; // multimedia extensions status and control register |
54 uint32_t mxcsr_mask; // valid bits in mxcsr | 54 uint32_t mxcsr_mask; // valid bits in mxcsr |
55 X87OrMMXRegister st_mm[8]; | 55 X87OrMMXRegister st_mm[8]; |
56 XMMRegister xmm[8]; | 56 XMMRegister xmm[8]; |
57 uint8_t reserved_4[176]; | 57 uint8_t reserved_4[176]; |
58 uint8_t available[48]; | 58 uint8_t available[48]; |
59 }; | 59 }; |
60 | 60 |
| 61 //! \brief Converts x87 floating-point tag words from `fxsave` (abridged, |
| 62 //! 8-bit) to `fsave` (full, 16-bit) form. |
| 63 //! |
| 64 //! `fxsave` stores the x87 floating-point tag word in abridged 8-bit form, |
| 65 //! and `fsave` stores it in full 16-bit form. Some users, notably |
| 66 //! MinidumpContextX86::float_save::tag_word, require the full 16-bit form, |
| 67 //! where most other contemporary code uses `fxsave` and thus the abridged |
| 68 //! 8-bit form found in CPUContextX86::Fxsave::ftw. |
| 69 //! |
| 70 //! This function converts an abridged tag word to the full version by using |
| 71 //! the abridged tag word and the contents of the registers it describes. See |
| 72 //! Intel Software Developer’s Manual, Volume 2A: Instruction Set Reference |
| 73 //! A-M (253666-052), 3.2 “FXSAVE”, specifically, the notes on the abridged |
| 74 //! FTW and recreating the FSAVE format, and AMD Architecture Programmer’s |
| 75 //! Manual, Volume 2: System Programming (24593-3.24), “FXSAVE Format for x87 |
| 76 //! Tag Word”. |
| 77 //! |
| 78 //! \param[in] fsw The FPU status word, used to map logical \a st_mm registers |
| 79 //! to their physical counterparts. This can be taken from |
| 80 //! CPUContextX86::Fxsave::fsw. |
| 81 //! \param[in] fxsave_tag The abridged FPU tag word. This can be taken from |
| 82 //! CPUContextX86::Fxsave::ftw. |
| 83 //! \param[in] st_mm The floating-point registers in logical order. This can |
| 84 //! be taken from CPUContextX86::Fxsave::st_mm. |
| 85 //! |
| 86 //! \return The full FPU tag word. |
| 87 static uint16_t FxsaveToFsaveTagWord( |
| 88 uint16_t fsw, uint8_t fxsave_tag, const X87OrMMXRegister st_mm[8]); |
| 89 |
61 // Integer registers. | 90 // Integer registers. |
62 uint32_t eax; | 91 uint32_t eax; |
63 uint32_t ebx; | 92 uint32_t ebx; |
64 uint32_t ecx; | 93 uint32_t ecx; |
65 uint32_t edx; | 94 uint32_t edx; |
66 uint32_t edi; // destination index | 95 uint32_t edi; // destination index |
67 uint32_t esi; // source index | 96 uint32_t esi; // source index |
68 uint32_t ebp; // base pointer | 97 uint32_t ebp; // base pointer |
69 uint32_t esp; // stack pointer | 98 uint32_t esp; // stack pointer |
70 uint32_t eip; // instruction pointer | 99 uint32_t eip; // instruction pointer |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 CPUArchitecture architecture; | 210 CPUArchitecture architecture; |
182 union { | 211 union { |
183 CPUContextX86* x86; | 212 CPUContextX86* x86; |
184 CPUContextX86_64* x86_64; | 213 CPUContextX86_64* x86_64; |
185 }; | 214 }; |
186 }; | 215 }; |
187 | 216 |
188 } // namespace crashpad | 217 } // namespace crashpad |
189 | 218 |
190 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ | 219 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_H_ |
OLD | NEW |