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