1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef __UNWIND_EHABI_H__
11#define __UNWIND_EHABI_H__
12
13#include <__libunwind_config.h>
14
15#if defined(_LIBUNWIND_ARM_EHABI)
16
17#include <stdint.h>
18#include <unwind.h>
19
20// Unable to unwind in the ARM index table (section 5 EHABI).
21#define UNW_EXIDX_CANTUNWIND 0x1
22
23static inline uint32_t signExtendPrel31(uint32_t data) {
24 return data | ((data & 0x40000000u) << 1);
25}
26
27static inline uint32_t readPrel31(const uint32_t *data) {
28 return (((uint32_t)(uintptr_t)data) + signExtendPrel31(*data));
29}
30
31#if defined(__cplusplus)
32extern "C" {
33#endif
34
35extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr0(
36 _Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
37
38extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr1(
39 _Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
40
41extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr2(
42 _Unwind_State state, _Unwind_Control_Block *ucbp, _Unwind_Context *context);
43
44#if defined(__cplusplus)
45} // extern "C"
46#endif
47
48#endif // defined(_LIBUNWIND_ARM_EHABI)
49
50#endif // __UNWIND_EHABI_H__
51