1 #ifndef MIPS_TARGET_SYSCALL_H
2 #define MIPS_TARGET_SYSCALL_H
3 
4 /* this struct defines the way the registers are stored on the
5    stack during a system call. */
6 
7 struct target_pt_regs {
8 	/* Pad bytes for argument save space on the stack. */
9 	abi_ulong pad0[6];
10 
11 	/* Saved main processor registers. */
12 	abi_ulong regs[32];
13 
14 	/* Saved special registers. */
15 	abi_ulong cp0_status;
16 	abi_ulong lo;
17 	abi_ulong hi;
18 	abi_ulong cp0_badvaddr;
19 	abi_ulong cp0_cause;
20 	abi_ulong cp0_epc;
21 };
22 
23 /* Target errno definitions taken from asm-mips/errno.h */
24 #undef TARGET_ENOMSG
25 #define TARGET_ENOMSG          35      /* Identifier removed */
26 #undef TARGET_EIDRM
27 #define TARGET_EIDRM           36      /* Identifier removed */
28 #undef TARGET_ECHRNG
29 #define TARGET_ECHRNG          37      /* Channel number out of range */
30 #undef TARGET_EL2NSYNC
31 #define TARGET_EL2NSYNC        38      /* Level 2 not synchronized */
32 #undef TARGET_EL3HLT
33 #define TARGET_EL3HLT          39      /* Level 3 halted */
34 #undef TARGET_EL3RST
35 #define TARGET_EL3RST          40      /* Level 3 reset */
36 #undef TARGET_ELNRNG
37 #define TARGET_ELNRNG          41      /* Link number out of range */
38 #undef TARGET_EUNATCH
39 #define TARGET_EUNATCH         42      /* Protocol driver not attached */
40 #undef TARGET_ENOCSI
41 #define TARGET_ENOCSI          43      /* No CSI structure available */
42 #undef TARGET_EL2HLT
43 #define TARGET_EL2HLT          44      /* Level 2 halted */
44 #undef TARGET_EDEADLK
45 #define TARGET_EDEADLK         45      /* Resource deadlock would occur */
46 #undef TARGET_ENOLCK
47 #define TARGET_ENOLCK          46      /* No record locks available */
48 #undef TARGET_EBADE
49 #define TARGET_EBADE           50      /* Invalid exchange */
50 #undef TARGET_EBADR
51 #define TARGET_EBADR           51      /* Invalid request descriptor */
52 #undef TARGET_EXFULL
53 #define TARGET_EXFULL          52      /* TARGET_Exchange full */
54 #undef TARGET_ENOANO
55 #define TARGET_ENOANO          53      /* No anode */
56 #undef TARGET_EBADRQC
57 #define TARGET_EBADRQC         54      /* Invalid request code */
58 #undef TARGET_EBADSLT
59 #define TARGET_EBADSLT         55      /* Invalid slot */
60 #undef TARGET_EDEADLOCK
61 #define TARGET_EDEADLOCK       56      /* File locking deadlock error */
62 #undef TARGET_EBFONT
63 #define TARGET_EBFONT          59      /* Bad font file format */
64 #undef TARGET_ENOSTR
65 #define TARGET_ENOSTR          60      /* Device not a stream */
66 #undef TARGET_ENODATA
67 #define TARGET_ENODATA         61      /* No data available */
68 #undef TARGET_ETIME
69 #define TARGET_ETIME           62      /* Timer expired */
70 #undef TARGET_ENOSR
71 #define TARGET_ENOSR           63      /* Out of streams resources */
72 #undef TARGET_ENONET
73 #define TARGET_ENONET          64      /* Machine is not on the network */
74 #undef TARGET_ENOPKG
75 #define TARGET_ENOPKG          65      /* Package not installed */
76 #undef TARGET_EREMOTE
77 #define TARGET_EREMOTE         66      /* Object is remote */
78 #undef TARGET_ENOLINK
79 #define TARGET_ENOLINK         67      /* Link has been severed */
80 #undef TARGET_EADV
81 #define TARGET_EADV            68      /* Advertise error */
82 #undef TARGET_ESRMNT
83 #define TARGET_ESRMNT          69      /* Srmount error */
84 #undef TARGET_ECOMM
85 #define TARGET_ECOMM           70      /* Communication error on send */
86 #undef TARGET_EPROTO
87 #define TARGET_EPROTO          71      /* Protocol error */
88 #undef TARGET_EDOTDOT
89 #define TARGET_EDOTDOT         73      /* RFS specific error */
90 #undef TARGET_EMULTIHOP
91 #define TARGET_EMULTIHOP       74      /* Multihop attempted */
92 #undef TARGET_EBADMSG
93 #define TARGET_EBADMSG         77      /* Not a data message */
94 #undef TARGET_ENAMETOOLONG
95 #define TARGET_ENAMETOOLONG    78      /* File name too long */
96 #undef TARGET_EOVERFLOW
97 #define TARGET_EOVERFLOW       79      /* Value too large for defined data type */
98 #undef TARGET_ENOTUNIQ
99 #define TARGET_ENOTUNIQ        80      /* Name not unique on network */
100 #undef TARGET_EBADFD
101 #define TARGET_EBADFD          81      /* File descriptor in bad state */
102 #undef TARGET_EREMCHG
103 #define TARGET_EREMCHG         82      /* Remote address changed */
104 #undef TARGET_ELIBACC
105 #define TARGET_ELIBACC         83      /* Can not access a needed shared library */
106 #undef TARGET_ELIBBAD
107 #define TARGET_ELIBBAD         84      /* Accessing a corrupted shared library */
108 #undef TARGET_ELIBSCN
109 #define TARGET_ELIBSCN         85      /* .lib section in a.out corrupted */
110 #undef TARGET_ELIBMAX
111 #define TARGET_ELIBMAX         86      /* Attempting to link in too many shared libraries */
112 #undef TARGET_ELIBEXEC
113 #define TARGET_ELIBEXEC        87      /* Cannot exec a shared library directly */
114 #undef TARGET_EILSEQ
115 #define TARGET_EILSEQ          88      /* Illegal byte sequence */
116 #undef TARGET_ENOSYS
117 #define TARGET_ENOSYS          89      /* Function not implemented */
118 #undef TARGET_ELOOP
119 #define TARGET_ELOOP           90      /* Too many symbolic links encountered */
120 #undef TARGET_ERESTART
121 #define TARGET_ERESTART        91      /* Interrupted system call should be restarted */
122 #undef TARGET_ESTRPIPE
123 #define TARGET_ESTRPIPE        92      /* Streams pipe error */
124 #undef TARGET_ENOTEMPTY
125 #define TARGET_ENOTEMPTY       93      /* Directory not empty */
126 #undef TARGET_EUSERS
127 #define TARGET_EUSERS          94      /* Too many users */
128 #undef TARGET_ENOTSOCK
129 #define TARGET_ENOTSOCK        95      /* Socket operation on non-socket */
130 #undef TARGET_EDESTADDRREQ
131 #define TARGET_EDESTADDRREQ    96      /* Destination address required */
132 #undef TARGET_EMSGSIZE
133 #define TARGET_EMSGSIZE        97      /* Message too long */
134 #undef TARGET_EPROTOTYPE
135 #define TARGET_EPROTOTYPE      98      /* Protocol wrong type for socket */
136 #undef TARGET_ENOPROTOOPT
137 #define TARGET_ENOPROTOOPT     99      /* Protocol not available */
138 #undef TARGET_EPROTONOSUPPORT
139 #define TARGET_EPROTONOSUPPORT 120     /* Protocol not supported */
140 #undef TARGET_ESOCKTNOSUPPORT
141 #define TARGET_ESOCKTNOSUPPORT 121     /* Socket type not supported */
142 #undef TARGET_EOPNOTSUPP
143 #define TARGET_EOPNOTSUPP      122     /* Operation not supported on transport endpoint */
144 #undef TARGET_EPFNOSUPPORT
145 #define TARGET_EPFNOSUPPORT    123     /* Protocol family not supported */
146 #undef TARGET_EAFNOSUPPORT
147 #define TARGET_EAFNOSUPPORT    124     /* Address family not supported by protocol */
148 #undef TARGET_EADDRINUSE
149 #define TARGET_EADDRINUSE      125     /* Address already in use */
150 #undef TARGET_EADDRNOTAVAIL
151 #define TARGET_EADDRNOTAVAIL   126     /* Cannot assign requested address */
152 #undef TARGET_ENETDOWN
153 #define TARGET_ENETDOWN        127     /* Network is down */
154 #undef TARGET_ENETUNREACH
155 #define TARGET_ENETUNREACH     128     /* Network is unreachable */
156 #undef TARGET_ENETRESET
157 #define TARGET_ENETRESET       129     /* Network dropped connection because of reset */
158 #undef TARGET_ECONNABORTED
159 #define TARGET_ECONNABORTED    130     /* Software caused connection abort */
160 #undef TARGET_ECONNRESET
161 #define TARGET_ECONNRESET      131     /* Connection reset by peer */
162 #undef TARGET_ENOBUFS
163 #define TARGET_ENOBUFS         132     /* No buffer space available */
164 #undef TARGET_EISCONN
165 #define TARGET_EISCONN         133     /* Transport endpoint is already connected */
166 #undef TARGET_ENOTCONN
167 #define TARGET_ENOTCONN        134     /* Transport endpoint is not connected */
168 #undef TARGET_EUCLEAN
169 #define TARGET_EUCLEAN         135     /* Structure needs cleaning */
170 #undef TARGET_ENOTNAM
171 #define TARGET_ENOTNAM         137     /* Not a XENIX named type file */
172 #undef TARGET_ENAVAIL
173 #define TARGET_ENAVAIL         138     /* No XENIX semaphores available */
174 #undef TARGET_EISNAM
175 #define TARGET_EISNAM          139     /* Is a named type file */
176 #undef TARGET_EREMOTEIO
177 #define TARGET_EREMOTEIO       140     /* Remote I/O error */
178 #undef TARGET_EINIT
179 #define TARGET_EINIT           141     /* Reserved */
180 #undef TARGET_EREMDEV
181 #define TARGET_EREMDEV         142     /* TARGET_Error 142 */
182 #undef TARGET_ESHUTDOWN
183 #define TARGET_ESHUTDOWN       143     /* Cannot send after transport endpoint shutdown */
184 #undef TARGET_ETOOMANYREFS
185 #define TARGET_ETOOMANYREFS    144     /* Too many references: cannot splice */
186 #undef TARGET_ETIMEDOUT
187 #define TARGET_ETIMEDOUT       145     /* Connection timed out */
188 #undef TARGET_ECONNREFUSED
189 #define TARGET_ECONNREFUSED    146     /* Connection refused */
190 #undef TARGET_EHOSTDOWN
191 #define TARGET_EHOSTDOWN       147     /* Host is down */
192 #undef TARGET_EHOSTUNREACH
193 #define TARGET_EHOSTUNREACH    148     /* No route to host */
194 #undef TARGET_EALREADY
195 #define TARGET_EALREADY        149     /* Operation already in progress */
196 #undef TARGET_EINPROGRESS
197 #define TARGET_EINPROGRESS     150     /* Operation now in progress */
198 #undef TARGET_ESTALE
199 #define TARGET_ESTALE          151     /* Stale NFS file handle */
200 #undef TARGET_ECANCELED
201 #define TARGET_ECANCELED       158     /* AIO operation canceled */
202 /*
203  * These error are Linux extensions.
204  */
205 #undef TARGET_ENOMEDIUM
206 #define TARGET_ENOMEDIUM       159     /* No medium found */
207 #undef TARGET_EMEDIUMTYPE
208 #define TARGET_EMEDIUMTYPE     160     /* Wrong medium type */
209 #undef TARGET_ENOKEY
210 #define TARGET_ENOKEY          161     /* Required key not available */
211 #undef TARGET_EKEYEXPIRED
212 #define TARGET_EKEYEXPIRED     162     /* Key has expired */
213 #undef TARGET_EKEYREVOKED
214 #define TARGET_EKEYREVOKED     163     /* Key has been revoked */
215 #undef TARGET_EKEYREJECTED
216 #define TARGET_EKEYREJECTED    164     /* Key was rejected by service */
217 
218 /* for robust mutexes */
219 #undef TARGET_EOWNERDEAD
220 #define TARGET_EOWNERDEAD      165     /* Owner died */
221 #undef TARGET_ENOTRECOVERABLE
222 #define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
223 
224 #undef TARGET_ERFKILL
225 #define TARGET_ERFKILL         167
226 #undef TARGET_EHWPOISON
227 #define TARGET_EHWPOISON       168
228 
229 #undef TARGET_EDQUOT
230 #define TARGET_EDQUOT          1133    /* Quota exceeded */
231 
232 #define UNAME_MACHINE "mips"
233 #define UNAME_MINIMUM_RELEASE "2.6.32"
234 
235 #define TARGET_CLONE_BACKWARDS
236 #define TARGET_MINSIGSTKSZ 2048
237 #define TARGET_MLOCKALL_MCL_CURRENT 1
238 #define TARGET_MLOCKALL_MCL_FUTURE  2
239 
240 #define TARGET_FORCE_SHMLBA
241 
242 static inline abi_ulong target_shmlba(CPUMIPSState *env)
243 {
244     return 0x40000;
245 }
246 
247 #endif /* MIPS_TARGET_SYSCALL_H */
248