|
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 #ifdef __cplusplus |
|
34 extern "C" { |
|
35 #endif // __cplusplus |
|
36 |
|
37 // These types are used with ptrace(), more specifically with |
|
38 // PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETVFPREGS respectively. |
|
39 // |
|
40 // They are also defined, sometimes with different names, in <asm/user.h> |
|
41 // |
|
42 |
|
43 #if defined(__arm__) |
|
44 |
|
45 #define _ARM_USER_H 1 // Prevent <asm/user.h> conflicts |
|
46 |
|
47 // Note: on ARM, GLibc uses user_regs instead of user_regs_struct. |
|
48 struct user_regs { |
|
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]; |
|
53 }; |
|
54 |
|
55 // Same here: user_fpregs instead of user_fpregs_struct. |
|
56 struct user_fpregs { |
|
57 struct fp_reg { |
|
58 unsigned int sign1:1; |
|
59 unsigned int unused:15; |
|
60 unsigned int sign2:1; |
|
61 unsigned int exponent:14; |
|
62 unsigned int j:1; |
|
63 unsigned int mantissa1:31; |
|
64 unsigned int mantissa0:32; |
|
65 } fpregs[8]; |
|
66 unsigned int fpsr:32; |
|
67 unsigned int fpcr:32; |
|
68 unsigned char ftype[8]; |
|
69 unsigned int init_flag; |
|
70 }; |
|
71 |
|
72 // GLibc doesn't define this one in <sys/user.h> though. |
|
73 struct user_vfpregs { |
|
74 unsigned long long fpregs[32]; |
|
75 unsigned long fpscr; |
|
76 }; |
|
77 |
|
78 #elif defined(__i386__) |
|
79 |
|
80 #define _I386_USER_H 1 // Prevent <asm/user.h> conflicts |
|
81 |
|
82 // GLibc-compatible definitions |
|
83 struct user_regs_struct { |
|
84 long ebx, ecx, edx, esi, edi, ebp, eax; |
|
85 long xds, xes, xfs, xgs, orig_eax; |
|
86 long eip, xcs, eflags, esp, xss; |
|
87 }; |
|
88 |
|
89 struct user_fpregs_struct { |
|
90 long cwd, swd, twd, fip, fcs, foo, fos; |
|
91 long st_space[20]; |
|
92 }; |
|
93 |
|
94 struct user_fpxregs_struct { |
|
95 unsigned short cwd, swd, twd, fop; |
|
96 long fip, fcs, foo, fos, mxcsr, reserved; |
|
97 long st_space[32]; |
|
98 long xmm_space[32]; |
|
99 long padding[56]; |
|
100 }; |
|
101 |
|
102 struct user { |
|
103 struct user_regs_struct regs; |
|
104 int u_fpvalid; |
|
105 struct user_fpregs_struct i387; |
|
106 unsigned long u_tsize; |
|
107 unsigned long u_dsize; |
|
108 unsigned long u_ssize; |
|
109 unsigned long start_code; |
|
110 unsigned long start_stack; |
|
111 long signal; |
|
112 int reserved; |
|
113 struct user_regs_struct* u_ar0; |
|
114 struct user_fpregs_struct* u_fpstate; |
|
115 unsigned long magic; |
|
116 char u_comm [32]; |
|
117 int u_debugreg [8]; |
|
118 }; |
|
119 |
|
120 |
|
121 #elif defined(__mips__) |
|
122 |
|
123 // TODO: Provide some useful definitions here, once the rest of Breakpad |
|
124 // requires them. |
|
125 |
|
126 #else |
|
127 # error "Unsupported Android CPU ABI" |
|
128 #endif |
|
129 |
|
130 #ifdef __cplusplus |
|
131 } // extern "C" |
|
132 #endif // __cplusplus |
|
133 |
|
134 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H |