1 //===------------------------- Unwind-EHABI.hpp ---------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef __UNWIND_EHABI_H__
12 #define __UNWIND_EHABI_H__
13 
14 #include <__cxxabi_config.h>
15 
16 #if LIBCXXABI_ARM_EHABI
17 
18 #include <stdint.h>
19 #include <unwind.h>
20 
21 // Unable to unwind in the ARM index table (section 5 EHABI).
22 #define UNW_EXIDX_CANTUNWIND 0x1
23 
signExtendPrel31(uint32_t data)24 static inline uint32_t signExtendPrel31(uint32_t data) {
25   return data | ((data & 0x40000000u) << 1);
26 }
27 
readPrel31(const uint32_t * data)28 static inline uint32_t readPrel31(const uint32_t *data) {
29   return (((uint32_t)(uintptr_t)data) + signExtendPrel31(*data));
30 }
31 
32 #if defined(__cplusplus)
33 extern "C" {
34 #endif
35 
36 extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr0(
37     _Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
38 
39 extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr1(
40     _Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
41 
42 extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr2(
43     _Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
44 
45 #if defined(__cplusplus)
46 } // extern "C"
47 #endif
48 
49 #endif // LIBCXXABI_ARM_EHABI
50 
51 #endif  // __UNWIND_EHABI_H__
52