1 // Copyright (c) 2012, Google Inc.
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
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
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.
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.
30 #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
31 #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
37 // These types are used with ptrace(), more specifically with
38 // PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETVFPREGS respectively.
40 // They are also defined, sometimes with different names, in <asm/user.h>
45 #define _ARM_USER_H 1 // Prevent <asm/user.h> conflicts
47 // Note: on ARM, GLibc uses user_regs instead of user_regs_struct.
49 // Note: Entries 0-15 match r0..r15
50 // Entry 16 is used to store the CPSR register.
51 // Entry 17 is used to store the "orig_r0" value.
52 unsigned long int uregs[18];
55 // Same here: user_fpregs instead of user_fpregs_struct.
59 unsigned int unused:15;
61 unsigned int exponent:14;
63 unsigned int mantissa1:31;
64 unsigned int mantissa0:32;
68 unsigned char ftype[8];
69 unsigned int init_flag;
72 // GLibc doesn't define this one in <sys/user.h> though.
74 unsigned long long fpregs[32];
78 #elif defined(__aarch64__)
80 // aarch64 does not have user_regs definitions in <asm/user.h>, instead
81 // use the definitions in <asm/ptrace.h>, which we don't need to redefine here.
83 #elif defined(__i386__)
85 #define _I386_USER_H 1 // Prevent <asm/user.h> conflicts
87 // GLibc-compatible definitions
88 struct user_regs_struct {
89 long ebx, ecx, edx, esi, edi, ebp, eax;
90 long xds, xes, xfs, xgs, orig_eax;
91 long eip, xcs, eflags, esp, xss;
94 struct user_fpregs_struct {
95 long cwd, swd, twd, fip, fcs, foo, fos;
99 struct user_fpxregs_struct {
100 unsigned short cwd, swd, twd, fop;
101 long fip, fcs, foo, fos, mxcsr, reserved;
108 struct user_regs_struct regs;
110 struct user_fpregs_struct i387;
111 unsigned long u_tsize;
112 unsigned long u_dsize;
113 unsigned long u_ssize;
114 unsigned long start_code;
115 unsigned long start_stack;
118 struct user_regs_struct* u_ar0;
119 struct user_fpregs_struct* u_fpstate;
126 #elif defined(__mips__)
128 #define _ASM_USER_H 1 // Prevent <asm/user.h> conflicts
130 struct user_regs_struct {
131 unsigned long long regs[32];
132 unsigned long long lo;
133 unsigned long long hi;
134 unsigned long long epc;
135 unsigned long long badvaddr;
136 unsigned long long status;
137 unsigned long long cause;
140 struct user_fpregs_struct {
141 unsigned long long regs[32];
146 #elif defined(__x86_64__)
147 #include <sys/types.h>
148 #include_next <sys/user.h>
150 // This struct is essentially the same as user_i387_struct in sys/user.h
151 // except that the struct name and individual field names are chosen here
152 // to match the ones used in breakpad for other x86_64 platforms.
154 struct user_fpregs_struct {
163 __u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
164 __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
169 # error "Unsupported Android CPU ABI"
174 #endif // __cplusplus
176 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H