Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, Google Inc. | 1 // Copyright (c) 2012, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H | 30 #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H |
| 31 #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H | 31 #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H |
| 32 | 32 |
| 33 // The purpose of this file is to glue the mismatching headers (Android NDK vs | 33 // The purpose of this file is to glue the mismatching headers (Android NDK vs |
| 34 // glibc) and therefore avoid doing otherwise awkward #ifdefs in the code. | 34 // glibc) and therefore avoid doing otherwise awkward #ifdefs in the code. |
| 35 // The following quirks are currently handled by this file: | 35 // The following quirks are currently handled by this file: |
| 36 // - i386: Use the Android NDK but alias user_fxsr_struct > user_fpxregs_struct. | 36 // - i386: Use the Android NDK but alias user_fxsr_struct > user_fpxregs_struct. |
| 37 // - x86_64: Override a typo in user_fpregs_struct (mxcsr_mask -> mxcr_mask). | 37 // - aarch64: Add missing user_regs_struct and user_fpsimd_struct structs. |
| 38 // The typo has been fixed in NDK r10d, but a preprocessor workaround is | |
| 39 // required to make breakpad build with r10c and lower (more details below). | |
| 40 // - Other platforms: Just use the Android NDK unchanged. | 38 // - Other platforms: Just use the Android NDK unchanged. |
| 41 | 39 |
| 42 // TODO(primiano): remove this after Chromium has stably rolled to NDK r10d. | 40 // TODO(primiano): remove these changes after Chromium has stably rolled to |
| 43 // Historical context: NDK releases < r10d had a typo in sys/user.h (mxcsr_mask | 41 // an NDK with the appropriate fixes. |
| 44 // instead of mxcr_mask), which is fixed in r10d. However, just switching to use | |
| 45 // the correct one (mxcr_mask) would put Breakpad in a state where it can be | |
| 46 // rolled in chromium only atomically with the r10d NDK. A revert of either | |
| 47 // project (android_tools, breakpad) would make the other one unrollable. | |
| 48 // This hack makes breakpad code compatible with both r10c and r10d NDKs, | |
| 49 // reducing the dependency entangling with android_tools. | |
| 50 #if defined(__x86_64__) | |
| 51 #define mxcsr_mask mxcr_mask | |
| 52 #endif | |
| 53 | 42 |
| 54 #include_next <sys/user.h> | 43 #include_next <sys/user.h> |
| 55 | 44 |
| 56 #if defined(__x86_64__) | |
| 57 #undef mxcsr_mask | |
| 58 #endif | |
| 59 | |
| 60 #ifdef __i386__ | 45 #ifdef __i386__ |
| 61 #ifdef __cplusplus | 46 #ifdef __cplusplus |
| 62 extern "C" { | 47 extern "C" { |
| 63 #endif // __cplusplus | 48 #endif // __cplusplus |
| 64 typedef struct user_fxsr_struct user_fpxregs_struct; | 49 typedef struct user_fxsr_struct user_fpxregs_struct; |
| 65 #ifdef __cplusplus | 50 #ifdef __cplusplus |
| 66 } // extern "C" | 51 } // extern "C" |
| 67 #endif // __cplusplus | 52 #endif // __cplusplus |
| 68 #endif // __i386__ | 53 #endif // __i386__ |
| 69 | 54 |
| 55 #ifdef __aarch64__ | |
| 56 struct user_regs_struct { | |
|
Primiano Tucci (use gerrit)
2015/08/20 14:25:09
Shouldn't these be guarded by a ifdef cplusplus +
rmcilroy
2015/08/20 14:29:03
Yup, thanks! Done.
| |
| 57 __u64 regs[31]; | |
| 58 __u64 sp; | |
| 59 __u64 pc; | |
| 60 __u64 pstate; | |
| 61 }; | |
| 62 | |
| 63 struct user_fpsimd_struct { | |
| 64 __uint128_t vregs[32]; | |
| 65 __u32 fpsr; | |
| 66 __u32 fpcr; | |
| 67 }; | |
| 68 #endif // __aarch64__ | |
| 69 | |
| 70 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H | 70 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H |
| OLD | NEW |