diff options
author | rmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-04-02 23:12:40 +0000 |
---|---|---|
committer | rmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-04-02 23:12:40 +0000 |
commit | 83b9a28cf94979f9b6c33f492a4072766eff3e6e (patch) | |
tree | e43731eb28abb4b5d192e20efb9286de01dfe927 /src/common | |
parent | Remove some unecessary Android system header definitions. (diff) | |
download | breakpad-83b9a28cf94979f9b6c33f492a4072766eff3e6e.tar.xz |
First cut at adding arm64 Linux / Android support to Breakpad.
This is an initial attempt to add Arm64 (aarch64) support to Breakpad for
Linux / Android platforms. This CL adds the Arm64 data structures, but does
not yet implement the Android getcontext support or CPUFillFromThreadInfo /
CPUFillFromUContext.
BUG=354405,335641
R=mark@chromium.org
Review URL: https://breakpad.appspot.com/1354002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1301 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/android/breakpad_getcontext.S | 4 | ||||
-rw-r--r-- | src/common/android/include/elf.h | 9 | ||||
-rw-r--r-- | src/common/android/include/link.h | 6 | ||||
-rw-r--r-- | src/common/android/include/sys/procfs.h | 4 | ||||
-rw-r--r-- | src/common/android/include/sys/ucontext.h | 13 | ||||
-rw-r--r-- | src/common/android/include/sys/user.h | 5 | ||||
-rw-r--r-- | src/common/android/ucontext_constants.h | 5 | ||||
-rw-r--r-- | src/common/linux/memory_mapped_file.cc | 4 | ||||
-rw-r--r-- | src/common/memory.h | 2 |
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 |