summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-04-15 11:12:03 -0700
committerDave Watson <davejwatson@fb.com>2017-01-24 11:08:28 -0800
commitcf6382643efd133e617c2cf1dba7e53868ccd690 (patch)
treed2c10a886ca59feac7b6af8cddb0bc4ca120e89b /include
parentd9797d9562e1e011193cda67f0dd3c1723624658 (diff)
downloadlibunwind-cf6382643efd133e617c2cf1dba7e53868ccd690.tar.gz
Add aarch64 getcontext functionality.
Change-Id: I32912a85c0fd02bb5e45a9eb7deb2410ded352a9
Diffstat (limited to 'include')
-rw-r--r--include/libunwind-aarch64.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/libunwind-aarch64.h b/include/libunwind-aarch64.h
index cd01e578..fe9e83d7 100644
--- a/include/libunwind-aarch64.h
+++ b/include/libunwind-aarch64.h
@@ -175,8 +175,31 @@ typedef ucontext_t unw_tdep_context_t;
#include "libunwind-common.h"
#include "libunwind-dynamic.h"
-#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
-#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+#define unw_tdep_getcontext(uc) (({ \
+ unw_tdep_context_t *unw_ctx = (uc); \
+ register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \
+ __asm__ __volatile__ ( \
+ "stp x0, x1, [%[base], #0]\n" \
+ "stp x2, x3, [%[base], #16]\n" \
+ "stp x4, x5, [%[base], #32]\n" \
+ "stp x6, x7, [%[base], #48]\n" \
+ "stp x8, x9, [%[base], #64]\n" \
+ "stp x10, x11, [%[base], #80]\n" \
+ "stp x12, x13, [%[base], #96]\n" \
+ "stp x14, x13, [%[base], #112]\n" \
+ "stp x16, x17, [%[base], #128]\n" \
+ "stp x18, x19, [%[base], #144]\n" \
+ "stp x20, x21, [%[base], #160]\n" \
+ "stp x22, x23, [%[base], #176]\n" \
+ "stp x24, x25, [%[base], #192]\n" \
+ "stp x26, x27, [%[base], #208]\n" \
+ "stp x28, x29, [%[base], #224]\n" \
+ "str x30, [%[base], #240]\n" \
+ "mov x1, sp\n" \
+ "stp x1, x30, [%[base], #248]\n" \
+ : [base] "+r" (unw_base) : : "x1", "memory"); \
+ }), 0)
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
extern int unw_tdep_is_fpreg (int);