blob: b156800ad5e06beb04a631763d7b27a60bb339a7 [file] [log] [blame]
Anestis Bechtsoudiscfc39fb2015-08-06 10:31:36 +03001--- libunwind/include/libunwind-aarch64.h 2015-08-03 19:24:10.000000000 +0300
2+++ patches/libunwind-aarch64.h 2015-08-05 05:22:46.000000000 +0300
3@@ -168,15 +168,37 @@
4 }
5 unw_tdep_save_loc_t;
6
7-
8 /* On AArch64, we can directly use ucontext_t as the unwind context. */
9 typedef ucontext_t unw_tdep_context_t;
10
11 #include "libunwind-common.h"
12 #include "libunwind-dynamic.h"
13
14-#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
15-#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
16+/* There is no getcontext in Android. */
17+#define unw_tdep_getcontext(uc) (({ \
18+ unw_tdep_context_t *unw_ctx = (uc); \
19+ register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \
20+ __asm__ __volatile__ ( \
21+ "stp x0, x1, [%[base], #0]\n" \
22+ "stp x2, x3, [%[base], #16]\n" \
23+ "stp x4, x5, [%[base], #32]\n" \
24+ "stp x6, x7, [%[base], #48]\n" \
25+ "stp x8, x9, [%[base], #64]\n" \
26+ "stp x10, x11, [%[base], #80]\n" \
27+ "stp x12, x13, [%[base], #96]\n" \
28+ "stp x14, x13, [%[base], #112]\n" \
29+ "stp x16, x17, [%[base], #128]\n" \
30+ "stp x18, x19, [%[base], #144]\n" \
31+ "stp x20, x21, [%[base], #160]\n" \
32+ "stp x22, x23, [%[base], #176]\n" \
33+ "stp x24, x25, [%[base], #192]\n" \
34+ "stp x26, x27, [%[base], #208]\n" \
35+ "stp x28, x29, [%[base], #224]\n" \
36+ "str x30, [%[base], #240]\n" \
37+ "mov x1, sp\n" \
38+ "stp x1, x30, [%[base], #248]\n" \
39+ : [base] "+r" (unw_base) : : "x1", "memory"); \
40+ }), 0)
41
42 extern int unw_tdep_is_fpreg (int);
43