| 1 | // Copyright (c) 2012, Google Inc. |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Redistribution and use in source and binary forms, with or without |
| 5 | // modification, are permitted provided that the following conditions are |
| 6 | // met: |
| 7 | // |
| 8 | // * Redistributions of source code must retain the above copyright |
| 9 | // notice, this list of conditions and the following disclaimer. |
| 10 | // * Redistributions in binary form must reproduce the above |
| 11 | // copyright notice, this list of conditions and the following disclaimer |
| 12 | // in the documentation and/or other materials provided with the |
| 13 | // distribution. |
| 14 | // * Neither the name of Google Inc. nor the names of its |
| 15 | // contributors may be used to endorse or promote products derived from |
| 16 | // this software without specific prior written permission. |
| 17 | // |
| 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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. |
| 29 | |
| 30 | #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H |
| 31 | #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H |
| 32 | |
| 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. |
| 35 | // The following quirks are currently handled by this file: |
| 36 | // - i386: Use the Android NDK but alias user_fxsr_struct > user_fpxregs_struct. |
| 37 | // - aarch64: Add missing user_regs_struct and user_fpsimd_struct structs. |
| 38 | // - Other platforms: Just use the Android NDK unchanged. |
| 39 | |
| 40 | // TODO(primiano): remove these changes after Chromium has stably rolled to |
| 41 | // an NDK with the appropriate fixes. |
| 42 | |
| 43 | #include_next <sys/user.h> |
| 44 | |
| 45 | #ifdef __i386__ |
| 46 | #ifdef __cplusplus |
| 47 | extern "C" { |
| 48 | #endif // __cplusplus |
| 49 | typedef struct user_fxsr_struct user_fpxregs_struct; |
| 50 | #ifdef __cplusplus |
| 51 | } // extern "C" |
| 52 | #endif // __cplusplus |
| 53 | #endif // __i386__ |
| 54 | |
| 55 | #ifdef __aarch64__ |
| 56 | #ifdef __cplusplus |
| 57 | extern "C" { |
| 58 | #endif // __cplusplus |
| 59 | struct user_regs_struct { |
| 60 | __u64 regs[31]; |
| 61 | __u64 sp; |
| 62 | __u64 pc; |
| 63 | __u64 pstate; |
| 64 | }; |
| 65 | struct user_fpsimd_struct { |
| 66 | __uint128_t vregs[32]; |
| 67 | __u32 fpsr; |
| 68 | __u32 fpcr; |
| 69 | }; |
| 70 | #ifdef __cplusplus |
| 71 | } // extern "C" |
| 72 | #endif // __cplusplus |
| 73 | #endif // __aarch64__ |
| 74 | |
| 75 | #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H |
| 76 | |