michael@0: // Copyright (c) 2012, Google Inc. michael@0: // All rights reserved. michael@0: // michael@0: // Redistribution and use in source and binary forms, with or without michael@0: // modification, are permitted provided that the following conditions are michael@0: // met: michael@0: // michael@0: // * Redistributions of source code must retain the above copyright michael@0: // notice, this list of conditions and the following disclaimer. michael@0: // * Redistributions in binary form must reproduce the above michael@0: // copyright notice, this list of conditions and the following disclaimer michael@0: // in the documentation and/or other materials provided with the michael@0: // distribution. michael@0: // * Neither the name of Google Inc. nor the names of its michael@0: // contributors may be used to endorse or promote products derived from michael@0: // this software without specific prior written permission. michael@0: // michael@0: // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS michael@0: // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT michael@0: // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR michael@0: // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT michael@0: // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@0: // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@0: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, michael@0: // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY michael@0: // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT michael@0: // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE michael@0: // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. michael@0: michael@0: #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H michael@0: #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif // __cplusplus michael@0: michael@0: // These types are used with ptrace(), more specifically with michael@0: // PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETVFPREGS respectively. michael@0: // michael@0: // They are also defined, sometimes with different names, in michael@0: // michael@0: michael@0: #if defined(__arm__) michael@0: michael@0: #define _ARM_USER_H 1 // Prevent conflicts michael@0: michael@0: // Note: on ARM, GLibc uses user_regs instead of user_regs_struct. michael@0: struct user_regs { michael@0: // Note: Entries 0-15 match r0..r15 michael@0: // Entry 16 is used to store the CPSR register. michael@0: // Entry 17 is used to store the "orig_r0" value. michael@0: unsigned long int uregs[18]; michael@0: }; michael@0: michael@0: // Same here: user_fpregs instead of user_fpregs_struct. michael@0: struct user_fpregs { michael@0: struct fp_reg { michael@0: unsigned int sign1:1; michael@0: unsigned int unused:15; michael@0: unsigned int sign2:1; michael@0: unsigned int exponent:14; michael@0: unsigned int j:1; michael@0: unsigned int mantissa1:31; michael@0: unsigned int mantissa0:32; michael@0: } fpregs[8]; michael@0: unsigned int fpsr:32; michael@0: unsigned int fpcr:32; michael@0: unsigned char ftype[8]; michael@0: unsigned int init_flag; michael@0: }; michael@0: michael@0: // GLibc doesn't define this one in though. michael@0: struct user_vfpregs { michael@0: unsigned long long fpregs[32]; michael@0: unsigned long fpscr; michael@0: }; michael@0: michael@0: #elif defined(__i386__) michael@0: michael@0: #define _I386_USER_H 1 // Prevent conflicts michael@0: michael@0: // GLibc-compatible definitions michael@0: struct user_regs_struct { michael@0: long ebx, ecx, edx, esi, edi, ebp, eax; michael@0: long xds, xes, xfs, xgs, orig_eax; michael@0: long eip, xcs, eflags, esp, xss; michael@0: }; michael@0: michael@0: struct user_fpregs_struct { michael@0: long cwd, swd, twd, fip, fcs, foo, fos; michael@0: long st_space[20]; michael@0: }; michael@0: michael@0: struct user_fpxregs_struct { michael@0: unsigned short cwd, swd, twd, fop; michael@0: long fip, fcs, foo, fos, mxcsr, reserved; michael@0: long st_space[32]; michael@0: long xmm_space[32]; michael@0: long padding[56]; michael@0: }; michael@0: michael@0: struct user { michael@0: struct user_regs_struct regs; michael@0: int u_fpvalid; michael@0: struct user_fpregs_struct i387; michael@0: unsigned long u_tsize; michael@0: unsigned long u_dsize; michael@0: unsigned long u_ssize; michael@0: unsigned long start_code; michael@0: unsigned long start_stack; michael@0: long signal; michael@0: int reserved; michael@0: struct user_regs_struct* u_ar0; michael@0: struct user_fpregs_struct* u_fpstate; michael@0: unsigned long magic; michael@0: char u_comm [32]; michael@0: int u_debugreg [8]; michael@0: }; michael@0: michael@0: michael@0: #elif defined(__mips__) michael@0: michael@0: // TODO: Provide some useful definitions here, once the rest of Breakpad michael@0: // requires them. michael@0: michael@0: #else michael@0: # error "Unsupported Android CPU ABI" michael@0: #endif michael@0: michael@0: #ifdef __cplusplus michael@0: } // extern "C" michael@0: #endif // __cplusplus michael@0: michael@0: #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H