aboutsummaryrefslogtreecommitdiff
path: root/src/common/android
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org>2014-10-24 10:58:38 +0000
committerprimiano@chromium.org <primiano@chromium.org>2014-10-24 10:58:38 +0000
commite20758c2988bf1923d1d2d6cd3e2d2d73c6980cb (patch)
treeeee538a36e54bca9ff42eab5ab131cce7056009f /src/common/android
parentUpdate breakpad to support Android NDK r10c (diff)
downloadbreakpad-e20758c2988bf1923d1d2d6cd3e2d2d73c6980cb.tar.xz
Fix breakpad on mips and x86_64 for the NDK r10c update.
This change introduces the necessary glue typedefs to deal with the mismatch introduced by the latest Android NDK (w.r.t. desktop Linux): - [x86_64] Rename fpregs mxcr_mask -> .mxcsr_mask - [mips] uc_mcontext.fpregs.fp_r.fp_dregs -> uc_mcontext.fpreg - [mips] restore the forked user.h Submitting this on behalf of fdegans@chromium.org TBR=mark@chromium.org git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1397 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/android')
-rw-r--r--src/common/android/include/sys/user.h88
-rw-r--r--src/common/android/ucontext_constants.h2
2 files changed, 87 insertions, 3 deletions
diff --git a/src/common/android/include/sys/user.h b/src/common/android/include/sys/user.h
index 4a79ba05..d41a82cb 100644
--- a/src/common/android/include/sys/user.h
+++ b/src/common/android/include/sys/user.h
@@ -30,9 +30,91 @@
#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
+// The purpose of this file is to glue the mismatching headers (Android NDK vs
+// glibc) and therefore avoid doing otherwise awkward #ifdefs in the code.
+// The following quirks are currently handled by this file:
+// - MIPS: Keep using forked definitions of user.h structs. The definition in
+// the NDK is completely different.
+// Internal bug b/18097715
+// - i386: Use the Android NDK but alias user_fxsr_struct > user_fpxregs_struct.
+// - Other platforms: Just use the Android NDK unchanged.
+
+#ifdef __mips__
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#define EF_REG0 6
+#define EF_REG1 7
+#define EF_REG2 8
+#define EF_REG3 9
+#define EF_REG4 10
+#define EF_REG5 11
+#define EF_REG6 12
+#define EF_REG7 13
+#define EF_REG8 14
+#define EF_REG9 15
+#define EF_REG10 16
+#define EF_REG11 17
+#define EF_REG12 18
+#define EF_REG13 19
+#define EF_REG14 20
+#define EF_REG15 21
+#define EF_REG16 22
+#define EF_REG17 23
+#define EF_REG18 24
+#define EF_REG19 25
+#define EF_REG20 26
+#define EF_REG21 27
+#define EF_REG22 28
+#define EF_REG23 29
+#define EF_REG24 30
+#define EF_REG25 31
+
+/*
+ * k0/k1 unsaved
+ */
+#define EF_REG26 32
+#define EF_REG27 33
+#define EF_REG28 34
+#define EF_REG29 35
+#define EF_REG30 36
+#define EF_REG31 37
+
+/*
+ * Saved special registers
+ */
+#define EF_LO 38
+#define EF_HI 39
+#define EF_CP0_EPC 40
+#define EF_CP0_BADVADDR 41
+#define EF_CP0_STATUS 42
+#define EF_CP0_CAUSE 43
+
+struct user_regs_struct {
+ unsigned long long regs[32];
+ unsigned long long lo;
+ unsigned long long hi;
+ unsigned long long epc;
+ unsigned long long badvaddr;
+ unsigned long long status;
+ unsigned long long cause;
+};
+
+struct user_fpregs_struct {
+ unsigned long long regs[32];
+ unsigned int fpcsr;
+ unsigned int fir;
+};
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#else // __mips__
+
#include_next <sys/user.h>
-// This struct is defined under a different name in the Android NDK.
#ifdef __i386__
#ifdef __cplusplus
extern "C" {
@@ -41,6 +123,8 @@ typedef struct user_fxsr_struct user_fpxregs_struct;
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
-#endif // __i386__
+#endif // __i386__
+
+#endif // __mips__
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
diff --git a/src/common/android/ucontext_constants.h b/src/common/android/ucontext_constants.h
index 07968052..e39f0234 100644
--- a/src/common/android/ucontext_constants.h
+++ b/src/common/android/ucontext_constants.h
@@ -126,7 +126,7 @@
#define MCONTEXT_GREGS_RSP 160
#define MCONTEXT_GREGS_RIP 168
#define MCONTEXT_FPREGS_PTR 224
-#define MCONTEXT_FPREGS_MEM 448
+#define MCONTEXT_FPREGS_MEM 304
#define FPREGS_OFFSET_MXCSR 24
#else