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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 //! a state-carrying behavior. | 192 //! a state-carrying behavior. |
193 //! | 193 //! |
194 //! \return `KERN_SUCCESS` or `MACH_RCV_PORT_DIED`. `KERN_SUCCESS` is used when | 194 //! \return `KERN_SUCCESS` or `MACH_RCV_PORT_DIED`. `KERN_SUCCESS` is used when |
195 //! \a behavior is not a state-carrying behavior, or when it is a | 195 //! \a behavior is not a state-carrying behavior, or when it is a |
196 //! state-carrying behavior and \a set_thread_state is `true`. | 196 //! state-carrying behavior and \a set_thread_state is `true`. |
197 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying | 197 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying |
198 //! behavior and \a set_thread_state is `false`. | 198 //! behavior and \a set_thread_state is `false`. |
199 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, | 199 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, |
200 bool set_thread_state); | 200 bool set_thread_state); |
201 | 201 |
| 202 //! \brief Copies the old state to the new state for state-carrying exceptions. |
| 203 //! |
| 204 //! When the kernel sends a state-carrying exception request and the response is |
| 205 //! successful (`MACH_MSG_SUCCESS`, a synonym for `KERN_SUCCESS`), it will set |
| 206 //! a new thread state based on \a new_state and \a new_state_count. To ease |
| 207 //! initialization of the new state, this function copies \a old_state and |
| 208 //! \a old_state_count. This is only done if \a behavior indicates a |
| 209 //! state-carrying exception. |
| 210 //! |
| 211 //! \param[in] behavior The behavior of the exception handler as invoked. This |
| 212 //! may be taken directly from the \a behavior parameter of |
| 213 //! internal::SimplifiedExcServer::Interface::CatchException(), for example. |
| 214 //! \param[in] old_state The original state value. This may be taken directly |
| 215 //! from the \a old_state parameter of |
| 216 //! internal::SimplifiedExcServer::Interface::CatchException(), for example. |
| 217 //! \param[in] old_state_count The number of significant `natural_t` words in \a |
| 218 //! old_state. This may be taken directly from the \a old_state_count |
| 219 //! parameter of internal::SimplifiedExcServer::Interface::CatchException(), |
| 220 //! for example. |
| 221 //! \param[out] new_state The state value to be set. This may be taken directly |
| 222 //! from the \a new_state parameter of |
| 223 //! internal::SimplifiedExcServer::Interface::CatchException(), for example. |
| 224 //! This parameter is untouched if \a behavior is not state-carrying. |
| 225 //! \param[inout] new_state_count On entry, the number of `natural_t` words |
| 226 //! available to be written to in \a new_state. On return, the number of |
| 227 //! significant `natural_t` words in \a new_state. This may be taken |
| 228 //! directly from the \a new_state_count parameter of |
| 229 //! internal::SimplifiedExcServer::Interface::CatchException(), for example. |
| 230 //! This parameter is untouched if \a behavior is not state-carrying. If \a |
| 231 //! \a behavior is state-carrying, this parameter should be at least as |
| 232 //! large as \a old_state_count. |
| 233 void ExcServerCopyState(exception_behavior_t behavior, |
| 234 const natural_t* old_state, |
| 235 mach_msg_type_number_t old_state_count, |
| 236 thread_state_t new_state, |
| 237 mach_msg_type_number_t* new_state_count); |
| 238 |
202 } // namespace crashpad | 239 } // namespace crashpad |
203 | 240 |
204 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ | 241 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ |
OLD | NEW |