OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_CPU_CONTEXT_H_ |
| 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_CPU_CONTEXT_H_ |
| 17 |
| 18 #include <stdint.h> |
| 19 |
| 20 #include "snapshot/cpu_context.h" |
| 21 |
| 22 namespace crashpad { |
| 23 namespace test { |
| 24 |
| 25 //! \brief Initializes a context structure for testing. |
| 26 //! |
| 27 //! Initialization is compatible with the initialization used by minidump |
| 28 //! context test initialization functions such as InitializeMinidumpContextX86() |
| 29 //! and InitializeMinidumpContextAMD64() for identical \a seed values. |
| 30 //! |
| 31 //! \param[out] context The structure to initialize. |
| 32 //! \param[in] seed The seed value. Initializing two context structures of the |
| 33 //! same type with identical seed values should produce identical context |
| 34 //! structures. Initialization with a different seed value should produce |
| 35 //! a different context structure. If \a seed is `0`, \a context is zeroed |
| 36 //! out entirely except for the CPUContext::architecture field, which will |
| 37 //! identify the context type. If \a seed is nonzero, \a context will be |
| 38 //! populated entirely with nonzero values. |
| 39 //! |
| 40 //! \{ |
| 41 void InitializeCPUContextX86(CPUContext* context, uint32_t seed); |
| 42 void InitializeCPUContextX86_64(CPUContext* context, uint32_t seed); |
| 43 //! \} |
| 44 |
| 45 //! \brief Initializes an `fxsave` context substructure for testing. |
| 46 //! |
| 47 //! \param[out] fxsave The structure to initialize. |
| 48 //! \param[in,out] seed The seed value. Initializing two `fxsave` structures of |
| 49 //! the same type with identical seed values should produce identical |
| 50 //! structures. Initialization with a different seed value should produce |
| 51 //! a different `fxsave` structure. If \a seed is `0`, \a fxsave is zeroed |
| 52 //! out entirely. If \a seed is nonzero, \a fxsave will be populated |
| 53 //! entirely with nonzero values. \a seed will be updated by this function |
| 54 //! to allow the caller to perform subsequent initialization of the context |
| 55 //! structure containing \a fxsave. |
| 56 //! |
| 57 //! \{ |
| 58 void InitializeCPUContextX86Fxsave( |
| 59 CPUContextX86::Fxsave* fxsave, uint32_t* seed); |
| 60 void InitializeCPUContextX86_64Fxsave( |
| 61 CPUContextX86_64::Fxsave* fxsave, uint32_t* seed); |
| 62 //! \} |
| 63 |
| 64 } // namespace test |
| 65 } // namespace crashpad |
| 66 |
| 67 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_CPU_CONTEXT_H_ |
OLD | NEW |