aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/android/breakpad_getcontext.S4
-rw-r--r--src/common/android/include/elf.h9
-rw-r--r--src/common/android/include/link.h6
-rw-r--r--src/common/android/include/sys/procfs.h4
-rw-r--r--src/common/android/include/sys/ucontext.h13
-rw-r--r--src/common/android/include/sys/user.h5
-rw-r--r--src/common/android/ucontext_constants.h5
-rw-r--r--src/common/linux/memory_mapped_file.cc4
-rw-r--r--src/common/memory.h2
9 files changed, 46 insertions, 6 deletions
diff --git a/src/common/android/breakpad_getcontext.S b/src/common/android/breakpad_getcontext.S
index 13f242d8..849ffaf6 100644
--- a/src/common/android/breakpad_getcontext.S
+++ b/src/common/android/breakpad_getcontext.S
@@ -140,6 +140,10 @@ breakpad_getcontext:
.size breakpad_getcontext, . - breakpad_getcontext
+#elif defined(__aarch64__)
+
+ // TODO(rmcilroy): Implement for arm64.
+
#elif defined(__mips__)
#if _MIPS_SIM != _ABIO32
diff --git a/src/common/android/include/elf.h b/src/common/android/include/elf.h
index af50a799..b2a28df4 100644
--- a/src/common/android/include/elf.h
+++ b/src/common/android/include/elf.h
@@ -38,7 +38,7 @@ extern "C" {
#endif // __cplusplus
// The Android <elf.h> provides BSD-based definitions for the ElfXX_Nhdr
-// types
+// types
// always source-compatible with the GLibc/kernel ones. To overcome this
// issue without modifying a lot of code in Breakpad, use an ugly macro
// renaming trick with #include_next
@@ -110,9 +110,14 @@ typedef struct {
// __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux.
-// All Android platforms are 32-bit for now.
#ifndef __WORDSIZE
+#if defined(__i386__) || defined(__ARM_EABI__) || defined(__mips__)
#define __WORDSIZE 32
+#elif defined(__x86_64__) || defined(__aarch64__)
+#define __WORDSIZE 64
+#else
+#error "Unsupported Android CPU ABI"
+#endif
#endif
// The Android headers don't always define this constant.
diff --git a/src/common/android/include/link.h b/src/common/android/include/link.h
index 6c4e9411..0f5010c0 100644
--- a/src/common/android/include/link.h
+++ b/src/common/android/include/link.h
@@ -34,6 +34,10 @@
Provide custom version here. */
#include_next <link.h>
+// TODO(rmcilroy): Remove this file once the ndk is updated for other
+// architectures - crbug.com/358831
+#if !defined(__aarch64__) && !defined(__x86_64__)
+
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
@@ -61,4 +65,6 @@ struct link_map {
} // extern "C"
#endif // __cplusplus
+#endif // !defined(__aarch64__) && !defined(__x86_64__)
+
#endif /* GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H */
diff --git a/src/common/android/include/sys/procfs.h b/src/common/android/include/sys/procfs.h
index 9cfdd01c..ec65b91c 100644
--- a/src/common/android/include/sys/procfs.h
+++ b/src/common/android/include/sys/procfs.h
@@ -44,7 +44,7 @@
extern "C" {
#endif // __cplusplus
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(__aarch64__)
typedef unsigned long long elf_greg_t;
#else
typedef unsigned long elf_greg_t;
@@ -52,6 +52,8 @@ typedef unsigned long elf_greg_t;
#ifdef __arm__
#define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t))
+#elif defined(__aarch64__)
+#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
#else
#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
#endif
diff --git a/src/common/android/include/sys/ucontext.h b/src/common/android/include/sys/ucontext.h
index 85c69ebd..8bd5877f 100644
--- a/src/common/android/include/sys/ucontext.h
+++ b/src/common/android/include/sys/ucontext.h
@@ -62,6 +62,19 @@ typedef struct ucontext {
// Other fields are not used by Google Breakpad. Don't define them.
} ucontext_t;
+#elif defined(__aarch64__)
+
+#include <asm/sigcontext.h>
+typedef struct sigcontext mcontext_t;
+
+typedef struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext *uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+} ucontext_t;
+
#elif defined(__i386__)
/* 80-bit floating-point register */
diff --git a/src/common/android/include/sys/user.h b/src/common/android/include/sys/user.h
index bc275bbe..257cd803 100644
--- a/src/common/android/include/sys/user.h
+++ b/src/common/android/include/sys/user.h
@@ -75,6 +75,11 @@ struct user_vfpregs {
unsigned long fpscr;
};
+#elif defined(__aarch64__)
+
+// aarch64 does not have user_regs definitions in <asm/user.h>, instead
+// use the definitions in <asm/ptrace.h>, which we don't need to redefine here.
+
#elif defined(__i386__)
#define _I386_USER_H 1 // Prevent <asm/user.h> conflicts
diff --git a/src/common/android/ucontext_constants.h b/src/common/android/ucontext_constants.h
index c99c51fa..87069517 100644
--- a/src/common/android/ucontext_constants.h
+++ b/src/common/android/ucontext_constants.h
@@ -45,6 +45,11 @@
#define MCONTEXT_GREGS_OFFSET 32
#define UCONTEXT_SIGMASK_OFFSET 104
+#elif defined(__aarch64__)
+
+#define MCONTEXT_GREGS_OFFSET 56
+#define UCONTEXT_SIGMASK_OFFSET 40
+
#elif defined(__i386__)
#define MCONTEXT_GREGS_OFFSET 20
diff --git a/src/common/linux/memory_mapped_file.cc b/src/common/linux/memory_mapped_file.cc
index 853cce57..0f0fcb2b 100644
--- a/src/common/linux/memory_mapped_file.cc
+++ b/src/common/linux/memory_mapped_file.cc
@@ -62,7 +62,7 @@ bool MemoryMappedFile::Map(const char* path) {
return false;
}
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__aarch64__)
struct kernel_stat st;
if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
#else
@@ -81,7 +81,7 @@ bool MemoryMappedFile::Map(const char* path) {
return true;
}
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__aarch64__)
void* data = sys_mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
#else
void* data = sys_mmap2(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
diff --git a/src/common/memory.h b/src/common/memory.h
index a4636059..a4cad94c 100644
--- a/src/common/memory.h
+++ b/src/common/memory.h
@@ -110,7 +110,7 @@ class PageAllocator {
private:
uint8_t *GetNPages(size_t num_pages) {
-#ifdef __x86_64
+#if defined(__x86_64__) || defined(__aarch64__)
void *a = sys_mmap(NULL, page_size_ * num_pages, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#else