|
12 | 12 | //
|
13 | 13 | //===----------------------------------------------------------------------===//
|
14 | 14 |
|
| 15 | +// ARM EHABI does not specify _Unwind_{Get,Set}{GR,IP}(). Thus, we are |
| 16 | +// defining inline functions to delegate the function calls to |
| 17 | +// _Unwind_VRS_{Get,Set}(). However, some applications might declare the |
| 18 | +// function protetype directly (instead of including <unwind.h>), thus we need |
| 19 | +// to export these functions from libunwind.so as well. |
| 20 | +#define _LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE 1 |
| 21 | + |
15 | 22 | #include <inttypes.h>
|
16 | 23 | #include <stdint.h>
|
17 | 24 | #include <stdbool.h>
|
@@ -496,39 +503,4 @@ _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
|
496 | 503 | unw_set_reg(cursor, UNW_REG_IP, value);
|
497 | 504 | }
|
498 | 505 |
|
499 |
| -#else |
500 |
| - |
501 |
| -_LIBUNWIND_EXPORT uintptr_t |
502 |
| -_Unwind_GetGR(struct _Unwind_Context *context, int index) { |
503 |
| - uintptr_t value = 0; |
504 |
| - _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value); |
505 |
| - _LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d) => 0x%" PRIx64 "\n", |
506 |
| - (void *)context, index, (uint64_t)value); |
507 |
| - return value; |
508 |
| -} |
509 |
| - |
510 |
| -_LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index, |
511 |
| - uintptr_t value) { |
512 |
| - _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0"PRIx64")\n", |
513 |
| - (void *)context, index, (uint64_t)value); |
514 |
| - _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value); |
515 |
| -} |
516 |
| - |
517 |
| -_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) { |
518 |
| - // remove the thumb-bit before returning |
519 |
| - uintptr_t value = _Unwind_GetGR(context, 15) & (~(uintptr_t)0x1); |
520 |
| - _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIx64 "\n", |
521 |
| - (void *)context, (uint64_t)value); |
522 |
| - return value; |
523 |
| -} |
524 |
| - |
525 |
| -_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context, |
526 |
| - uintptr_t value) { |
527 |
| - _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0" PRIx64 ")\n", |
528 |
| - (void *)context, (uint64_t)value); |
529 |
| - uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1); |
530 |
| - _Unwind_SetGR(context, 15, value | thumb_bit); |
531 |
| -} |
532 |
| - |
533 | 506 | #endif // !_LIBUNWIND_ARM_EHABI
|
534 |
| - |
0 commit comments