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