diff options
author | rmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-04-09 09:08:19 +0000 |
---|---|---|
committer | rmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-04-09 09:08:19 +0000 |
commit | 543cf832e620a38baec38dac018b11daaf147593 (patch) | |
tree | eca4aad7786daded56d9a91544981fc5d239c516 /src/common/android | |
parent | Add Arm64 support to breakpad unittests. (diff) | |
download | breakpad-543cf832e620a38baec38dac018b11daaf147593.tar.xz |
Fix aarch64 ucontext layout on Android
BUG=354405,335641
R=mark@chromium.org
Review URL: https://breakpad.appspot.com/1444002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1306 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/android')
-rw-r--r-- | src/common/android/breakpad_getcontext.S | 3 | ||||
-rw-r--r-- | src/common/android/breakpad_getcontext_unittest.cc | 15 | ||||
-rw-r--r-- | src/common/android/include/sys/ucontext.h | 1 | ||||
-rw-r--r-- | src/common/android/ucontext_constants.h | 13 |
4 files changed, 23 insertions, 9 deletions
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<size_t>(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<size_t>(MCONTEXT_GREGS_OFFSET), + offsetof(ucontext_t,uc_mcontext.regs[0])); + ASSERT_EQ(static_cast<size_t>(MCONTEXT_SP_OFFSET), + offsetof(ucontext_t,uc_mcontext.sp)); + ASSERT_EQ(static_cast<size_t>(MCONTEXT_PC_OFFSET), + offsetof(ucontext_t,uc_mcontext.pc)); + ASSERT_EQ(static_cast<size_t>(MCONTEXT_PSTATE_OFFSET), + offsetof(ucontext_t,uc_mcontext.pstate)); + ASSERT_EQ(static_cast<size_t>(MCONTEXT_EXTENSION_OFFSET), + offsetof(ucontext_t,uc_mcontext.__reserved)); #elif defined(__i386__) ASSERT_EQ(static_cast<size_t>(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 |