diff --git a/src/common/android/breakpad_getcontext.S b/src/common/android/breakpad_getcontext.S index b41cb05c..86ef8daf 100644 --- a/src/common/android/breakpad_getcontext.S +++ b/src/common/android/breakpad_getcontext.S @@ -90,6 +90,9 @@ breakpad_getcontext: #elif defined(__aarch64__) +#define _NSIG 64 +#define __NR_rt_sigprocmask 135 + .text .global breakpad_getcontext .hidden breakpad_getcontext diff --git a/src/common/android/breakpad_getcontext_unittest.cc b/src/common/android/breakpad_getcontext_unittest.cc index c1b69c25..14d7927a 100644 --- a/src/common/android/breakpad_getcontext_unittest.cc +++ b/src/common/android/breakpad_getcontext_unittest.cc @@ -33,11 +33,24 @@ #include "common/android/ucontext_constants.h" TEST(AndroidUContext, GRegsOffset) { -#ifdef __arm__ +#if defined(__arm__) // There is no gregs[] array on ARM, so compare to the offset of // first register fields, since they're stored in order. ASSERT_EQ(static_cast(MCONTEXT_GREGS_OFFSET), offsetof(ucontext_t,uc_mcontext.arm_r0)); +#elif defined(__aarch64__) + // There is no gregs[] array on ARM, so compare to the offset of + // first register fields, since they're stored in order. + ASSERT_EQ(static_cast(MCONTEXT_GREGS_OFFSET), + offsetof(ucontext_t,uc_mcontext.regs[0])); + ASSERT_EQ(static_cast(MCONTEXT_SP_OFFSET), + offsetof(ucontext_t,uc_mcontext.sp)); + ASSERT_EQ(static_cast(MCONTEXT_PC_OFFSET), + offsetof(ucontext_t,uc_mcontext.pc)); + ASSERT_EQ(static_cast(MCONTEXT_PSTATE_OFFSET), + offsetof(ucontext_t,uc_mcontext.pstate)); + ASSERT_EQ(static_cast(MCONTEXT_EXTENSION_OFFSET), + offsetof(ucontext_t,uc_mcontext.__reserved)); #elif defined(__i386__) ASSERT_EQ(static_cast(MCONTEXT_GREGS_OFFSET), offsetof(ucontext_t,uc_mcontext.gregs)); diff --git a/src/common/android/include/sys/ucontext.h b/src/common/android/include/sys/ucontext.h index 8bd5877f..bfc22c44 100644 --- a/src/common/android/include/sys/ucontext.h +++ b/src/common/android/include/sys/ucontext.h @@ -72,6 +72,7 @@ typedef struct ucontext { struct ucontext *uc_link; stack_t uc_stack; sigset_t uc_sigmask; + char __padding[128 - sizeof(sigset_t)]; mcontext_t uc_mcontext; } ucontext_t; diff --git a/src/common/android/ucontext_constants.h b/src/common/android/ucontext_constants.h index 4b00ae23..251718c3 100644 --- a/src/common/android/ucontext_constants.h +++ b/src/common/android/ucontext_constants.h @@ -49,11 +49,11 @@ #define UCONTEXT_SIGMASK_OFFSET 40 -#define MCONTEXT_GREGS_OFFSET 56 -#define MCONTEXT_SP_OFFSET 304 -#define MCONTEXT_PC_OFFSET 312 -#define MCONTEXT_PSTATE_OFFSET 320 -#define MCONTEXT_EXTENSION_OFFSET 336 +#define MCONTEXT_GREGS_OFFSET 184 +#define MCONTEXT_SP_OFFSET 432 +#define MCONTEXT_PC_OFFSET 440 +#define MCONTEXT_PSTATE_OFFSET 448 +#define MCONTEXT_EXTENSION_OFFSET 464 #define FPSIMD_MAGIC 0x46508001 @@ -67,9 +67,6 @@ #define REGISTER_SIZE 8 #define SIMD_REGISTER_SIZE 16 -#define _NSIG 64 -#define __NR_rt_sigprocmask 135 - #elif defined(__i386__) #define MCONTEXT_GREGS_OFFSET 20