diff options
author | Jameson Nash <vtjnash@gmail.com> | 2020-12-15 16:14:00 -0500 |
---|---|---|
committer | Dave Watson <dade.watson@gmail.com> | 2020-12-17 13:45:45 -0800 |
commit | 535f86a7c8b2345a1d50259673e88ee806108c2e (patch) | |
tree | 6c70d3ad9baae360349bd103aacbd3773f846d22 | |
parent | 3f7ab0b7ca447e5038fd2050c0c660f88125e7b0 (diff) | |
download | libunwind-535f86a7c8b2345a1d50259673e88ee806108c2e.tar.gz |
fix aarch64 getcontext functionality
Previously the PC value was being set to the LR instead, causing many
tests to fail.
-rw-r--r-- | include/libunwind-aarch64.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/libunwind-aarch64.h b/include/libunwind-aarch64.h index 993d505a..d8a451e6 100644 --- a/include/libunwind-aarch64.h +++ b/include/libunwind-aarch64.h @@ -224,10 +224,10 @@ typedef ucontext_t unw_tdep_context_t; #include "libunwind-common.h" #include "libunwind-dynamic.h" -#define unw_tdep_getcontext(uc) (({ \ +#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__ ( \ + 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" \ @@ -243,11 +243,14 @@ typedef ucontext_t unw_tdep_context_t; "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" \ + "stp x30, x1, [%[base], #240]\n" \ + "adr x1, ret%=\n" \ + "str x1, [%[base], #256]\n" \ + "mov %[base], #0\n" \ + "ret%=:\n" \ : [base] "+r" (unw_base) : : "x1", "memory"); \ - }), 0) + (int)unw_base; }) #define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); |