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