blob: 90cce80835b8951b44173eb7e75afb7d0e1179c4 [file] [log] [blame]
Elliott Hughese888de82013-11-19 15:32:31 -08001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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 copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#ifndef _SYS_USER_H_
30#define _SYS_USER_H_
31
32#include <sys/cdefs.h>
33
34__BEGIN_DECLS
35
36#if __i386__
37
38struct user_i387_struct {
39 long cwd;
40 long swd;
41 long twd;
42 long fip;
43 long fcs;
44 long foo;
45 long fos;
46 long st_space[20];
47};
48struct user_fxsr_struct {
49 unsigned short cwd;
50 unsigned short swd;
51 unsigned short twd;
52 unsigned short fop;
53 long fip;
54 long fcs;
55 long foo;
56 long fos;
57 long mxcsr;
58 long reserved;
59 long st_space[32];
60 long xmm_space[32];
61 long padding[56];
62};
63struct user_regs_struct {
Elliott Hughesf8b2b3c2014-01-09 14:01:18 -080064 long ebx;
65 long ecx;
66 long edx;
67 long esi;
68 long edi;
69 long ebp;
70 long eax;
71 long xds;
72 long xes;
73 long xfs;
74 long xgs;
75 long orig_eax;
76 long eip;
77 long xcs;
78 long eflags;
79 long esp;
80 long xss;
Elliott Hughese888de82013-11-19 15:32:31 -080081};
Elliott Hughesab797cb2013-11-26 17:57:31 -080082struct user {
Elliott Hughese888de82013-11-19 15:32:31 -080083 struct user_regs_struct regs;
84 int u_fpvalid;
85 struct user_i387_struct i387;
86 unsigned long int u_tsize;
87 unsigned long int u_dsize;
88 unsigned long int u_ssize;
89 unsigned long start_code;
90 unsigned long start_stack;
91 long int signal;
92 int reserved;
93 unsigned long u_ar0;
Elliott Hughesab797cb2013-11-26 17:57:31 -080094 struct user_i387_struct* u_fpstate;
Elliott Hughese888de82013-11-19 15:32:31 -080095 unsigned long magic;
96 char u_comm[32];
97 int u_debugreg[8];
98};
99
100#elif defined(__x86_64__)
101
102struct user_i387_struct {
103 unsigned short cwd;
104 unsigned short swd;
105 unsigned short twd;
106 unsigned short fop;
107 __u64 rip;
108 __u64 rdp;
109 __u32 mxcsr;
110 __u32 mxcsr_mask;
111 __u32 st_space[32];
112 __u32 xmm_space[64];
113 __u32 padding[24];
114};
115struct user_regs_struct {
116 unsigned long r15;
117 unsigned long r14;
118 unsigned long r13;
119 unsigned long r12;
Elliott Hugheseddc8ec2014-01-08 15:54:19 -0800120 unsigned long rbp;
121 unsigned long rbx;
Elliott Hughese888de82013-11-19 15:32:31 -0800122 unsigned long r11;
123 unsigned long r10;
124 unsigned long r9;
125 unsigned long r8;
Elliott Hugheseddc8ec2014-01-08 15:54:19 -0800126 unsigned long rax;
127 unsigned long rcx;
128 unsigned long rdx;
129 unsigned long rsi;
130 unsigned long rdi;
131 unsigned long orig_rax;
132 unsigned long rip;
Elliott Hughese888de82013-11-19 15:32:31 -0800133 unsigned long cs;
Elliott Hugheseddc8ec2014-01-08 15:54:19 -0800134 unsigned long eflags;
135 unsigned long rsp;
Elliott Hughese888de82013-11-19 15:32:31 -0800136 unsigned long ss;
137 unsigned long fs_base;
138 unsigned long gs_base;
139 unsigned long ds;
140 unsigned long es;
141 unsigned long fs;
142 unsigned long gs;
143};
144struct user {
145 struct user_regs_struct regs;
146 int u_fpvalid;
147 int pad0;
148 struct user_i387_struct i387;
149 unsigned long int u_tsize;
150 unsigned long int u_dsize;
151 unsigned long int u_ssize;
152 unsigned long start_code;
153 unsigned long start_stack;
154 long int signal;
155 int reserved;
156 int pad1;
157 unsigned long u_ar0;
Elliott Hughesab797cb2013-11-26 17:57:31 -0800158 struct user_i387_struct* u_fpstate;
Elliott Hughese888de82013-11-19 15:32:31 -0800159 unsigned long magic;
160 char u_comm[32];
161 unsigned long u_debugreg[8];
162 unsigned long error_code;
163 unsigned long fault_address;
164};
165
166#elif defined(__mips__)
167
168struct user {
169 unsigned long regs[180 / sizeof(unsigned long) + 64];
170 size_t u_tsize;
171 size_t u_dsize;
172 size_t u_ssize;
173 unsigned long start_code;
174 unsigned long start_data;
175 unsigned long start_stack;
176 long int signal;
177 unsigned long u_ar0;
178 unsigned long magic;
179 char u_comm[32];
180};
181
Christopher Ferris363390e2013-11-22 18:00:09 -0800182#elif defined(__arm__)
183
Elliott Hughes36144242014-01-30 10:39:02 -0800184struct user_fpregs {
Christopher Ferris363390e2013-11-22 18:00:09 -0800185 struct fp_reg {
186 unsigned int sign1:1;
187 unsigned int unused:15;
188 unsigned int sign2:1;
189 unsigned int exponent:14;
190 unsigned int j:1;
191 unsigned int mantissa1:31;
192 unsigned int mantissa0:32;
193 } fpregs[8];
194 unsigned int fpsr:32;
195 unsigned int fpcr:32;
196 unsigned char ftype[8];
197 unsigned int init_flag;
198};
Elliott Hughes36144242014-01-30 10:39:02 -0800199struct user_regs {
200 unsigned long uregs[18];
201};
Elliott Hughesab797cb2013-11-26 17:57:31 -0800202struct user_vfp {
203 unsigned long long fpregs[32];
204 unsigned long fpscr;
205};
206struct user_vfp_exc {
207 unsigned long fpexc;
208 unsigned long fpinst;
209 unsigned long fpinst2;
210};
211struct user {
Elliott Hughes36144242014-01-30 10:39:02 -0800212 struct user_regs regs;
Christopher Ferris363390e2013-11-22 18:00:09 -0800213 int u_fpvalid;
214 unsigned long int u_tsize;
215 unsigned long int u_dsize;
216 unsigned long int u_ssize;
217 unsigned long start_code;
218 unsigned long start_stack;
219 long int signal;
220 int reserved;
Elliott Hughes36144242014-01-30 10:39:02 -0800221 struct user_regs* u_ar0;
Christopher Ferris363390e2013-11-22 18:00:09 -0800222 unsigned long magic;
223 char u_comm[32];
224 int u_debugreg[8];
Elliott Hughes36144242014-01-30 10:39:02 -0800225 struct user_fpregs u_fp;
226 struct user_fpregs* u_fp0;
Christopher Ferris363390e2013-11-22 18:00:09 -0800227};
228
229#elif defined(__aarch64__)
230
231// There are no user structures for 64 bit arm.
232
Elliott Hughese888de82013-11-19 15:32:31 -0800233#else
234
Christopher Ferris363390e2013-11-22 18:00:09 -0800235#error "Unsupported architecture."
Elliott Hughese888de82013-11-19 15:32:31 -0800236
237#endif
238
239__END_DECLS
240
241#endif /* _SYS_USER_H_ */