3dfdc11a0d5809e0795b36f9d69b15092e0fa9d6
[openwrt/openwrt.git] / toolchain / musl / patches / 020-Add-MIPS-N64-port.patch
1 commit 1abe6a4d8e21d760e5765e7317c898dcedd422cb
2 Author: Jaydeep Patil <jap@debian-co3-1.le.imgtec.org>
3 Date: Fri Feb 26 07:06:28 2016 +0000
4
5 [MIPS64] N64 port
6
7 --- /dev/null
8 +++ b/arch/mips64/atomic_arch.h
9 @@ -0,0 +1,50 @@
10 +#define a_ll a_ll
11 +static inline int a_ll(volatile int *p)
12 +{
13 + int v;
14 + __asm__ __volatile__ (
15 + "ll %0, %1"
16 + : "=r"(v) : "m"(*p));
17 + return v;
18 +}
19 +
20 +#define a_sc a_sc
21 +static inline int a_sc(volatile int *p, int v)
22 +{
23 + int r;
24 + __asm__ __volatile__ (
25 + "sc %0, %1"
26 + : "=r"(r), "=m"(*p) : "0"(v) : "memory");
27 + return r;
28 +}
29 +
30 +#define a_ll_p a_ll_p
31 +static inline int a_ll_p(volatile long *p)
32 +{
33 + int v;
34 + __asm__ __volatile__ (
35 + "lld %0, %1"
36 + : "=r"(v) : "m"(*p));
37 + return v;
38 +}
39 +
40 +#define a_sc_p a_sc_p
41 +static inline int a_sc_p(volatile long *p, void *v)
42 +{
43 + int r;
44 + __asm__ __volatile__ (
45 + "scd %0, %1"
46 + : "=r"(r), "=m"(*p) : "0"(v) : "memory");
47 + return r;
48 +}
49 +
50 +#define a_barrier a_barrier
51 +static inline void a_barrier()
52 +{
53 + /* mips2 sync, but using too many directives causes
54 + * gcc not to inline it, so encode with .long instead. */
55 + __asm__ __volatile__ (".long 0xf" : : : "memory");
56 +}
57 +
58 +#define a_pre_llsc a_barrier
59 +#define a_post_llsc a_barrier
60 --- /dev/null
61 +++ b/arch/mips64/bits/alltypes.h.in
62 @@ -0,0 +1,28 @@
63 +#define _Addr long
64 +#define _Int64 long
65 +#define _Reg long
66 +
67 +TYPEDEF __builtin_va_list va_list;
68 +TYPEDEF __builtin_va_list __isoc_va_list;
69 +
70 +#ifndef __cplusplus
71 +TYPEDEF int wchar_t;
72 +#endif
73 +
74 +TYPEDEF float float_t;
75 +TYPEDEF double double_t;
76 +
77 +TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
78 +
79 +TYPEDEF long time_t;
80 +TYPEDEF long suseconds_t;
81 +
82 +TYPEDEF unsigned nlink_t;
83 +
84 +TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
85 +TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
86 +TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
87 +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
88 +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
89 +TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
90 +TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
91 --- /dev/null
92 +++ b/arch/mips64/bits/endian.h
93 @@ -0,0 +1,5 @@
94 +#if _MIPSEL || __MIPSEL || __MIPSEL__
95 +#define __BYTE_ORDER __LITTLE_ENDIAN
96 +#else
97 +#define __BYTE_ORDER __BIG_ENDIAN
98 +#endif
99 --- /dev/null
100 +++ b/arch/mips64/bits/errno.h
101 @@ -0,0 +1,134 @@
102 +#define EPERM 1
103 +#define ENOENT 2
104 +#define ESRCH 3
105 +#define EINTR 4
106 +#define EIO 5
107 +#define ENXIO 6
108 +#define E2BIG 7
109 +#define ENOEXEC 8
110 +#define EBADF 9
111 +#define ECHILD 10
112 +#define EAGAIN 11
113 +#define ENOMEM 12
114 +#define EACCES 13
115 +#define EFAULT 14
116 +#define ENOTBLK 15
117 +#define EBUSY 16
118 +#define EEXIST 17
119 +#define EXDEV 18
120 +#define ENODEV 19
121 +#define ENOTDIR 20
122 +#define EISDIR 21
123 +#define EINVAL 22
124 +#define ENFILE 23
125 +#define EMFILE 24
126 +#define ENOTTY 25
127 +#define ETXTBSY 26
128 +#define EFBIG 27
129 +#define ENOSPC 28
130 +#define ESPIPE 29
131 +#define EROFS 30
132 +#define EMLINK 31
133 +#define EPIPE 32
134 +#define EDOM 33
135 +#define ERANGE 34
136 +#define ENOMSG 35
137 +#define EIDRM 36
138 +#define ECHRNG 37
139 +#define EL2NSYNC 38
140 +#define EL3HLT 39
141 +#define EL3RST 40
142 +#define ELNRNG 41
143 +#define EUNATCH 42
144 +#define ENOCSI 43
145 +#define EL2HLT 44
146 +#define EDEADLK 45
147 +#define ENOLCK 46
148 +#define EBADE 50
149 +#define EBADR 51
150 +#define EXFULL 52
151 +#define ENOANO 53
152 +#define EBADRQC 54
153 +#define EBADSLT 55
154 +#define EDEADLOCK 56
155 +#define EBFONT 59
156 +#define ENOSTR 60
157 +#define ENODATA 61
158 +#define ETIME 62
159 +#define ENOSR 63
160 +#define ENONET 64
161 +#define ENOPKG 65
162 +#define EREMOTE 66
163 +#define ENOLINK 67
164 +#define EADV 68
165 +#define ESRMNT 69
166 +#define ECOMM 70
167 +#define EPROTO 71
168 +#define EDOTDOT 73
169 +#define EMULTIHOP 74
170 +#define EBADMSG 77
171 +#define ENAMETOOLONG 78
172 +#define EOVERFLOW 79
173 +#define ENOTUNIQ 80
174 +#define EBADFD 81
175 +#define EREMCHG 82
176 +#define ELIBACC 83
177 +#define ELIBBAD 84
178 +#define ELIBSCN 85
179 +#define ELIBMAX 86
180 +#define ELIBEXEC 87
181 +#define EILSEQ 88
182 +#define ENOSYS 89
183 +#define ELOOP 90
184 +#define ERESTART 91
185 +#define ESTRPIPE 92
186 +#define ENOTEMPTY 93
187 +#define EUSERS 94
188 +#define ENOTSOCK 95
189 +#define EDESTADDRREQ 96
190 +#define EMSGSIZE 97
191 +#define EPROTOTYPE 98
192 +#define ENOPROTOOPT 99
193 +#define EPROTONOSUPPORT 120
194 +#define ESOCKTNOSUPPORT 121
195 +#define EOPNOTSUPP 122
196 +#define ENOTSUP EOPNOTSUPP
197 +#define EPFNOSUPPORT 123
198 +#define EAFNOSUPPORT 124
199 +#define EADDRINUSE 125
200 +#define EADDRNOTAVAIL 126
201 +#define ENETDOWN 127
202 +#define ENETUNREACH 128
203 +#define ENETRESET 129
204 +#define ECONNABORTED 130
205 +#define ECONNRESET 131
206 +#define ENOBUFS 132
207 +#define EISCONN 133
208 +#define ENOTCONN 134
209 +#define EUCLEAN 135
210 +#define ENOTNAM 137
211 +#define ENAVAIL 138
212 +#define EISNAM 139
213 +#define EREMOTEIO 140
214 +#define ESHUTDOWN 143
215 +#define ETOOMANYREFS 144
216 +#define ETIMEDOUT 145
217 +#define ECONNREFUSED 146
218 +#define EHOSTDOWN 147
219 +#define EHOSTUNREACH 148
220 +#define EWOULDBLOCK EAGAIN
221 +#define EALREADY 149
222 +#define EINPROGRESS 150
223 +#define ESTALE 151
224 +#define ECANCELED 158
225 +#define ENOMEDIUM 159
226 +#define EMEDIUMTYPE 160
227 +#define ENOKEY 161
228 +#define EKEYEXPIRED 162
229 +#define EKEYREVOKED 163
230 +#define EKEYREJECTED 164
231 +#define EOWNERDEAD 165
232 +#define ENOTRECOVERABLE 166
233 +#define ERFKILL 167
234 +#define EHWPOISON 168
235 +#define EDQUOT 1133
236 --- /dev/null
237 +++ b/arch/mips64/bits/fcntl.h
238 @@ -0,0 +1,40 @@
239 +#define O_CREAT 0400
240 +#define O_EXCL 02000
241 +#define O_NOCTTY 04000
242 +#define O_TRUNC 01000
243 +#define O_APPEND 0010
244 +#define O_NONBLOCK 0200
245 +#define O_DSYNC 0020
246 +#define O_SYNC 040020
247 +#define O_RSYNC 040020
248 +#define O_DIRECTORY 0200000
249 +#define O_NOFOLLOW 0400000
250 +#define O_CLOEXEC 02000000
251 +
252 +#define O_ASYNC 010000
253 +#define O_DIRECT 0100000
254 +#define O_LARGEFILE 0
255 +#define O_NOATIME 01000000
256 +#define O_PATH 010000000
257 +#define O_TMPFILE 020200000
258 +#define O_NDELAY O_NONBLOCK
259 +
260 +#define F_DUPFD 0
261 +#define F_GETFD 1
262 +#define F_SETFD 2
263 +#define F_GETFL 3
264 +#define F_SETFL 4
265 +
266 +#define F_SETOWN 24
267 +#define F_GETOWN 23
268 +#define F_SETSIG 10
269 +#define F_GETSIG 11
270 +
271 +#define F_GETLK 14
272 +#define F_SETLK 6
273 +#define F_SETLKW 7
274 +
275 +#define F_SETOWN_EX 15
276 +#define F_GETOWN_EX 16
277 +
278 +#define F_GETOWNER_UIDS 17
279 --- /dev/null
280 +++ b/arch/mips64/bits/fenv.h
281 @@ -0,0 +1,25 @@
282 +#ifdef __mips_soft_float
283 +#define FE_ALL_EXCEPT 0
284 +#define FE_TONEAREST 0
285 +#else
286 +#define FE_INEXACT 4
287 +#define FE_UNDERFLOW 8
288 +#define FE_OVERFLOW 16
289 +#define FE_DIVBYZERO 32
290 +#define FE_INVALID 64
291 +
292 +#define FE_ALL_EXCEPT 124
293 +
294 +#define FE_TONEAREST 0
295 +#define FE_TOWARDZERO 1
296 +#define FE_UPWARD 2
297 +#define FE_DOWNWARD 3
298 +#endif
299 +
300 +typedef unsigned short fexcept_t;
301 +
302 +typedef struct {
303 + unsigned __cw;
304 +} fenv_t;
305 +
306 +#define FE_DFL_ENV ((const fenv_t *) -1)
307 --- /dev/null
308 +++ b/arch/mips64/bits/float.h
309 @@ -0,0 +1,16 @@
310 +#define FLT_EVAL_METHOD 0
311 +
312 +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
313 +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
314 +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
315 +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
316 +
317 +#define LDBL_MANT_DIG 113
318 +#define LDBL_MIN_EXP (-16381)
319 +#define LDBL_MAX_EXP 16384
320 +
321 +#define LDBL_DIG 33
322 +#define LDBL_MIN_10_EXP (-4931)
323 +#define LDBL_MAX_10_EXP 4932
324 +
325 +#define DECIMAL_DIG 36
326 --- /dev/null
327 +++ b/arch/mips64/bits/ioctl.h
328 @@ -0,0 +1,210 @@
329 +#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
330 +#define _IOC_NONE 1U
331 +#define _IOC_READ 2U
332 +#define _IOC_WRITE 4U
333 +
334 +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
335 +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
336 +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
337 +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
338 +
339 +#define TCGETA 0x5401
340 +#define TCSETA 0x5402
341 +#define TCSETAW 0x5403
342 +#define TCSETAF 0x5404
343 +#define TCSBRK 0x5405
344 +#define TCXONC 0x5406
345 +#define TCFLSH 0x5407
346 +#define TCGETS 0x540D
347 +#define TCSETS 0x540E
348 +#define TCSETSW 0x540F
349 +#define TCSETSF 0x5410
350 +
351 +#define TIOCEXCL 0x740D
352 +#define TIOCNXCL 0x740E
353 +#define TIOCOUTQ 0x7472
354 +#define TIOCSTI 0x5472
355 +#define TIOCMGET 0x741D
356 +#define TIOCMBIS 0x741B
357 +#define TIOCMBIC 0x741C
358 +#define TIOCMSET 0x741D
359 +
360 +#define TIOCPKT 0x5470
361 +#define TIOCSWINSZ _IOW('t', 103, struct winsize)
362 +#define TIOCGWINSZ _IOR('t', 104, struct winsize)
363 +#define TIOCNOTTY 0x5471
364 +#define TIOCSETD 0x7401
365 +#define TIOCGETD 0x7400
366 +
367 +#define FIOCLEX 0x6601
368 +#define FIONCLEX 0x6602
369 +#define FIOASYNC 0x667D
370 +#define FIONBIO 0x667E
371 +#define FIOQSIZE 0x667F
372 +
373 +#define TIOCGLTC 0x7474
374 +#define TIOCSLTC 0x7475
375 +#define TIOCSPGRP _IOW('t', 118, int)
376 +#define TIOCGPGRP _IOR('t', 119, int)
377 +#define TIOCCONS _IOW('t', 120, int)
378 +
379 +#define FIONREAD 0x467F
380 +#define TIOCINQ FIONREAD
381 +
382 +#define TIOCGETP 0x7408
383 +#define TIOCSETP 0x7409
384 +#define TIOCSETN 0x740A
385 +
386 +#define TIOCSBRK 0x5427
387 +#define TIOCCBRK 0x5428
388 +#define TIOCGSID 0x7416
389 +#define TIOCGPTN _IOR('T', 0x30, unsigned int)
390 +#define TIOCSPTLCK _IOW('T', 0x31, int)
391 +
392 +#define TIOCSCTTY 0x5480
393 +#define TIOCGSOFTCAR 0x5481
394 +#define TIOCSSOFTCAR 0x5482
395 +#define TIOCLINUX 0x5483
396 +#define TIOCGSERIAL 0x5484
397 +#define TIOCSSERIAL 0x5485
398 +#define TCSBRKP 0x5486
399 +
400 +#define TIOCSERCONFIG 0x5488
401 +#define TIOCSERGWILD 0x5489
402 +#define TIOCSERSWILD 0x548A
403 +#define TIOCGLCKTRMIOS 0x548B
404 +#define TIOCSLCKTRMIOS 0x548C
405 +#define TIOCSERGSTRUCT 0x548D
406 +#define TIOCSERGETLSR 0x548E
407 +#define TIOCSERGETMULTI 0x548F
408 +#define TIOCSERSETMULTI 0x5490
409 +#define TIOCMIWAIT 0x5491
410 +#define TIOCGICOUNT 0x5492
411 +#define TIOCGHAYESESP 0x5493
412 +#define TIOCSHAYESESP 0x5494
413 +
414 +#define TIOCTTYGSTRUCT 0x5426 // Not sure about these.
415 +#define TCGETX 0x5432 // Not sure about these.
416 +#define TCSETX 0x5433 // Not sure about these.
417 +#define TCSETXF 0x5434 // Not sure about these.
418 +#define TCSETXW 0x5435 // Not sure about these.
419 +
420 +#define TIOCPKT_DATA 0
421 +#define TIOCPKT_FLUSHREAD 1
422 +#define TIOCPKT_FLUSHWRITE 2
423 +#define TIOCPKT_STOP 4
424 +#define TIOCPKT_START 8
425 +#define TIOCPKT_NOSTOP 16
426 +#define TIOCPKT_DOSTOP 32
427 +#define TIOCPKT_IOCTL 64
428 +
429 +#define TIOCSER_TEMT 0x01
430 +
431 +struct winsize {
432 + unsigned short ws_row;
433 + unsigned short ws_col;
434 + unsigned short ws_xpixel;
435 + unsigned short ws_ypixel;
436 +};
437 +
438 +#define TIOCM_LE 0x001
439 +#define TIOCM_DTR 0x002
440 +#define TIOCM_RTS 0x004
441 +#define TIOCM_ST 0x008
442 +#define TIOCM_SR 0x010
443 +#define TIOCM_CTS 0x020
444 +#define TIOCM_CAR 0x040
445 +#define TIOCM_RNG 0x080
446 +#define TIOCM_DSR 0x100
447 +#define TIOCM_CD TIOCM_CAR
448 +#define TIOCM_RI TIOCM_RNG
449 +#define TIOCM_OUT1 0x2000
450 +#define TIOCM_OUT2 0x4000
451 +#define TIOCM_LOOP 0x8000
452 +#define TIOCM_MODEM_BITS TIOCM_OUT2
453 +
454 +#define N_TTY 0
455 +#define N_SLIP 1
456 +#define N_MOUSE 2
457 +#define N_PPP 3
458 +#define N_STRIP 4
459 +#define N_AX25 5
460 +#define N_X25 6
461 +#define N_6PACK 7
462 +#define N_MASC 8
463 +#define N_R3964 9
464 +#define N_PROFIBUS_FDL 10
465 +#define N_IRDA 11
466 +#define N_SMSBLOCK 12
467 +#define N_HDLC 13
468 +#define N_SYNC_PPP 14
469 +#define N_HCI 15
470 +
471 +#define FIOSETOWN 0x8901
472 +#define SIOCSPGRP 0x8902
473 +#define FIOGETOWN 0x8903
474 +#define SIOCGPGRP 0x8904
475 +#define SIOCATMARK 0x8905
476 +#define SIOCGSTAMP 0x8906
477 +
478 +#define SIOCADDRT 0x890B
479 +#define SIOCDELRT 0x890C
480 +#define SIOCRTMSG 0x890D
481 +
482 +#define SIOCGIFNAME 0x8910
483 +#define SIOCSIFLINK 0x8911
484 +#define SIOCGIFCONF 0x8912
485 +#define SIOCGIFFLAGS 0x8913
486 +#define SIOCSIFFLAGS 0x8914
487 +#define SIOCGIFADDR 0x8915
488 +#define SIOCSIFADDR 0x8916
489 +#define SIOCGIFDSTADDR 0x8917
490 +#define SIOCSIFDSTADDR 0x8918
491 +#define SIOCGIFBRDADDR 0x8919
492 +#define SIOCSIFBRDADDR 0x891a
493 +#define SIOCGIFNETMASK 0x891b
494 +#define SIOCSIFNETMASK 0x891c
495 +#define SIOCGIFMETRIC 0x891d
496 +#define SIOCSIFMETRIC 0x891e
497 +#define SIOCGIFMEM 0x891f
498 +#define SIOCSIFMEM 0x8920
499 +#define SIOCGIFMTU 0x8921
500 +#define SIOCSIFMTU 0x8922
501 +#define SIOCSIFHWADDR 0x8924
502 +#define SIOCGIFENCAP 0x8925
503 +#define SIOCSIFENCAP 0x8926
504 +#define SIOCGIFHWADDR 0x8927
505 +#define SIOCGIFSLAVE 0x8929
506 +#define SIOCSIFSLAVE 0x8930
507 +#define SIOCADDMULTI 0x8931
508 +#define SIOCDELMULTI 0x8932
509 +#define SIOCGIFINDEX 0x8933
510 +#define SIOGIFINDEX SIOCGIFINDEX
511 +#define SIOCSIFPFLAGS 0x8934
512 +#define SIOCGIFPFLAGS 0x8935
513 +#define SIOCDIFADDR 0x8936
514 +#define SIOCSIFHWBROADCAST 0x8937
515 +#define SIOCGIFCOUNT 0x8938
516 +
517 +#define SIOCGIFBR 0x8940
518 +#define SIOCSIFBR 0x8941
519 +
520 +#define SIOCGIFTXQLEN 0x8942
521 +#define SIOCSIFTXQLEN 0x8943
522 +
523 +#define SIOCDARP 0x8953
524 +#define SIOCGARP 0x8954
525 +#define SIOCSARP 0x8955
526 +
527 +#define SIOCDRARP 0x8960
528 +#define SIOCGRARP 0x8961
529 +#define SIOCSRARP 0x8962
530 +
531 +#define SIOCGIFMAP 0x8970
532 +#define SIOCSIFMAP 0x8971
533 +
534 +#define SIOCADDDLCI 0x8980
535 +#define SIOCDELDLCI 0x8981
536 +
537 +#define SIOCDEVPRIVATE 0x89F0
538 +#define SIOCPROTOPRIVATE 0x89E0
539 --- /dev/null
540 +++ b/arch/mips64/bits/ipc.h
541 @@ -0,0 +1,15 @@
542 +struct ipc_perm
543 +{
544 + key_t __ipc_perm_key;
545 + uid_t uid;
546 + gid_t gid;
547 + uid_t cuid;
548 + gid_t cgid;
549 + mode_t mode;
550 + int __ipc_perm_seq;
551 + int __pad1;
552 + unsigned long __unused1;
553 + unsigned long __unused2;
554 +};
555 +
556 +#define IPC_64 0x100
557 --- /dev/null
558 +++ b/arch/mips64/bits/limits.h
559 @@ -0,0 +1,7 @@
560 +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
561 + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
562 +#define LONG_BIT 64
563 +#endif
564 +
565 +#define LONG_MAX 0x7fffffffffffffffL
566 +#define LLONG_MAX 0x7fffffffffffffffLL
567 --- /dev/null
568 +++ b/arch/mips64/bits/mman.h
569 @@ -0,0 +1,58 @@
570 +#define MAP_FAILED ((void *) -1)
571 +
572 +#define PROT_NONE 0
573 +#define PROT_READ 1
574 +#define PROT_WRITE 2
575 +#define PROT_EXEC 4
576 +#define PROT_GROWSDOWN 0x01000000
577 +#define PROT_GROWSUP 0x02000000
578 +
579 +#define MAP_SHARED 0x01
580 +#define MAP_PRIVATE 0x02
581 +#define MAP_FIXED 0x10
582 +
583 +#define MAP_TYPE 0x0f
584 +#define MAP_FILE 0x00
585 +#define MAP_ANON 0x800
586 +#define MAP_ANONYMOUS MAP_ANON
587 +#define MAP_NORESERVE 0x0400
588 +#define MAP_GROWSDOWN 0x1000
589 +#define MAP_DENYWRITE 0x2000
590 +#define MAP_EXECUTABLE 0x4000
591 +#define MAP_LOCKED 0x8000
592 +#define MAP_POPULATE 0x10000
593 +#define MAP_NONBLOCK 0x20000
594 +#define MAP_STACK 0x40000
595 +#define MAP_HUGETLB 0x80000
596 +
597 +#define POSIX_MADV_NORMAL 0
598 +#define POSIX_MADV_RANDOM 1
599 +#define POSIX_MADV_SEQUENTIAL 2
600 +#define POSIX_MADV_WILLNEED 3
601 +#define POSIX_MADV_DONTNEED 0
602 +
603 +#define MS_ASYNC 1
604 +#define MS_INVALIDATE 2
605 +#define MS_SYNC 4
606 +
607 +#define MCL_CURRENT 1
608 +#define MCL_FUTURE 2
609 +#define MCL_ONFAULT 4
610 +
611 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
612 +#define MADV_NORMAL 0
613 +#define MADV_RANDOM 1
614 +#define MADV_SEQUENTIAL 2
615 +#define MADV_WILLNEED 3
616 +#define MADV_DONTNEED 4
617 +#define MADV_REMOVE 9
618 +#define MADV_DONTFORK 10
619 +#define MADV_DOFORK 11
620 +#define MADV_MERGEABLE 12
621 +#define MADV_UNMERGEABLE 13
622 +#define MADV_HUGEPAGE 14
623 +#define MADV_NOHUGEPAGE 15
624 +#define MADV_DONTDUMP 16
625 +#define MADV_DODUMP 17
626 +#define MADV_HWPOISON 100
627 +#endif
628 --- /dev/null
629 +++ b/arch/mips64/bits/msg.h
630 @@ -0,0 +1,14 @@
631 +struct msqid_ds
632 +{
633 + struct ipc_perm msg_perm;
634 + time_t msg_stime;
635 + time_t msg_rtime;
636 + time_t msg_ctime;
637 + unsigned long msg_cbytes;
638 + msgqnum_t msg_qnum;
639 + msglen_t msg_qbytes;
640 + pid_t msg_lspid;
641 + pid_t msg_lrpid;
642 + unsigned long __pad1;
643 + unsigned long __pad2;
644 +};
645 --- /dev/null
646 +++ b/arch/mips64/bits/poll.h
647 @@ -0,0 +1,2 @@
648 +#define POLLWRNORM POLLOUT
649 +#define POLLWRBAND 0x100
650 --- /dev/null
651 +++ b/arch/mips64/bits/posix.h
652 @@ -0,0 +1,2 @@
653 +#define _POSIX_V6_LP64_OFFBIG 1
654 +#define _POSIX_V7_LP64_OFFBIG 1
655 --- /dev/null
656 +++ b/arch/mips64/bits/reg.h
657 @@ -0,0 +1,47 @@
658 +#undef __WORDSIZE
659 +#define __WORDSIZE 64
660 +
661 +#define EF_R0 0
662 +#define EF_R1 1
663 +#define EF_R2 2
664 +#define EF_R3 3
665 +#define EF_R4 4
666 +#define EF_R5 5
667 +#define EF_R6 6
668 +#define EF_R7 7
669 +#define EF_R8 8
670 +#define EF_R9 9
671 +#define EF_R10 10
672 +#define EF_R11 11
673 +#define EF_R12 12
674 +#define EF_R13 13
675 +#define EF_R14 14
676 +#define EF_R15 15
677 +#define EF_R16 16
678 +#define EF_R17 17
679 +#define EF_R18 18
680 +#define EF_R19 19
681 +#define EF_R20 20
682 +#define EF_R21 21
683 +#define EF_R22 22
684 +#define EF_R23 23
685 +#define EF_R24 24
686 +#define EF_R25 25
687 +
688 +#define EF_R26 26
689 +#define EF_R27 27
690 +#define EF_R28 28
691 +#define EF_R29 29
692 +#define EF_R30 30
693 +#define EF_R31 31
694 +
695 +#define EF_LO 32
696 +#define EF_HI 33
697 +
698 +#define EF_CP0_EPC 34
699 +#define EF_CP0_BADVADDR 35
700 +#define EF_CP0_STATUS 36
701 +#define EF_CP0_CAUSE 37
702 +#define EF_UNUSED0 38
703 +
704 +#define EF_SIZE 304
705 --- /dev/null
706 +++ b/arch/mips64/bits/resource.h
707 @@ -0,0 +1,5 @@
708 +#define RLIMIT_NOFILE 5
709 +#define RLIMIT_AS 6
710 +#define RLIMIT_RSS 7
711 +#define RLIMIT_NPROC 8
712 +#define RLIMIT_MEMLOCK 9
713 --- /dev/null
714 +++ b/arch/mips64/bits/sem.h
715 @@ -0,0 +1,14 @@
716 +struct semid_ds {
717 + struct ipc_perm sem_perm;
718 + time_t sem_otime;
719 + time_t sem_ctime;
720 +#if __BYTE_ORDER == __LITTLE_ENDIAN
721 + unsigned short sem_nsems;
722 + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
723 +#else
724 + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
725 + unsigned short sem_nsems;
726 +#endif
727 + time_t __unused3;
728 + time_t __unused4;
729 +};
730 --- /dev/null
731 +++ b/arch/mips64/bits/setjmp.h
732 @@ -0,0 +1 @@
733 +typedef unsigned long long __jmp_buf[25];
734 --- /dev/null
735 +++ b/arch/mips64/bits/shm.h
736 @@ -0,0 +1,26 @@
737 +#define SHMLBA 4096
738 +
739 +struct shmid_ds
740 +{
741 + struct ipc_perm shm_perm;
742 + size_t shm_segsz;
743 + time_t shm_atime;
744 + time_t shm_dtime;
745 + time_t shm_ctime;
746 + pid_t shm_cpid;
747 + pid_t shm_lpid;
748 + unsigned long shm_nattch;
749 + unsigned long __pad1;
750 + unsigned long __pad2;
751 +};
752 +
753 +struct shminfo {
754 + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
755 +};
756 +
757 +struct shm_info {
758 + int __used_ids;
759 + unsigned long shm_tot, shm_rss, shm_swp;
760 + unsigned long __swap_attempts, __swap_successes;
761 +};
762 +
763 --- /dev/null
764 +++ b/arch/mips64/bits/signal.h
765 @@ -0,0 +1,143 @@
766 +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
767 + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
768 +
769 +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
770 +#define MINSIGSTKSZ 2048
771 +#define SIGSTKSZ 8192
772 +#endif
773 +
774 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
775 +typedef unsigned long long greg_t, gregset_t[32];
776 +typedef struct {
777 + union {
778 + double fp_dregs[32];
779 + struct {
780 + float _fp_fregs;
781 + unsigned _fp_pad;
782 + } fp_fregs[32];
783 + } fp_r;
784 +} fpregset_t;
785 +struct sigcontext
786 +{
787 + unsigned long long sc_regs[32];
788 + unsigned long long sc_fpregs[32];
789 + unsigned long long sc_mdhi;
790 + unsigned long long sc_hi1;
791 + unsigned long long sc_hi2;
792 + unsigned long long sc_hi3;
793 + unsigned long long sc_mdlo;
794 + unsigned long long sc_lo1;
795 + unsigned long long sc_lo2;
796 + unsigned long long sc_lo3;
797 + unsigned long long sc_pc;
798 + unsigned int sc_fpc_csr;
799 + unsigned int sc_used_math;
800 + unsigned int sc_dsp;
801 + unsigned int sc_reserved;
802 +};
803 +typedef struct
804 +{
805 + gregset_t gregs;
806 + fpregset_t fpregs;
807 + greg_t mdhi;
808 + greg_t hi1;
809 + greg_t hi2;
810 + greg_t hi3;
811 + greg_t mdlo;
812 + greg_t lo1;
813 + greg_t lo2;
814 + greg_t lo3;
815 + greg_t pc;
816 + unsigned int fpc_csr;
817 + unsigned int used_math;
818 + unsigned int dsp;
819 + unsigned int reserved;
820 +} mcontext_t;
821 +
822 +#else
823 +typedef struct {
824 + unsigned __mc1[2];
825 + unsigned long long __mc2[65];
826 + unsigned __mc3[5];
827 + unsigned long long __mc4[2];
828 + unsigned __mc5[6];
829 +} mcontext_t;
830 +#endif
831 +
832 +struct sigaltstack {
833 + void *ss_sp;
834 + size_t ss_size;
835 + int ss_flags;
836 +};
837 +
838 +typedef struct __ucontext {
839 + unsigned long uc_flags;
840 + struct __ucontext *uc_link;
841 + stack_t uc_stack;
842 + mcontext_t uc_mcontext;
843 + sigset_t uc_sigmask;
844 +} ucontext_t;
845 +
846 +#define SA_NOCLDSTOP 1
847 +#define SA_NOCLDWAIT 0x10000
848 +#define SA_SIGINFO 8
849 +#define SA_ONSTACK 0x08000000
850 +#define SA_RESTART 0x10000000
851 +#define SA_NODEFER 0x40000000
852 +#define SA_RESETHAND 0x80000000
853 +#define SA_RESTORER 0x04000000
854 +
855 +#undef SIG_BLOCK
856 +#undef SIG_UNBLOCK
857 +#undef SIG_SETMASK
858 +#define SIG_BLOCK 1
859 +#define SIG_UNBLOCK 2
860 +#define SIG_SETMASK 3
861 +
862 +#undef SI_ASYNCIO
863 +#undef SI_MESGQ
864 +#undef SI_TIMER
865 +#define SI_ASYNCIO (-2)
866 +#define SI_MESGQ (-4)
867 +#define SI_TIMER (-3)
868 +
869 +#define __SI_SWAP_ERRNO_CODE
870 +
871 +#endif
872 +
873 +#define SIGHUP 1
874 +#define SIGINT 2
875 +#define SIGQUIT 3
876 +#define SIGILL 4
877 +#define SIGTRAP 5
878 +#define SIGABRT 6
879 +#define SIGIOT SIGABRT
880 +#define SIGSTKFLT 7
881 +#define SIGFPE 8
882 +#define SIGKILL 9
883 +#define SIGBUS 10
884 +#define SIGSEGV 11
885 +#define SIGSYS 12
886 +#define SIGPIPE 13
887 +#define SIGALRM 14
888 +#define SIGTERM 15
889 +#define SIGUSR1 16
890 +#define SIGUSR2 17
891 +#define SIGCHLD 18
892 +#define SIGPWR 19
893 +#define SIGWINCH 20
894 +#define SIGURG 21
895 +#define SIGIO 22
896 +#define SIGPOLL SIGIO
897 +#define SIGSTOP 23
898 +#define SIGTSTP 24
899 +#define SIGCONT 25
900 +#define SIGTTIN 26
901 +#define SIGTTOU 27
902 +#define SIGVTALRM 28
903 +#define SIGPROF 29
904 +#define SIGXCPU 30
905 +#define SIGXFSZ 31
906 +#define SIGUNUSED SIGSYS
907 +
908 +#define _NSIG 128
909 --- /dev/null
910 +++ b/arch/mips64/bits/socket.h
911 @@ -0,0 +1,72 @@
912 +#include <endian.h>
913 +
914 +struct msghdr
915 +{
916 + void *msg_name;
917 + socklen_t msg_namelen;
918 + struct iovec *msg_iov;
919 +#if __BYTE_ORDER == __BIG_ENDIAN
920 + int __pad1, msg_iovlen;
921 +#else
922 + int msg_iovlen, __pad1;
923 +#endif
924 + void *msg_control;
925 +#if __BYTE_ORDER == __BIG_ENDIAN
926 + int __pad2;
927 + socklen_t msg_controllen;
928 +#else
929 + socklen_t msg_controllen;
930 + int __pad2;
931 +#endif
932 + int msg_flags;
933 +};
934 +
935 +struct cmsghdr
936 +{
937 +#if __BYTE_ORDER == __BIG_ENDIAN
938 + int __pad1;
939 + socklen_t cmsg_len;
940 +#else
941 + socklen_t cmsg_len;
942 + int __pad1;
943 +#endif
944 + int cmsg_level;
945 + int cmsg_type;
946 +};
947 +
948 +#define SOCK_STREAM 2
949 +#define SOCK_DGRAM 1
950 +
951 +#define SOL_SOCKET 65535
952 +
953 +#define SO_DEBUG 1
954 +
955 +#define SO_REUSEADDR 0x0004
956 +#define SO_KEEPALIVE 0x0008
957 +#define SO_DONTROUTE 0x0010
958 +#define SO_BROADCAST 0x0020
959 +#define SO_LINGER 0x0080
960 +#define SO_OOBINLINE 0x0100
961 +#define SO_REUSEPORT 0x0200
962 +#define SO_SNDBUF 0x1001
963 +#define SO_RCVBUF 0x1002
964 +#define SO_SNDLOWAT 0x1003
965 +#define SO_RCVLOWAT 0x1004
966 +#define SO_RCVTIMEO 0x1006
967 +#define SO_SNDTIMEO 0x1005
968 +#define SO_ERROR 0x1007
969 +#define SO_TYPE 0x1008
970 +#define SO_ACCEPTCONN 0x1009
971 +#define SO_PROTOCOL 0x1028
972 +#define SO_DOMAIN 0x1029
973 +
974 +#define SO_NO_CHECK 11
975 +#define SO_PRIORITY 12
976 +#define SO_BSDCOMPAT 14
977 +#define SO_PASSCRED 17
978 +#define SO_PEERCRED 18
979 +#define SO_SNDBUFFORCE 31
980 +#define SO_RCVBUFFORCE 33
981 +
982 +#define SOCK_NONBLOCK 0200
983 +#define SOCK_CLOEXEC 02000000
984 --- /dev/null
985 +++ b/arch/mips64/bits/stat.h
986 @@ -0,0 +1,25 @@
987 +#include <string.h>
988 +
989 +#include <bits/alltypes.h>
990 +
991 +struct stat {
992 + dev_t st_dev;
993 + int st_pad1[3];
994 + ino_t st_ino; /* File serial number. */
995 + mode_t st_mode; /* File mode. */
996 + nlink_t st_nlink; /* Link count. */
997 + uid_t st_uid; /* User ID of the file's owner. */
998 + gid_t st_gid; /* Group ID of the file's group.*/
999 + dev_t st_rdev; /* Device number, if device. */
1000 + unsigned int st_pad2[2];
1001 + off_t st_size; /* Size of file, in bytes. */
1002 + int st_pad3;
1003 + struct timespec st_atim; /* Time of last access. */
1004 + struct timespec st_mtim; /* Time of last modification. */
1005 + struct timespec st_ctim; /* Time of last status change. */
1006 + blksize_t st_blksize; /* Optimal block size for I/O. */
1007 + unsigned int st_pad4;
1008 + blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
1009 + int st_pad5[14];
1010 +};
1011 +
1012 --- /dev/null
1013 +++ b/arch/mips64/bits/statfs.h
1014 @@ -0,0 +1,8 @@
1015 +struct statfs {
1016 + unsigned long f_type, f_bsize, f_frsize;
1017 + fsblkcnt_t f_blocks, f_bfree;
1018 + fsfilcnt_t f_files, f_ffree;
1019 + fsblkcnt_t f_bavail;
1020 + fsid_t f_fsid;
1021 + unsigned long f_namelen, f_flags, f_spare[5];
1022 +};
1023 --- /dev/null
1024 +++ b/arch/mips64/bits/stdarg.h
1025 @@ -0,0 +1,4 @@
1026 +#define va_start(v,l) __builtin_va_start(v,l)
1027 +#define va_end(v) __builtin_va_end(v)
1028 +#define va_arg(v,l) __builtin_va_arg(v,l)
1029 +#define va_copy(d,s) __builtin_va_copy(d,s)
1030 --- /dev/null
1031 +++ b/arch/mips64/bits/stdint.h
1032 @@ -0,0 +1,20 @@
1033 +typedef int32_t int_fast16_t;
1034 +typedef int32_t int_fast32_t;
1035 +typedef uint32_t uint_fast16_t;
1036 +typedef uint32_t uint_fast32_t;
1037 +
1038 +#define INT_FAST16_MIN INT32_MIN
1039 +#define INT_FAST32_MIN INT32_MIN
1040 +
1041 +#define INT_FAST16_MAX INT32_MAX
1042 +#define INT_FAST32_MAX INT32_MAX
1043 +
1044 +#define UINT_FAST16_MAX UINT32_MAX
1045 +#define UINT_FAST32_MAX UINT32_MAX
1046 +
1047 +#define INTPTR_MIN INT64_MIN //size of pointer is 8 bytes .address is 64 bit
1048 +#define INTPTR_MAX INT64_MAX
1049 +#define UINTPTR_MAX UINT64_MAX
1050 +#define PTRDIFF_MIN INT64_MIN
1051 +#define PTRDIFF_MAX INT64_MAX
1052 +#define SIZE_MAX UINT64_MAX
1053 --- /dev/null
1054 +++ b/arch/mips64/bits/syscall.h
1055 @@ -0,0 +1,644 @@
1056 +/*
1057 + * Linux 64-bit syscalls are in the range from 5000 to 5999.
1058 + */
1059 +#define __NR_Linux 5000
1060 +#define __NR_read (__NR_Linux + 0)
1061 +#define __NR_write (__NR_Linux + 1)
1062 +#define __NR_open (__NR_Linux + 2)
1063 +#define __NR_close (__NR_Linux + 3)
1064 +#define __NR_stat (__NR_Linux + 4)
1065 +#define __NR_fstat (__NR_Linux + 5)
1066 +#define __NR_lstat (__NR_Linux + 6)
1067 +#define __NR_poll (__NR_Linux + 7)
1068 +#define __NR_lseek (__NR_Linux + 8)
1069 +#define __NR_mmap (__NR_Linux + 9)
1070 +#define __NR_mprotect (__NR_Linux + 10)
1071 +#define __NR_munmap (__NR_Linux + 11)
1072 +#define __NR_brk (__NR_Linux + 12)
1073 +#define __NR_rt_sigaction (__NR_Linux + 13)
1074 +#define __NR_rt_sigprocmask (__NR_Linux + 14)
1075 +#define __NR_ioctl (__NR_Linux + 15)
1076 +#define __NR_pread64 (__NR_Linux + 16)
1077 +#define __NR_pwrite64 (__NR_Linux + 17)
1078 +#define __NR_readv (__NR_Linux + 18)
1079 +#define __NR_writev (__NR_Linux + 19)
1080 +#define __NR_access (__NR_Linux + 20)
1081 +#define __NR_pipe (__NR_Linux + 21)
1082 +#define __NR__newselect (__NR_Linux + 22)
1083 +#define __NR_sched_yield (__NR_Linux + 23)
1084 +#define __NR_mremap (__NR_Linux + 24)
1085 +#define __NR_msync (__NR_Linux + 25)
1086 +#define __NR_mincore (__NR_Linux + 26)
1087 +#define __NR_madvise (__NR_Linux + 27)
1088 +#define __NR_shmget (__NR_Linux + 28)
1089 +#define __NR_shmat (__NR_Linux + 29)
1090 +#define __NR_shmctl (__NR_Linux + 30)
1091 +#define __NR_dup (__NR_Linux + 31)
1092 +#define __NR_dup2 (__NR_Linux + 32)
1093 +#define __NR_pause (__NR_Linux + 33)
1094 +#define __NR_nanosleep (__NR_Linux + 34)
1095 +#define __NR_getitimer (__NR_Linux + 35)
1096 +#define __NR_setitimer (__NR_Linux + 36)
1097 +#define __NR_alarm (__NR_Linux + 37)
1098 +#define __NR_getpid (__NR_Linux + 38)
1099 +#define __NR_sendfile (__NR_Linux + 39)
1100 +#define __NR_socket (__NR_Linux + 40)
1101 +#define __NR_connect (__NR_Linux + 41)
1102 +#define __NR_accept (__NR_Linux + 42)
1103 +#define __NR_sendto (__NR_Linux + 43)
1104 +#define __NR_recvfrom (__NR_Linux + 44)
1105 +#define __NR_sendmsg (__NR_Linux + 45)
1106 +#define __NR_recvmsg (__NR_Linux + 46)
1107 +#define __NR_shutdown (__NR_Linux + 47)
1108 +#define __NR_bind (__NR_Linux + 48)
1109 +#define __NR_listen (__NR_Linux + 49)
1110 +#define __NR_getsockname (__NR_Linux + 50)
1111 +#define __NR_getpeername (__NR_Linux + 51)
1112 +#define __NR_socketpair (__NR_Linux + 52)
1113 +#define __NR_setsockopt (__NR_Linux + 53)
1114 +#define __NR_getsockopt (__NR_Linux + 54)
1115 +#define __NR_clone (__NR_Linux + 55)
1116 +#define __NR_fork (__NR_Linux + 56)
1117 +#define __NR_execve (__NR_Linux + 57)
1118 +#define __NR_exit (__NR_Linux + 58)
1119 +#define __NR_wait4 (__NR_Linux + 59)
1120 +#define __NR_kill (__NR_Linux + 60)
1121 +#define __NR_uname (__NR_Linux + 61)
1122 +#define __NR_semget (__NR_Linux + 62)
1123 +#define __NR_semop (__NR_Linux + 63)
1124 +#define __NR_semctl (__NR_Linux + 64)
1125 +#define __NR_shmdt (__NR_Linux + 65)
1126 +#define __NR_msgget (__NR_Linux + 66)
1127 +#define __NR_msgsnd (__NR_Linux + 67)
1128 +#define __NR_msgrcv (__NR_Linux + 68)
1129 +#define __NR_msgctl (__NR_Linux + 69)
1130 +#define __NR_fcntl (__NR_Linux + 70)
1131 +#define __NR_flock (__NR_Linux + 71)
1132 +#define __NR_fsync (__NR_Linux + 72)
1133 +#define __NR_fdatasync (__NR_Linux + 73)
1134 +#define __NR_truncate (__NR_Linux + 74)
1135 +#define __NR_ftruncate (__NR_Linux + 75)
1136 +#define __NR_getdents (__NR_Linux + 76)
1137 +#define __NR_getcwd (__NR_Linux + 77)
1138 +#define __NR_chdir (__NR_Linux + 78)
1139 +#define __NR_fchdir (__NR_Linux + 79)
1140 +#define __NR_rename (__NR_Linux + 80)
1141 +#define __NR_mkdir (__NR_Linux + 81)
1142 +#define __NR_rmdir (__NR_Linux + 82)
1143 +#define __NR_creat (__NR_Linux + 83)
1144 +#define __NR_link (__NR_Linux + 84)
1145 +#define __NR_unlink (__NR_Linux + 85)
1146 +#define __NR_symlink (__NR_Linux + 86)
1147 +#define __NR_readlink (__NR_Linux + 87)
1148 +#define __NR_chmod (__NR_Linux + 88)
1149 +#define __NR_fchmod (__NR_Linux + 89)
1150 +#define __NR_chown (__NR_Linux + 90)
1151 +#define __NR_fchown (__NR_Linux + 91)
1152 +#define __NR_lchown (__NR_Linux + 92)
1153 +#define __NR_umask (__NR_Linux + 93)
1154 +#define __NR_gettimeofday (__NR_Linux + 94)
1155 +#define __NR_getrlimit (__NR_Linux + 95)
1156 +#define __NR_getrusage (__NR_Linux + 96)
1157 +#define __NR_sysinfo (__NR_Linux + 97)
1158 +#define __NR_times (__NR_Linux + 98)
1159 +#define __NR_ptrace (__NR_Linux + 99)
1160 +#define __NR_getuid (__NR_Linux + 100)
1161 +#define __NR_syslog (__NR_Linux + 101)
1162 +#define __NR_getgid (__NR_Linux + 102)
1163 +#define __NR_setuid (__NR_Linux + 103)
1164 +#define __NR_setgid (__NR_Linux + 104)
1165 +#define __NR_geteuid (__NR_Linux + 105)
1166 +#define __NR_getegid (__NR_Linux + 106)
1167 +#define __NR_setpgid (__NR_Linux + 107)
1168 +#define __NR_getppid (__NR_Linux + 108)
1169 +#define __NR_getpgrp (__NR_Linux + 109)
1170 +#define __NR_setsid (__NR_Linux + 110)
1171 +#define __NR_setreuid (__NR_Linux + 111)
1172 +#define __NR_setregid (__NR_Linux + 112)
1173 +#define __NR_getgroups (__NR_Linux + 113)
1174 +#define __NR_setgroups (__NR_Linux + 114)
1175 +#define __NR_setresuid (__NR_Linux + 115)
1176 +#define __NR_getresuid (__NR_Linux + 116)
1177 +#define __NR_setresgid (__NR_Linux + 117)
1178 +#define __NR_getresgid (__NR_Linux + 118)
1179 +#define __NR_getpgid (__NR_Linux + 119)
1180 +#define __NR_setfsuid (__NR_Linux + 120)
1181 +#define __NR_setfsgid (__NR_Linux + 121)
1182 +#define __NR_getsid (__NR_Linux + 122)
1183 +#define __NR_capget (__NR_Linux + 123)
1184 +#define __NR_capset (__NR_Linux + 124)
1185 +#define __NR_rt_sigpending (__NR_Linux + 125)
1186 +#define __NR_rt_sigtimedwait (__NR_Linux + 126)
1187 +#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
1188 +#define __NR_rt_sigsuspend (__NR_Linux + 128)
1189 +#define __NR_sigaltstack (__NR_Linux + 129)
1190 +#define __NR_utime (__NR_Linux + 130)
1191 +#define __NR_mknod (__NR_Linux + 131)
1192 +#define __NR_personality (__NR_Linux + 132)
1193 +#define __NR_ustat (__NR_Linux + 133)
1194 +#define __NR_statfs (__NR_Linux + 134)
1195 +#define __NR_fstatfs (__NR_Linux + 135)
1196 +#define __NR_sysfs (__NR_Linux + 136)
1197 +#define __NR_getpriority (__NR_Linux + 137)
1198 +#define __NR_setpriority (__NR_Linux + 138)
1199 +#define __NR_sched_setparam (__NR_Linux + 139)
1200 +#define __NR_sched_getparam (__NR_Linux + 140)
1201 +#define __NR_sched_setscheduler (__NR_Linux + 141)
1202 +#define __NR_sched_getscheduler (__NR_Linux + 142)
1203 +#define __NR_sched_get_priority_max (__NR_Linux + 143)
1204 +#define __NR_sched_get_priority_min (__NR_Linux + 144)
1205 +#define __NR_sched_rr_get_interval (__NR_Linux + 145)
1206 +#define __NR_mlock (__NR_Linux + 146)
1207 +#define __NR_munlock (__NR_Linux + 147)
1208 +#define __NR_mlockall (__NR_Linux + 148)
1209 +#define __NR_munlockall (__NR_Linux + 149)
1210 +#define __NR_vhangup (__NR_Linux + 150)
1211 +#define __NR_pivot_root (__NR_Linux + 151)
1212 +#define __NR__sysctl (__NR_Linux + 152)
1213 +#define __NR_prctl (__NR_Linux + 153)
1214 +#define __NR_adjtimex (__NR_Linux + 154)
1215 +#define __NR_setrlimit (__NR_Linux + 155)
1216 +#define __NR_chroot (__NR_Linux + 156)
1217 +#define __NR_sync (__NR_Linux + 157)
1218 +#define __NR_acct (__NR_Linux + 158)
1219 +#define __NR_settimeofday (__NR_Linux + 159)
1220 +#define __NR_mount (__NR_Linux + 160)
1221 +#define __NR_umount2 (__NR_Linux + 161)
1222 +#define __NR_swapon (__NR_Linux + 162)
1223 +#define __NR_swapoff (__NR_Linux + 163)
1224 +#define __NR_reboot (__NR_Linux + 164)
1225 +#define __NR_sethostname (__NR_Linux + 165)
1226 +#define __NR_setdomainname (__NR_Linux + 166)
1227 +#define __NR_create_module (__NR_Linux + 167)
1228 +#define __NR_init_module (__NR_Linux + 168)
1229 +#define __NR_delete_module (__NR_Linux + 169)
1230 +#define __NR_get_kernel_syms (__NR_Linux + 170)
1231 +#define __NR_query_module (__NR_Linux + 171)
1232 +#define __NR_quotactl (__NR_Linux + 172)
1233 +#define __NR_nfsservctl (__NR_Linux + 173)
1234 +#define __NR_getpmsg (__NR_Linux + 174)
1235 +#define __NR_putpmsg (__NR_Linux + 175)
1236 +#define __NR_afs_syscall (__NR_Linux + 176)
1237 +#define __NR_reserved177 (__NR_Linux + 177)
1238 +#define __NR_gettid (__NR_Linux + 178)
1239 +#define __NR_readahead (__NR_Linux + 179)
1240 +#define __NR_setxattr (__NR_Linux + 180)
1241 +#define __NR_lsetxattr (__NR_Linux + 181)
1242 +#define __NR_fsetxattr (__NR_Linux + 182)
1243 +#define __NR_getxattr (__NR_Linux + 183)
1244 +#define __NR_lgetxattr (__NR_Linux + 184)
1245 +#define __NR_fgetxattr (__NR_Linux + 185)
1246 +#define __NR_listxattr (__NR_Linux + 186)
1247 +#define __NR_llistxattr (__NR_Linux + 187)
1248 +#define __NR_flistxattr (__NR_Linux + 188)
1249 +#define __NR_removexattr (__NR_Linux + 189)
1250 +#define __NR_lremovexattr (__NR_Linux + 190)
1251 +#define __NR_fremovexattr (__NR_Linux + 191)
1252 +#define __NR_tkill (__NR_Linux + 192)
1253 +#define __NR_reserved193 (__NR_Linux + 193)
1254 +#define __NR_futex (__NR_Linux + 194)
1255 +#define __NR_sched_setaffinity (__NR_Linux + 195)
1256 +#define __NR_sched_getaffinity (__NR_Linux + 196)
1257 +#define __NR_cacheflush (__NR_Linux + 197)
1258 +#define __NR_cachectl (__NR_Linux + 198)
1259 +#define __NR_sysmips (__NR_Linux + 199)
1260 +#define __NR_io_setup (__NR_Linux + 200)
1261 +#define __NR_io_destroy (__NR_Linux + 201)
1262 +#define __NR_io_getevents (__NR_Linux + 202)
1263 +#define __NR_io_submit (__NR_Linux + 203)
1264 +#define __NR_io_cancel (__NR_Linux + 204)
1265 +#define __NR_exit_group (__NR_Linux + 205)
1266 +#define __NR_lookup_dcookie (__NR_Linux + 206)
1267 +#define __NR_epoll_create (__NR_Linux + 207)
1268 +#define __NR_epoll_ctl (__NR_Linux + 208)
1269 +#define __NR_epoll_wait (__NR_Linux + 209)
1270 +#define __NR_remap_file_pages (__NR_Linux + 210)
1271 +#define __NR_rt_sigreturn (__NR_Linux + 211)
1272 +#define __NR_set_tid_address (__NR_Linux + 212)
1273 +#define __NR_restart_syscall (__NR_Linux + 213)
1274 +#define __NR_semtimedop (__NR_Linux + 214)
1275 +#define __NR_fadvise64 (__NR_Linux + 215)
1276 +#define __NR_timer_create (__NR_Linux + 216)
1277 +#define __NR_timer_settime (__NR_Linux + 217)
1278 +#define __NR_timer_gettime (__NR_Linux + 218)
1279 +#define __NR_timer_getoverrun (__NR_Linux + 219)
1280 +#define __NR_timer_delete (__NR_Linux + 220)
1281 +#define __NR_clock_settime (__NR_Linux + 221)
1282 +#define __NR_clock_gettime (__NR_Linux + 222)
1283 +#define __NR_clock_getres (__NR_Linux + 223)
1284 +#define __NR_clock_nanosleep (__NR_Linux + 224)
1285 +#define __NR_tgkill (__NR_Linux + 225)
1286 +#define __NR_utimes (__NR_Linux + 226)
1287 +#define __NR_mbind (__NR_Linux + 227)
1288 +#define __NR_get_mempolicy (__NR_Linux + 228)
1289 +#define __NR_set_mempolicy (__NR_Linux + 229)
1290 +#define __NR_mq_open (__NR_Linux + 230)
1291 +#define __NR_mq_unlink (__NR_Linux + 231)
1292 +#define __NR_mq_timedsend (__NR_Linux + 232)
1293 +#define __NR_mq_timedreceive (__NR_Linux + 233)
1294 +#define __NR_mq_notify (__NR_Linux + 234)
1295 +#define __NR_mq_getsetattr (__NR_Linux + 235)
1296 +#define __NR_vserver (__NR_Linux + 236)
1297 +#define __NR_waitid (__NR_Linux + 237)
1298 +/* #define __NR_sys_setaltroot (__NR_Linux + 238) */
1299 +#define __NR_add_key (__NR_Linux + 239)
1300 +#define __NR_request_key (__NR_Linux + 240)
1301 +#define __NR_keyctl (__NR_Linux + 241)
1302 +#define __NR_set_thread_area (__NR_Linux + 242)
1303 +#define __NR_inotify_init (__NR_Linux + 243)
1304 +#define __NR_inotify_add_watch (__NR_Linux + 244)
1305 +#define __NR_inotify_rm_watch (__NR_Linux + 245)
1306 +#define __NR_migrate_pages (__NR_Linux + 246)
1307 +#define __NR_openat (__NR_Linux + 247)
1308 +#define __NR_mkdirat (__NR_Linux + 248)
1309 +#define __NR_mknodat (__NR_Linux + 249)
1310 +#define __NR_fchownat (__NR_Linux + 250)
1311 +#define __NR_futimesat (__NR_Linux + 251)
1312 +#define __NR_newfstatat (__NR_Linux + 252)
1313 +#define __NR_unlinkat (__NR_Linux + 253)
1314 +#define __NR_renameat (__NR_Linux + 254)
1315 +#define __NR_linkat (__NR_Linux + 255)
1316 +#define __NR_symlinkat (__NR_Linux + 256)
1317 +#define __NR_readlinkat (__NR_Linux + 257)
1318 +#define __NR_fchmodat (__NR_Linux + 258)
1319 +#define __NR_faccessat (__NR_Linux + 259)
1320 +#define __NR_pselect6 (__NR_Linux + 260)
1321 +#define __NR_ppoll (__NR_Linux + 261)
1322 +#define __NR_unshare (__NR_Linux + 262)
1323 +#define __NR_splice (__NR_Linux + 263)
1324 +#define __NR_sync_file_range (__NR_Linux + 264)
1325 +#define __NR_tee (__NR_Linux + 265)
1326 +#define __NR_vmsplice (__NR_Linux + 266)
1327 +#define __NR_move_pages (__NR_Linux + 267)
1328 +#define __NR_set_robust_list (__NR_Linux + 268)
1329 +#define __NR_get_robust_list (__NR_Linux + 269)
1330 +#define __NR_kexec_load (__NR_Linux + 270)
1331 +#define __NR_getcpu (__NR_Linux + 271)
1332 +#define __NR_epoll_pwait (__NR_Linux + 272)
1333 +#define __NR_ioprio_set (__NR_Linux + 273)
1334 +#define __NR_ioprio_get (__NR_Linux + 274)
1335 +#define __NR_utimensat (__NR_Linux + 275)
1336 +#define __NR_signalfd (__NR_Linux + 276)
1337 +#define __NR_timerfd (__NR_Linux + 277)
1338 +#define __NR_eventfd (__NR_Linux + 278)
1339 +#define __NR_fallocate (__NR_Linux + 279)
1340 +#define __NR_timerfd_create (__NR_Linux + 280)
1341 +#define __NR_timerfd_gettime (__NR_Linux + 281)
1342 +#define __NR_timerfd_settime (__NR_Linux + 282)
1343 +#define __NR_signalfd4 (__NR_Linux + 283)
1344 +#define __NR_eventfd2 (__NR_Linux + 284)
1345 +#define __NR_epoll_create1 (__NR_Linux + 285)
1346 +#define __NR_dup3 (__NR_Linux + 286)
1347 +#define __NR_pipe2 (__NR_Linux + 287)
1348 +#define __NR_inotify_init1 (__NR_Linux + 288)
1349 +#define __NR_preadv (__NR_Linux + 289)
1350 +#define __NR_pwritev (__NR_Linux + 290)
1351 +#define __NR_rt_tgsigqueueinfo (__NR_Linux + 291)
1352 +#define __NR_perf_event_open (__NR_Linux + 292)
1353 +#define __NR_accept4 (__NR_Linux + 293)
1354 +#define __NR_recvmmsg (__NR_Linux + 294)
1355 +#define __NR_fanotify_init (__NR_Linux + 295)
1356 +#define __NR_fanotify_mark (__NR_Linux + 296)
1357 +#define __NR_prlimit64 (__NR_Linux + 297)
1358 +#define __NR_name_to_handle_at (__NR_Linux + 298)
1359 +#define __NR_open_by_handle_at (__NR_Linux + 299)
1360 +#define __NR_clock_adjtime (__NR_Linux + 300)
1361 +#define __NR_syncfs (__NR_Linux + 301)
1362 +#define __NR_sendmmsg (__NR_Linux + 302)
1363 +#define __NR_setns (__NR_Linux + 303)
1364 +#define __NR_process_vm_readv (__NR_Linux + 304)
1365 +#define __NR_process_vm_writev (__NR_Linux + 305)
1366 +#define __NR_kcmp (__NR_Linux + 306)
1367 +#define __NR_finit_module (__NR_Linux + 307)
1368 +#define __NR_getdents64 (__NR_Linux + 308)
1369 +#define __NR_sched_setattr (__NR_Linux + 309)
1370 +#define __NR_sched_getattr (__NR_Linux + 310)
1371 +#define __NR_renameat2 (__NR_Linux + 311)
1372 +#define __NR_seccomp (__NR_Linux + 312)
1373 +#define __NR_getrandom (__NR_Linux + 313)
1374 +#define __NR_memfd_create (__NR_Linux + 314)
1375 +#define __NR_bpf (__NR_Linux + 315)
1376 +#define __NR_execveat (__NR_Linux + 316)
1377 +
1378 +/* Repeated with SYS_ prefix */
1379 +#define SYS_Linux 5000
1380 +#define SYS_read (SYS_Linux + 0)
1381 +#define SYS_write (SYS_Linux + 1)
1382 +#define SYS_open (SYS_Linux + 2)
1383 +#define SYS_close (SYS_Linux + 3)
1384 +#define SYS_stat (SYS_Linux + 4)
1385 +#define SYS_fstat (SYS_Linux + 5)
1386 +#define SYS_lstat (SYS_Linux + 6)
1387 +#define SYS_poll (SYS_Linux + 7)
1388 +#define SYS_lseek (SYS_Linux + 8)
1389 +#define SYS_mmap (SYS_Linux + 9)
1390 +#define SYS_mprotect (SYS_Linux + 10)
1391 +#define SYS_munmap (SYS_Linux + 11)
1392 +#define SYS_brk (SYS_Linux + 12)
1393 +#define SYS_rt_sigaction (SYS_Linux + 13)
1394 +#define SYS_rt_sigprocmask (SYS_Linux + 14)
1395 +#define SYS_ioctl (SYS_Linux + 15)
1396 +#define SYS_pread64 (SYS_Linux + 16)
1397 +#define SYS_pwrite64 (SYS_Linux + 17)
1398 +#define SYS_readv (SYS_Linux + 18)
1399 +#define SYS_writev (SYS_Linux + 19)
1400 +#define SYS_access (SYS_Linux + 20)
1401 +#define SYS_pipe (SYS_Linux + 21)
1402 +#define SYS__newselect (SYS_Linux + 22)
1403 +#define SYS_sched_yield (SYS_Linux + 23)
1404 +#define SYS_mremap (SYS_Linux + 24)
1405 +#define SYS_msync (SYS_Linux + 25)
1406 +#define SYS_mincore (SYS_Linux + 26)
1407 +#define SYS_madvise (SYS_Linux + 27)
1408 +#define SYS_shmget (SYS_Linux + 28)
1409 +#define SYS_shmat (SYS_Linux + 29)
1410 +#define SYS_shmctl (SYS_Linux + 30)
1411 +#define SYS_dup (SYS_Linux + 31)
1412 +#define SYS_dup2 (SYS_Linux + 32)
1413 +#define SYS_pause (SYS_Linux + 33)
1414 +#define SYS_nanosleep (SYS_Linux + 34)
1415 +#define SYS_getitimer (SYS_Linux + 35)
1416 +#define SYS_setitimer (SYS_Linux + 36)
1417 +#define SYS_alarm (SYS_Linux + 37)
1418 +#define SYS_getpid (SYS_Linux + 38)
1419 +#define SYS_sendfile (SYS_Linux + 39)
1420 +#define SYS_socket (SYS_Linux + 40)
1421 +#define SYS_connect (SYS_Linux + 41)
1422 +#define SYS_accept (SYS_Linux + 42)
1423 +#define SYS_sendto (SYS_Linux + 43)
1424 +#define SYS_recvfrom (SYS_Linux + 44)
1425 +#define SYS_sendmsg (SYS_Linux + 45)
1426 +#define SYS_recvmsg (SYS_Linux + 46)
1427 +#define SYS_shutdown (SYS_Linux + 47)
1428 +#define SYS_bind (SYS_Linux + 48)
1429 +#define SYS_listen (SYS_Linux + 49)
1430 +#define SYS_getsockname (SYS_Linux + 50)
1431 +#define SYS_getpeername (SYS_Linux + 51)
1432 +#define SYS_socketpair (SYS_Linux + 52)
1433 +#define SYS_setsockopt (SYS_Linux + 53)
1434 +#define SYS_getsockopt (SYS_Linux + 54)
1435 +#define SYS_clone (SYS_Linux + 55)
1436 +#define SYS_fork (SYS_Linux + 56)
1437 +#define SYS_execve (SYS_Linux + 57)
1438 +#define SYS_exit (SYS_Linux + 58)
1439 +#define SYS_wait4 (SYS_Linux + 59)
1440 +#define SYS_kill (SYS_Linux + 60)
1441 +#define SYS_uname (SYS_Linux + 61)
1442 +#define SYS_semget (SYS_Linux + 62)
1443 +#define SYS_semop (SYS_Linux + 63)
1444 +#define SYS_semctl (SYS_Linux + 64)
1445 +#define SYS_shmdt (SYS_Linux + 65)
1446 +#define SYS_msgget (SYS_Linux + 66)
1447 +#define SYS_msgsnd (SYS_Linux + 67)
1448 +#define SYS_msgrcv (SYS_Linux + 68)
1449 +#define SYS_msgctl (SYS_Linux + 69)
1450 +#define SYS_fcntl (SYS_Linux + 70)
1451 +#define SYS_flock (SYS_Linux + 71)
1452 +#define SYS_fsync (SYS_Linux + 72)
1453 +#define SYS_fdatasync (SYS_Linux + 73)
1454 +#define SYS_truncate (SYS_Linux + 74)
1455 +#define SYS_ftruncate (SYS_Linux + 75)
1456 +#define SYS_getdents (SYS_Linux + 76)
1457 +#define SYS_getcwd (SYS_Linux + 77)
1458 +#define SYS_chdir (SYS_Linux + 78)
1459 +#define SYS_fchdir (SYS_Linux + 79)
1460 +#define SYS_rename (SYS_Linux + 80)
1461 +#define SYS_mkdir (SYS_Linux + 81)
1462 +#define SYS_rmdir (SYS_Linux + 82)
1463 +#define SYS_creat (SYS_Linux + 83)
1464 +#define SYS_link (SYS_Linux + 84)
1465 +#define SYS_unlink (SYS_Linux + 85)
1466 +#define SYS_symlink (SYS_Linux + 86)
1467 +#define SYS_readlink (SYS_Linux + 87)
1468 +#define SYS_chmod (SYS_Linux + 88)
1469 +#define SYS_fchmod (SYS_Linux + 89)
1470 +#define SYS_chown (SYS_Linux + 90)
1471 +#define SYS_fchown (SYS_Linux + 91)
1472 +#define SYS_lchown (SYS_Linux + 92)
1473 +#define SYS_umask (SYS_Linux + 93)
1474 +#define SYS_gettimeofday (SYS_Linux + 94)
1475 +#define SYS_getrlimit (SYS_Linux + 95)
1476 +#define SYS_getrusage (SYS_Linux + 96)
1477 +#define SYS_sysinfo (SYS_Linux + 97)
1478 +#define SYS_times (SYS_Linux + 98)
1479 +#define SYS_ptrace (SYS_Linux + 99)
1480 +#define SYS_getuid (SYS_Linux + 100)
1481 +#define SYS_syslog (SYS_Linux + 101)
1482 +#define SYS_getgid (SYS_Linux + 102)
1483 +#define SYS_setuid (SYS_Linux + 103)
1484 +#define SYS_setgid (SYS_Linux + 104)
1485 +#define SYS_geteuid (SYS_Linux + 105)
1486 +#define SYS_getegid (SYS_Linux + 106)
1487 +#define SYS_setpgid (SYS_Linux + 107)
1488 +#define SYS_getppid (SYS_Linux + 108)
1489 +#define SYS_getpgrp (SYS_Linux + 109)
1490 +#define SYS_setsid (SYS_Linux + 110)
1491 +#define SYS_setreuid (SYS_Linux + 111)
1492 +#define SYS_setregid (SYS_Linux + 112)
1493 +#define SYS_getgroups (SYS_Linux + 113)
1494 +#define SYS_setgroups (SYS_Linux + 114)
1495 +#define SYS_setresuid (SYS_Linux + 115)
1496 +#define SYS_getresuid (SYS_Linux + 116)
1497 +#define SYS_setresgid (SYS_Linux + 117)
1498 +#define SYS_getresgid (SYS_Linux + 118)
1499 +#define SYS_getpgid (SYS_Linux + 119)
1500 +#define SYS_setfsuid (SYS_Linux + 120)
1501 +#define SYS_setfsgid (SYS_Linux + 121)
1502 +#define SYS_getsid (SYS_Linux + 122)
1503 +#define SYS_capget (SYS_Linux + 123)
1504 +#define SYS_capset (SYS_Linux + 124)
1505 +#define SYS_rt_sigpending (SYS_Linux + 125)
1506 +#define SYS_rt_sigtimedwait (SYS_Linux + 126)
1507 +#define SYS_rt_sigqueueinfo (SYS_Linux + 127)
1508 +#define SYS_rt_sigsuspend (SYS_Linux + 128)
1509 +#define SYS_sigaltstack (SYS_Linux + 129)
1510 +#define SYS_utime (SYS_Linux + 130)
1511 +#define SYS_mknod (SYS_Linux + 131)
1512 +#define SYS_personality (SYS_Linux + 132)
1513 +#define SYS_ustat (SYS_Linux + 133)
1514 +#define SYS_statfs (SYS_Linux + 134)
1515 +#define SYS_fstatfs (SYS_Linux + 135)
1516 +#define SYS_sysfs (SYS_Linux + 136)
1517 +#define SYS_getpriority (SYS_Linux + 137)
1518 +#define SYS_setpriority (SYS_Linux + 138)
1519 +#define SYS_sched_setparam (SYS_Linux + 139)
1520 +#define SYS_sched_getparam (SYS_Linux + 140)
1521 +#define SYS_sched_setscheduler (SYS_Linux + 141)
1522 +#define SYS_sched_getscheduler (SYS_Linux + 142)
1523 +#define SYS_sched_get_priority_max (SYS_Linux + 143)
1524 +#define SYS_sched_get_priority_min (SYS_Linux + 144)
1525 +#define SYS_sched_rr_get_interval (SYS_Linux + 145)
1526 +#define SYS_mlock (SYS_Linux + 146)
1527 +#define SYS_munlock (SYS_Linux + 147)
1528 +#define SYS_mlockall (SYS_Linux + 148)
1529 +#define SYS_munlockall (SYS_Linux + 149)
1530 +#define SYS_vhangup (SYS_Linux + 150)
1531 +#define SYS_pivot_root (SYS_Linux + 151)
1532 +#define SYS__sysctl (SYS_Linux + 152)
1533 +#define SYS_prctl (SYS_Linux + 153)
1534 +#define SYS_adjtimex (SYS_Linux + 154)
1535 +#define SYS_setrlimit (SYS_Linux + 155)
1536 +#define SYS_chroot (SYS_Linux + 156)
1537 +#define SYS_sync (SYS_Linux + 157)
1538 +#define SYS_acct (SYS_Linux + 158)
1539 +#define SYS_settimeofday (SYS_Linux + 159)
1540 +#define SYS_mount (SYS_Linux + 160)
1541 +#define SYS_umount2 (SYS_Linux + 161)
1542 +#define SYS_swapon (SYS_Linux + 162)
1543 +#define SYS_swapoff (SYS_Linux + 163)
1544 +#define SYS_reboot (SYS_Linux + 164)
1545 +#define SYS_sethostname (SYS_Linux + 165)
1546 +#define SYS_setdomainname (SYS_Linux + 166)
1547 +#define SYS_create_module (SYS_Linux + 167)
1548 +#define SYS_init_module (SYS_Linux + 168)
1549 +#define SYS_delete_module (SYS_Linux + 169)
1550 +#define SYS_get_kernel_syms (SYS_Linux + 170)
1551 +#define SYS_query_module (SYS_Linux + 171)
1552 +#define SYS_quotactl (SYS_Linux + 172)
1553 +#define SYS_nfsservctl (SYS_Linux + 173)
1554 +#define SYS_getpmsg (SYS_Linux + 174)
1555 +#define SYS_putpmsg (SYS_Linux + 175)
1556 +#define SYS_afs_syscall (SYS_Linux + 176)
1557 +#define SYS_reserved177 (SYS_Linux + 177)
1558 +#define SYS_gettid (SYS_Linux + 178)
1559 +#define SYS_readahead (SYS_Linux + 179)
1560 +#define SYS_setxattr (SYS_Linux + 180)
1561 +#define SYS_lsetxattr (SYS_Linux + 181)
1562 +#define SYS_fsetxattr (SYS_Linux + 182)
1563 +#define SYS_getxattr (SYS_Linux + 183)
1564 +#define SYS_lgetxattr (SYS_Linux + 184)
1565 +#define SYS_fgetxattr (SYS_Linux + 185)
1566 +#define SYS_listxattr (SYS_Linux + 186)
1567 +#define SYS_llistxattr (SYS_Linux + 187)
1568 +#define SYS_flistxattr (SYS_Linux + 188)
1569 +#define SYS_removexattr (SYS_Linux + 189)
1570 +#define SYS_lremovexattr (SYS_Linux + 190)
1571 +#define SYS_fremovexattr (SYS_Linux + 191)
1572 +#define SYS_tkill (SYS_Linux + 192)
1573 +#define SYS_reserved193 (SYS_Linux + 193)
1574 +#define SYS_futex (SYS_Linux + 194)
1575 +#define SYS_sched_setaffinity (SYS_Linux + 195)
1576 +#define SYS_sched_getaffinity (SYS_Linux + 196)
1577 +#define SYS_cacheflush (SYS_Linux + 197)
1578 +#define SYS_cachectl (SYS_Linux + 198)
1579 +#define SYS_sysmips (SYS_Linux + 199)
1580 +#define SYS_io_setup (SYS_Linux + 200)
1581 +#define SYS_io_destroy (SYS_Linux + 201)
1582 +#define SYS_io_getevents (SYS_Linux + 202)
1583 +#define SYS_io_submit (SYS_Linux + 203)
1584 +#define SYS_io_cancel (SYS_Linux + 204)
1585 +#define SYS_exit_group (SYS_Linux + 205)
1586 +#define SYS_lookup_dcookie (SYS_Linux + 206)
1587 +#define SYS_epoll_create (SYS_Linux + 207)
1588 +#define SYS_epoll_ctl (SYS_Linux + 208)
1589 +#define SYS_epoll_wait (SYS_Linux + 209)
1590 +#define SYS_remap_file_pages (SYS_Linux + 210)
1591 +#define SYS_rt_sigreturn (SYS_Linux + 211)
1592 +#define SYS_set_tid_address (SYS_Linux + 212)
1593 +#define SYS_restart_syscall (SYS_Linux + 213)
1594 +#define SYS_semtimedop (SYS_Linux + 214)
1595 +#define SYS_fadvise64 (SYS_Linux + 215)
1596 +#define SYS_timer_create (SYS_Linux + 216)
1597 +#define SYS_timer_settime (SYS_Linux + 217)
1598 +#define SYS_timer_gettime (SYS_Linux + 218)
1599 +#define SYS_timer_getoverrun (SYS_Linux + 219)
1600 +#define SYS_timer_delete (SYS_Linux + 220)
1601 +#define SYS_clock_settime (SYS_Linux + 221)
1602 +#define SYS_clock_gettime (SYS_Linux + 222)
1603 +#define SYS_clock_getres (SYS_Linux + 223)
1604 +#define SYS_clock_nanosleep (SYS_Linux + 224)
1605 +#define SYS_tgkill (SYS_Linux + 225)
1606 +#define SYS_utimes (SYS_Linux + 226)
1607 +#define SYS_mbind (SYS_Linux + 227)
1608 +#define SYS_get_mempolicy (SYS_Linux + 228)
1609 +#define SYS_set_mempolicy (SYS_Linux + 229)
1610 +#define SYS_mq_open (SYS_Linux + 230)
1611 +#define SYS_mq_unlink (SYS_Linux + 231)
1612 +#define SYS_mq_timedsend (SYS_Linux + 232)
1613 +#define SYS_mq_timedreceive (SYS_Linux + 233)
1614 +#define SYS_mq_notify (SYS_Linux + 234)
1615 +#define SYS_mq_getsetattr (SYS_Linux + 235)
1616 +#define SYS_vserver (SYS_Linux + 236)
1617 +#define SYS_waitid (SYS_Linux + 237)
1618 +/* #define SYS_sys_setaltroot (SYS_Linux + 238) */
1619 +#define SYS_add_key (SYS_Linux + 239)
1620 +#define SYS_request_key (SYS_Linux + 240)
1621 +#define SYS_keyctl (SYS_Linux + 241)
1622 +#define SYS_set_thread_area (SYS_Linux + 242)
1623 +#define SYS_inotify_init (SYS_Linux + 243)
1624 +#define SYS_inotify_add_watch (SYS_Linux + 244)
1625 +#define SYS_inotify_rm_watch (SYS_Linux + 245)
1626 +#define SYS_migrate_pages (SYS_Linux + 246)
1627 +#define SYS_openat (SYS_Linux + 247)
1628 +#define SYS_mkdirat (SYS_Linux + 248)
1629 +#define SYS_mknodat (SYS_Linux + 249)
1630 +#define SYS_fchownat (SYS_Linux + 250)
1631 +#define SYS_futimesat (SYS_Linux + 251)
1632 +#define SYS_newfstatat (SYS_Linux + 252)
1633 +#define SYS_unlinkat (SYS_Linux + 253)
1634 +#define SYS_renameat (SYS_Linux + 254)
1635 +#define SYS_linkat (SYS_Linux + 255)
1636 +#define SYS_symlinkat (SYS_Linux + 256)
1637 +#define SYS_readlinkat (SYS_Linux + 257)
1638 +#define SYS_fchmodat (SYS_Linux + 258)
1639 +#define SYS_faccessat (SYS_Linux + 259)
1640 +#define SYS_pselect6 (SYS_Linux + 260)
1641 +#define SYS_ppoll (SYS_Linux + 261)
1642 +#define SYS_unshare (SYS_Linux + 262)
1643 +#define SYS_splice (SYS_Linux + 263)
1644 +#define SYS_sync_file_range (SYS_Linux + 264)
1645 +#define SYS_tee (SYS_Linux + 265)
1646 +#define SYS_vmsplice (SYS_Linux + 266)
1647 +#define SYS_move_pages (SYS_Linux + 267)
1648 +#define SYS_set_robust_list (SYS_Linux + 268)
1649 +#define SYS_get_robust_list (SYS_Linux + 269)
1650 +#define SYS_kexec_load (SYS_Linux + 270)
1651 +#define SYS_getcpu (SYS_Linux + 271)
1652 +#define SYS_epoll_pwait (SYS_Linux + 272)
1653 +#define SYS_ioprio_set (SYS_Linux + 273)
1654 +#define SYS_ioprio_get (SYS_Linux + 274)
1655 +#define SYS_utimensat (SYS_Linux + 275)
1656 +#define SYS_signalfd (SYS_Linux + 276)
1657 +#define SYS_timerfd (SYS_Linux + 277)
1658 +#define SYS_eventfd (SYS_Linux + 278)
1659 +#define SYS_fallocate (SYS_Linux + 279)
1660 +#define SYS_timerfd_create (SYS_Linux + 280)
1661 +#define SYS_timerfd_gettime (SYS_Linux + 281)
1662 +#define SYS_timerfd_settime (SYS_Linux + 282)
1663 +#define SYS_signalfd4 (SYS_Linux + 283)
1664 +#define SYS_eventfd2 (SYS_Linux + 284)
1665 +#define SYS_epoll_create1 (SYS_Linux + 285)
1666 +#define SYS_dup3 (SYS_Linux + 286)
1667 +#define SYS_pipe2 (SYS_Linux + 287)
1668 +#define SYS_inotify_init1 (SYS_Linux + 288)
1669 +#define SYS_preadv (SYS_Linux + 289)
1670 +#define SYS_pwritev (SYS_Linux + 290)
1671 +#define SYS_rt_tgsigqueueinfo (SYS_Linux + 291)
1672 +#define SYS_perf_event_open (SYS_Linux + 292)
1673 +#define SYS_accept4 (SYS_Linux + 293)
1674 +#define SYS_recvmmsg (SYS_Linux + 294)
1675 +#define SYS_fanotify_init (SYS_Linux + 295)
1676 +#define SYS_fanotify_mark (SYS_Linux + 296)
1677 +#define SYS_prlimit64 (SYS_Linux + 297)
1678 +#define SYS_name_to_handle_at (SYS_Linux + 298)
1679 +#define SYS_open_by_handle_at (SYS_Linux + 299)
1680 +#define SYS_clock_adjtime (SYS_Linux + 300)
1681 +#define SYS_syncfs (SYS_Linux + 301)
1682 +#define SYS_sendmmsg (SYS_Linux + 302)
1683 +#define SYS_setns (SYS_Linux + 303)
1684 +#define SYS_process_vm_readv (SYS_Linux + 304)
1685 +#define SYS_process_vm_writev (SYS_Linux + 305)
1686 +#define SYS_kcmp (SYS_Linux + 306)
1687 +#define SYS_finit_module (SYS_Linux + 307)
1688 +#define SYS_getdents64 (SYS_Linux + 308)
1689 +#define SYS_sched_setattr (SYS_Linux + 309)
1690 +#define SYS_sched_getattr (SYS_Linux + 310)
1691 +#define SYS_renameat2 (SYS_Linux + 311)
1692 +#define SYS_seccomp (SYS_Linux + 312)
1693 +#define SYS_getrandom (SYS_Linux + 313)
1694 +#define SYS_memfd_create (SYS_Linux + 314)
1695 +#define SYS_bpf (SYS_Linux + 315)
1696 +#define SYS_execveat (SYS_Linux + 316)
1697 +
1698 +
1699 +
1700 --- /dev/null
1701 +++ b/arch/mips64/bits/termios.h
1702 @@ -0,0 +1,167 @@
1703 +struct termios
1704 +{
1705 + tcflag_t c_iflag;
1706 + tcflag_t c_oflag;
1707 + tcflag_t c_cflag;
1708 + tcflag_t c_lflag;
1709 + cc_t c_line;
1710 + cc_t c_cc[NCCS];
1711 +};
1712 +
1713 +#define VINTR 0
1714 +#define VQUIT 1
1715 +#define VERASE 2
1716 +#define VKILL 3
1717 +#define VMIN 4
1718 +#define VTIME 5
1719 +#define VEOL2 6
1720 +#define VSWTC 7
1721 +#define VSWTCH 7
1722 +#define VSTART 8
1723 +#define VSTOP 9
1724 +#define VSUSP 10
1725 +#define VREPRINT 12
1726 +#define VDISCARD 13
1727 +#define VWERASE 14
1728 +#define VLNEXT 15
1729 +#define VEOF 16
1730 +#define VEOL 17
1731 +
1732 +#define IGNBRK 0000001
1733 +#define BRKINT 0000002
1734 +#define IGNPAR 0000004
1735 +#define PARMRK 0000010
1736 +#define INPCK 0000020
1737 +#define ISTRIP 0000040
1738 +#define INLCR 0000100
1739 +#define IGNCR 0000200
1740 +#define ICRNL 0000400
1741 +#define IUCLC 0001000
1742 +#define IXON 0002000
1743 +#define IXANY 0004000
1744 +#define IXOFF 0010000
1745 +#define IMAXBEL 0020000
1746 +#define IUTF8 0040000
1747 +
1748 +#define OPOST 0000001
1749 +#define OLCUC 0000002
1750 +#define ONLCR 0000004
1751 +#define OCRNL 0000010
1752 +#define ONOCR 0000020
1753 +#define ONLRET 0000040
1754 +#define OFILL 0000100
1755 +#define OFDEL 0000200
1756 +#define NLDLY 0000400
1757 +#define NL0 0000000
1758 +#define NL1 0000400
1759 +#define CRDLY 0003000
1760 +#define CR0 0000000
1761 +#define CR1 0001000
1762 +#define CR2 0002000
1763 +#define CR3 0003000
1764 +#define TABDLY 0014000
1765 +#define TAB0 0000000
1766 +#define TAB1 0004000
1767 +#define TAB2 0010000
1768 +#define TAB3 0014000
1769 +#define BSDLY 0020000
1770 +#define BS0 0000000
1771 +#define BS1 0020000
1772 +#define FFDLY 0100000
1773 +#define FF0 0000000
1774 +#define FF1 0100000
1775 +
1776 +#define VTDLY 0040000
1777 +#define VT0 0000000
1778 +#define VT1 0040000
1779 +
1780 +#define B0 0000000
1781 +#define B50 0000001
1782 +#define B75 0000002
1783 +#define B110 0000003
1784 +#define B134 0000004
1785 +#define B150 0000005
1786 +#define B200 0000006
1787 +#define B300 0000007
1788 +#define B600 0000010
1789 +#define B1200 0000011
1790 +#define B1800 0000012
1791 +#define B2400 0000013
1792 +#define B4800 0000014
1793 +#define B9600 0000015
1794 +#define B19200 0000016
1795 +#define B38400 0000017
1796 +#define EXTA 0000016
1797 +#define EXTB 0000017
1798 +
1799 +#define BOTHER 0010000
1800 +#define B57600 0010001
1801 +#define B115200 0010002
1802 +#define B230400 0010003
1803 +#define B460800 0010004
1804 +#define B500000 0010005
1805 +#define B576000 0010006
1806 +#define B921600 0010007
1807 +#define B1000000 0010010
1808 +#define B1152000 0010011
1809 +#define B1500000 0010012
1810 +#define B2000000 0010013
1811 +#define B2500000 0010014
1812 +#define B3000000 0010015
1813 +#define B3500000 0010016
1814 +#define B4000000 0010017
1815 +
1816 +#define CBAUD 0010017
1817 +
1818 +#define CSIZE 0000060
1819 +#define CS5 0000000
1820 +#define CS6 0000020
1821 +#define CS7 0000040
1822 +#define CS8 0000060
1823 +#define CSTOPB 0000100
1824 +#define CREAD 0000200
1825 +#define PARENB 0000400
1826 +#define PARODD 0001000
1827 +#define HUPCL 0002000
1828 +#define CLOCAL 0004000
1829 +
1830 +#define ISIG 0000001
1831 +#define ICANON 0000002
1832 +#define XCASE 0000004
1833 +#define ECHO 0000010
1834 +#define ECHOE 0000020
1835 +#define ECHOK 0000040
1836 +#define ECHONL 0000100
1837 +#define NOFLSH 0000200
1838 +#define IEXTEN 0000400
1839 +#define ECHOCTL 0001000
1840 +#define ECHOPRT 0002000
1841 +#define ECHOKE 0004000
1842 +#define FLUSHO 0020000
1843 +#define PENDIN 0040000
1844 +#define TOSTOP 0100000
1845 +#define ITOSTOP 0100000
1846 +
1847 +#define TCOOFF 0
1848 +#define TCOON 1
1849 +#define TCIOFF 2
1850 +#define TCION 3
1851 +
1852 +#define TCIFLUSH 0
1853 +#define TCOFLUSH 1
1854 +#define TCIOFLUSH 2
1855 +
1856 +#define TCSANOW 0
1857 +#define TCSADRAIN 1
1858 +#define TCSAFLUSH 2
1859 +
1860 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
1861 +#define CBAUDEX 0010000
1862 +#define CIBAUD 002003600000
1863 +#define IBSHIFT 16
1864 +#define CMSPAR 010000000000
1865 +#define CRTSCTS 020000000000
1866 +#define EXTPROC 0200000
1867 +#define XTABS 0014000
1868 +#define TIOCSER_TEMT 1
1869 +#endif
1870 --- /dev/null
1871 +++ b/arch/mips64/bits/user.h
1872 @@ -0,0 +1,13 @@
1873 +struct user {
1874 + unsigned long regs[38+64];
1875 + unsigned long u_tsize, u_dsize, u_ssize;
1876 + unsigned long long start_code, start_data, start_stack;
1877 + long long signal;
1878 + unsigned long long *u_ar0;
1879 + unsigned long long magic;
1880 + char u_comm[32];
1881 +};
1882 +#define ELF_NGREG 45
1883 +#define ELF_NFPREG 33
1884 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
1885 +typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
1886 --- /dev/null
1887 +++ b/arch/mips64/crt_arch.h
1888 @@ -0,0 +1,33 @@
1889 +__asm__(
1890 +".set push\n"
1891 +".set noreorder\n"
1892 +".text \n"
1893 +".global _" START "\n"
1894 +".global " START "\n"
1895 +".global " START "_data\n"
1896 +".type _" START ", @function\n"
1897 +".type " START ", @function\n"
1898 +".type " START "_data, @function\n"
1899 +"_" START ":\n"
1900 +"" START ":\n"
1901 +".align 8 \n"
1902 +" bal 1f \n"
1903 +" move $fp, $0 \n"
1904 +"" START "_data: \n"
1905 +" .gpdword " START "_data \n"
1906 +" .gpdword " START "_c \n"
1907 +".weak _DYNAMIC \n"
1908 +".hidden _DYNAMIC \n"
1909 +" .gpdword _DYNAMIC \n"
1910 +"1: ld $gp, 0($ra) \n"
1911 +" dsubu $gp, $ra, $gp \n"
1912 +" move $4, $sp \n"
1913 +" ld $5, 16($ra) \n"
1914 +" daddu $5, $5, $gp \n"
1915 +" ld $25, 8($ra) \n"
1916 +" daddu $25, $25, $gp \n"
1917 +" and $sp, $sp, -16 \n"
1918 +" jalr $25 \n"
1919 +" nop \n"
1920 +".set pop \n"
1921 +);
1922 --- /dev/null
1923 +++ b/arch/mips64/ksigaction.h
1924 @@ -0,0 +1,11 @@
1925 +struct k_sigaction {
1926 + unsigned flags;
1927 + void (*handler)(int);
1928 + unsigned long mask[2]; /*mask [128/(sizeof(long)*8)]
1929 + /* The following field is past the end of the structure the
1930 + * kernel will read or write, and exists only to avoid having
1931 + * mips-specific preprocessor conditionals in sigaction.c. */
1932 + void (*restorer)();
1933 +};
1934 +
1935 +void __restore(), __restore_rt();
1936 --- /dev/null
1937 +++ b/arch/mips64/pthread_arch.h
1938 @@ -0,0 +1,18 @@
1939 +static inline struct pthread *__pthread_self()
1940 +{
1941 +#ifdef __clang__
1942 + char *tp;
1943 + __asm__ __volatile__ (".word 0x7c03e83b ; move %0, $3" : "=r" (tp) : : "$3" );
1944 +#else
1945 + register char *tp __asm__("$3");
1946 + __asm__ __volatile__ (".word 0x7c03e83b" : "=r" (tp) );
1947 +#endif
1948 + return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
1949 +}
1950 +
1951 +#define TLS_ABOVE_TP
1952 +#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
1953 +
1954 +#define DTP_OFFSET 0x8000
1955 +
1956 +#define MC_PC pc
1957 --- /dev/null
1958 +++ b/arch/mips64/reloc.h
1959 @@ -0,0 +1,52 @@
1960 +#ifndef __RELOC_H__
1961 +#define __RELOC_H__
1962 +
1963 +#include <endian.h>
1964 +
1965 +#if __BYTE_ORDER == __LITTLE_ENDIAN
1966 +#define ENDIAN_SUFFIX "el"
1967 +#else
1968 +#define ENDIAN_SUFFIX ""
1969 +#endif
1970 +
1971 +#ifdef __mips_soft_float
1972 +#define FP_SUFFIX "-sf"
1973 +#else
1974 +#define FP_SUFFIX ""
1975 +#endif
1976 +
1977 +#define LDSO_ARCH "mips64" ENDIAN_SUFFIX FP_SUFFIX
1978 +
1979 +#define TPOFF_K (-0x7000)
1980 +
1981 +#define REL_SYM_OR_REL 4611 /* (R_MIPS_64 << 8) | R_MIPS_REL32 */
1982 +#define REL_PLT R_MIPS_JUMP_SLOT
1983 +#define REL_COPY R_MIPS_COPY
1984 +#define REL_DTPMOD R_MIPS_TLS_DTPMOD64
1985 +#define REL_DTPOFF R_MIPS_TLS_DTPREL64
1986 +#define REL_TPOFF R_MIPS_TLS_TPREL64
1987 +
1988 +#define NEED_MIPS_GOT_RELOCS 1
1989 +#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
1990 +#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
1991 +
1992 +#define CRTJMP(pc,sp) __asm__ __volatile__( \
1993 + "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
1994 +
1995 +#define GETFUNCSYM(fp, sym, got) __asm__ ( \
1996 + ".hidden " #sym "\n" \
1997 + ".set push \n" \
1998 + ".set noreorder \n" \
1999 + ".align 8 \n" \
2000 + " bal 1f \n" \
2001 + " nop \n" \
2002 + " .gpdword . \n" \
2003 + " .gpdword " #sym " \n" \
2004 + "1: ld %0, ($ra) \n" \
2005 + " dsubu %0, $ra, %0 \n" \
2006 + " ld $ra, 8($ra) \n" \
2007 + " daddu %0, %0, $ra \n" \
2008 + ".set pop \n" \
2009 + : "=r"(*(fp)) : : "memory", "ra" )
2010 +
2011 +#endif
2012 --- /dev/null
2013 +++ b/arch/mips64/syscall_arch.h
2014 @@ -0,0 +1,213 @@
2015 +#define __SYSCALL_LL_E(x) (x)
2016 +#define __SYSCALL_LL_O(x) (x)
2017 +
2018 +__attribute__((visibility("hidden")))
2019 +long (__syscall)(long, ...);
2020 +
2021 +#define SYSCALL_RLIM_INFINITY (-1UL/2)
2022 +
2023 +#include <sys/stat.h>
2024 +struct kernel_stat {
2025 + unsigned int st_dev;
2026 + unsigned int __pad1[3];
2027 + unsigned long long st_ino;
2028 + unsigned int st_mode;
2029 + unsigned int st_nlink;
2030 + int st_uid;
2031 + int st_gid;
2032 + unsigned int st_rdev;
2033 + unsigned int __pad2[3];
2034 + long long st_size;
2035 + unsigned int st_atime_sec;
2036 + unsigned int st_atime_nsec;
2037 + unsigned int st_mtime_sec;
2038 + unsigned int st_mtime_nsec;
2039 + unsigned int st_ctime_sec;
2040 + unsigned int st_ctime_nsec;
2041 + unsigned int st_blksize;
2042 + unsigned int __pad3;
2043 + unsigned long long st_blocks;
2044 +};
2045 +
2046 +static void __stat_fix(struct kernel_stat *kst, struct stat *st)
2047 +{
2048 + extern void *memset(void *s, int c, size_t n);
2049 +
2050 + st->st_dev = kst->st_dev;
2051 + memset (&st->st_pad1, 0, sizeof (st->st_pad1));
2052 + st->st_ino = kst->st_ino;
2053 + st->st_mode = kst->st_mode;
2054 + st->st_nlink = kst->st_nlink;
2055 + st->st_uid = kst->st_uid;
2056 + st->st_gid = kst->st_gid;
2057 + st->st_rdev = kst->st_rdev;
2058 + memset (&st->st_pad2, 0, sizeof (st->st_pad2));
2059 + st->st_size = kst->st_size;
2060 + st->st_pad3 = 0;
2061 + st->st_atim.tv_sec = kst->st_atime_sec;
2062 + st->st_atim.tv_nsec = kst->st_atime_nsec;
2063 + st->st_mtim.tv_sec = kst->st_mtime_sec;
2064 + st->st_mtim.tv_nsec = kst->st_mtime_nsec;
2065 + st->st_ctim.tv_sec = kst->st_ctime_sec;
2066 + st->st_ctim.tv_nsec = kst->st_ctime_nsec;
2067 + st->st_blksize = kst->st_blksize;
2068 + st->st_blocks = kst->st_blocks;
2069 + memset (&st->st_pad5, 0, sizeof (st->st_pad5));
2070 + return;
2071 +}
2072 +
2073 +#ifndef __clang__
2074 +
2075 +static inline long __syscall0(long n)
2076 +{
2077 + register long r7 __asm__("$7");
2078 + register long r2 __asm__("$2");
2079 + __asm__ __volatile__ (
2080 + "daddu $2,$0,%2 ; syscall"
2081 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
2082 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2083 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2084 + return r7 ? -r2 : r2;
2085 +}
2086 +
2087 +static inline long __syscall1(long n, long a)
2088 +{
2089 + register long r4 __asm__("$4") = a;
2090 + register long r7 __asm__("$7");
2091 + register long r2 __asm__("$2");
2092 + __asm__ __volatile__ (
2093 + "daddu $2,$0,%2 ; syscall"
2094 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2095 + "r"(r4)
2096 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2097 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2098 + return r7 ? -r2 : r2;
2099 +}
2100 +
2101 +static inline long __syscall2(long n, long a, long b)
2102 +{
2103 + struct kernel_stat kst = {0,};
2104 + long ret;
2105 + register long r4 __asm__("$4");
2106 + register long r5 __asm__("$5");
2107 + register long r7 __asm__("$7");
2108 + register long r2 __asm__("$2");
2109 +
2110 + r5 = b;
2111 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2112 + r5 = (long) &kst;
2113 +
2114 + r4 = a;
2115 + __asm__ __volatile__ (
2116 + "daddu $2,$0,%2 ; syscall"
2117 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2118 + "r"(r4), "r"(r5)
2119 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2120 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2121 +
2122 + if (r7) return -r2;
2123 + ret = r2;
2124 +
2125 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2126 + __stat_fix(&kst, (struct stat *)b);
2127 +
2128 + return ret;
2129 +}
2130 +
2131 +static inline long __syscall3(long n, long a, long b, long c)
2132 +{
2133 + register long r4 __asm__("$4") = a;
2134 + register long r5 __asm__("$5") = b;
2135 + register long r6 __asm__("$6") = c;
2136 + register long r7 __asm__("$7");
2137 + register long r2 __asm__("$2");
2138 + __asm__ __volatile__ (
2139 + "daddu $2,$0,%2 ; syscall"
2140 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2141 + "r"(r4), "r"(r5), "r"(r6)
2142 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2143 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2144 + return r7 ? -r2 : r2;
2145 +}
2146 +
2147 +static inline long __syscall4(long n, long a, long b, long c, long d)
2148 +{
2149 + register long r4 __asm__("$4") = a;
2150 + register long r5 __asm__("$5") = b;
2151 + register long r6 __asm__("$6") = c;
2152 + register long r7 __asm__("$7") = d;
2153 + register long r2 __asm__("$2");
2154 + __asm__ __volatile__ (
2155 + "daddu $2,$0,%2 ; syscall"
2156 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2157 + "r"(r4), "r"(r5), "r"(r6)
2158 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2159 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2160 + return r7 ? -r2 : r2;
2161 +}
2162 +
2163 +#else
2164 +
2165 +static inline long __syscall0(long n)
2166 +{
2167 + return (__syscall)(n);
2168 +}
2169 +
2170 +static inline long __syscall1(long n, long a)
2171 +{
2172 + return (__syscall)(n, a);
2173 +}
2174 +
2175 +static inline long __syscall2(long n, long a, long b)
2176 +{
2177 + long r2;
2178 + long old_b = b;
2179 + struct kernel_stat kst = {0,};
2180 +
2181 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2182 + b = (long) &kst;
2183 +
2184 + r2 = (__syscall)(n, a, b);
2185 +
2186 + if (r2 > -4096UL)
2187 + return r2;
2188 +
2189 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2190 + __stat_fix(kst, old_b);
2191 +
2192 + return r2;
2193 +}
2194 +
2195 +static inline long __syscall3(long n, long a, long b, long c)
2196 +{
2197 + long r2 = (__syscall)(n, a, b, c);
2198 + if (r2 > -4096UL) return r2;
2199 + return r2;
2200 +}
2201 +
2202 +static inline long __syscall4(long n, long a, long b, long c, long d)
2203 +{
2204 + long r2 = (__syscall)(n, a, b, c, d);
2205 + if (r2 > -4096UL) return r2;
2206 + return r2;
2207 +}
2208 +
2209 +#endif
2210 +
2211 +static inline long __syscall5(long n, long a, long b, long c, long d, long e)
2212 +{
2213 + long r2 = (__syscall)(n, a, b, c, d, e);
2214 + if (r2 > -4096UL) return r2;
2215 + return r2;
2216 +}
2217 +
2218 +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
2219 +{
2220 + long r2 = (__syscall)(n, a, b, c, d, e, f);
2221 + if (r2 > -4096UL) return r2;
2222 + return r2;
2223 +}
2224 +
2225 +#define VDSO_USEFUL
2226 +#define VDSO_CGT_SYM "__vdso_clock_gettime"
2227 +#define VDSO_CGT_VER "LINUX_2.6"
2228 --- a/configure
2229 +++ b/configure
2230 @@ -299,7 +299,7 @@ printf "%s\n" "$target"
2231 #
2232 case "$target" in
2233 # Catch these early to simplify matching for 32-bit archs
2234 -mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;;
2235 +powerpc64*) fail "$0: unsupported target \"$target\"" ;;
2236 arm*) ARCH=arm ;;
2237 aarch64*) ARCH=aarch64 ;;
2238 i?86-nt32*) ARCH=nt32 ;;
2239 @@ -307,6 +307,7 @@ i?86*) ARCH=i386 ;;
2240 x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
2241 x86_64-nt64*) ARCH=nt64 ;;
2242 x86_64*) ARCH=x86_64 ;;
2243 +mips64*) ARCH=mips64 ;;
2244 mips*) ARCH=mips ;;
2245 microblaze*) ARCH=microblaze ;;
2246 or1k*) ARCH=or1k ;;
2247 @@ -619,6 +620,11 @@ if test "$ARCH" = "powerpc" ; then
2248 trycppif _SOFT_FLOAT "$t" && SUBARCH=${SUBARCH}-sf
2249 fi
2250
2251 +if test "$ARCH" = "mips64" ; then
2252 +trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" && SUBARCH=${SUBARCH}el
2253 +trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
2254 +fi
2255 +
2256 test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
2257 && SUBARCH=${SUBARCH}el
2258
2259 --- /dev/null
2260 +++ b/crt/mips64/crti.s
2261 @@ -0,0 +1,17 @@
2262 +.set noreorder
2263 +
2264 +.section .init
2265 +.global _init
2266 +.align 3
2267 +_init:
2268 + dsubu $sp, $sp, 32
2269 + sd $gp, 16($sp)
2270 + sd $ra, 24($sp)
2271 +
2272 +.section .fini
2273 +.global _fini
2274 +.align 3
2275 +_fini:
2276 + dsubu $sp, $sp, 32
2277 + sd $gp, 16($sp)
2278 + sd $ra, 24($sp)
2279 --- /dev/null
2280 +++ b/crt/mips64/crtn.s
2281 @@ -0,0 +1,13 @@
2282 +.set noreorder
2283 +
2284 +.section .init
2285 + ld $gp,16($sp)
2286 + ld $ra,24($sp)
2287 + j $ra
2288 + daddu $sp,$sp,32
2289 +
2290 +.section .fini
2291 + ld $gp,16($sp)
2292 + ld $ra,24($sp)
2293 + j $ra
2294 + daddu $sp,$sp,32
2295 --- a/ldso/dynlink.c
2296 +++ b/ldso/dynlink.c
2297 @@ -1134,7 +1134,7 @@ static void do_mips_relocs(struct dso *p
2298 Sym *sym = p->syms + j;
2299 rel[0] = (unsigned char *)got - base;
2300 for (i-=j; i; i--, sym++, rel[0]+=sizeof(size_t)) {
2301 - rel[1] = sym-p->syms << 8 | R_MIPS_JUMP_SLOT;
2302 + rel[1] = R_INFO(sym-p->syms, R_MIPS_JUMP_SLOT);
2303 do_relocs(p, rel, sizeof rel, 2);
2304 }
2305 }
2306 --- /dev/null
2307 +++ b/src/fenv/mips64/fenv-sf.c
2308 @@ -0,0 +1,3 @@
2309 +#ifdef __mips_soft_float
2310 +#include "../fenv.c"
2311 +#endif
2312 --- /dev/null
2313 +++ b/src/fenv/mips64/fenv.S
2314 @@ -0,0 +1,71 @@
2315 +#ifndef __mips_soft_float
2316 +
2317 +.set noreorder
2318 +
2319 +.global feclearexcept
2320 +.type feclearexcept,@function
2321 +feclearexcept:
2322 + and $4, $4, 0x7c
2323 + cfc1 $5, $31
2324 + or $5, $5, $4
2325 + xor $5, $5, $4
2326 + ctc1 $5, $31
2327 + jr $ra
2328 + li $2, 0
2329 +
2330 +.global feraiseexcept
2331 +.type feraiseexcept,@function
2332 +feraiseexcept:
2333 + and $4, $4, 0x7c
2334 + cfc1 $5, $31
2335 + or $5, $5, $4
2336 + ctc1 $5, $31
2337 + jr $ra
2338 + li $2, 0
2339 +
2340 +.global fetestexcept
2341 +.type fetestexcept,@function
2342 +fetestexcept:
2343 + and $4, $4, 0x7c
2344 + cfc1 $2, $31
2345 + jr $ra
2346 + and $2, $2, $4
2347 +
2348 +.global fegetround
2349 +.type fegetround,@function
2350 +fegetround:
2351 + cfc1 $2, $31
2352 + jr $ra
2353 + andi $2, $2, 3
2354 +
2355 +.global __fesetround
2356 +.type __fesetround,@function
2357 +__fesetround:
2358 + cfc1 $5, $31
2359 + li $6, -4
2360 + and $5, $5, $6
2361 + or $5, $5, $4
2362 + ctc1 $5, $31
2363 + jr $ra
2364 + li $2, 0
2365 +
2366 +.global fegetenv
2367 +.type fegetenv,@function
2368 +fegetenv:
2369 + cfc1 $5, $31
2370 + sw $5, 0($4)
2371 + jr $ra
2372 + li $2, 0
2373 +
2374 +.global fesetenv
2375 +.type fesetenv,@function
2376 +fesetenv:
2377 + daddiu $5, $4, 1
2378 + beq $5, $0, 1f
2379 + nop
2380 + lw $5, 0($4)
2381 +1: ctc1 $5, $31
2382 + jr $ra
2383 + li $2, 0
2384 +
2385 +#endif
2386 --- a/src/internal/dynlink.h
2387 +++ b/src/internal/dynlink.h
2388 @@ -11,12 +11,25 @@ typedef Elf32_Phdr Phdr;
2389 typedef Elf32_Sym Sym;
2390 #define R_TYPE(x) ((x)&255)
2391 #define R_SYM(x) ((x)>>8)
2392 +#define R_INFO ELF32_R_INFO
2393 #else
2394 typedef Elf64_Ehdr Ehdr;
2395 typedef Elf64_Phdr Phdr;
2396 typedef Elf64_Sym Sym;
2397 #define R_TYPE(x) ((x)&0x7fffffff)
2398 #define R_SYM(x) ((x)>>32)
2399 +#define R_INFO ELF64_R_INFO
2400 +#endif
2401 +
2402 +#ifdef __mips64
2403 +#define _GNU_SOURCE
2404 +#include <endian.h>
2405 +#undef R_TYPE
2406 +#undef R_SYM
2407 +#undef R_INFO
2408 +#define R_TYPE(x) (be64toh(x)&0x7fffffff)
2409 +#define R_SYM(x) (be32toh(be64toh(x)>>32))
2410 +#define R_INFO(s,t) (htobe64((uint64_t)htobe32(s)<<32 | (uint64_t)t))
2411 #endif
2412
2413 /* These enum constants provide unmatchable default values for
2414 --- /dev/null
2415 +++ b/src/internal/mips64/syscall.s
2416 @@ -0,0 +1,20 @@
2417 +.set noreorder
2418 +
2419 +.global __syscall
2420 +.hidden __syscall
2421 +.type __syscall,@function
2422 +__syscall:
2423 + move $2, $4
2424 + move $4, $5
2425 + move $5, $6
2426 + move $6, $7
2427 + move $7, $8
2428 + move $8, $9
2429 + move $9, $10
2430 + move $10, $11
2431 + syscall
2432 + beq $7, $0, 1f
2433 + nop
2434 + dsubu $2, $0, $2
2435 +1: jr $ra
2436 + nop
2437 --- /dev/null
2438 +++ b/src/ldso/mips64/dlsym.s
2439 @@ -0,0 +1,17 @@
2440 +.set noreorder
2441 +.global dlsym
2442 +.hidden __dlsym
2443 +.type dlsym,@function
2444 +dlsym:
2445 + lui $3, %hi(%neg(%gp_rel(dlsym)))
2446 + daddiu $3, $3, %lo(%neg(%gp_rel(dlsym)))
2447 + daddu $3, $3, $25
2448 + move $6, $ra
2449 + ld $25, %got_disp(__dlsym)($3)
2450 + daddiu $sp, $sp, -32
2451 + sd $ra, 24($sp)
2452 + jalr $25
2453 + nop
2454 + ld $ra, 24($sp)
2455 + jr $ra
2456 + daddiu $sp, $sp, 32
2457 --- /dev/null
2458 +++ b/src/setjmp/mips64/longjmp.S
2459 @@ -0,0 +1,37 @@
2460 +.set noreorder
2461 +
2462 +.global _longjmp
2463 +.global longjmp
2464 +.type _longjmp,@function
2465 +.type longjmp,@function
2466 +_longjmp:
2467 +longjmp:
2468 + move $2, $5
2469 + bne $2, $0, 1f # if return value is 0, make it as 1 else no changes made in $2
2470 + nop
2471 + daddu $2, $2, 1
2472 +1:
2473 +#ifndef __mips_soft_float
2474 + ldc1 $24, 96($4)
2475 + ldc1 $25, 104($4)
2476 + ldc1 $26, 112($4)
2477 + ldc1 $27, 120($4)
2478 + ldc1 $28, 128($4)
2479 + ldc1 $29, 136($4)
2480 + ldc1 $30, 144($4)
2481 + ldc1 $31, 152($4)
2482 +#endif
2483 + ld $ra, 0($4)
2484 + ld $sp, 8($4)
2485 + ld $gp, 16($4)
2486 + ld $16, 24($4)
2487 + ld $17, 32($4)
2488 + ld $18, 40($4)
2489 + ld $19, 48($4)
2490 + ld $20, 56($4)
2491 + ld $21, 64($4)
2492 + ld $22, 72($4)
2493 + ld $23, 80($4)
2494 + ld $30, 88($4)
2495 + jr $ra
2496 + nop
2497 --- /dev/null
2498 +++ b/src/setjmp/mips64/setjmp.S
2499 @@ -0,0 +1,34 @@
2500 +.set noreorder
2501 +.global __setjmp
2502 +.global _setjmp
2503 +.global setjmp
2504 +.type __setjmp,@function
2505 +.type _setjmp,@function
2506 +.type setjmp,@function
2507 +__setjmp:
2508 +_setjmp:
2509 +setjmp:
2510 + sd $ra, 0($4)
2511 + sd $sp, 8($4)
2512 + sd $gp, 16($4) # $gp is callee save register
2513 + sd $16, 24($4) # saving gp callee save registers
2514 + sd $17, 32($4)
2515 + sd $18, 40($4)
2516 + sd $19, 48($4)
2517 + sd $20, 56($4)
2518 + sd $21, 64($4)
2519 + sd $22, 72($4)
2520 + sd $23, 80($4)
2521 + sd $30, 88($4)
2522 +#ifndef __mips_soft_float
2523 + sdc1 $24, 96($4) # saving FP callee save registers
2524 + sdc1 $25, 104($4)
2525 + sdc1 $26, 112($4)
2526 + sdc1 $27, 120($4)
2527 + sdc1 $28, 128($4)
2528 + sdc1 $29, 136($4)
2529 + sdc1 $30, 144($4)
2530 + sdc1 $31, 152($4)
2531 +#endif
2532 + jr $ra
2533 + li $2, 0 # making return value as zero
2534 --- /dev/null
2535 +++ b/src/signal/mips64/restore.s
2536 @@ -0,0 +1,11 @@
2537 +# to return from signal handler and cleanup stack frame
2538 +.set noreorder
2539 +
2540 +.global __restore_rt
2541 +.global __restore
2542 +.type __restore_rt,@function
2543 +.type __restore,@function
2544 +__restore_rt:
2545 +__restore:
2546 + li $2, 5211 # __NR_rt_sigreturn,n64 and n32 have rt_sigreturn
2547 + syscall
2548 --- /dev/null
2549 +++ b/src/signal/mips64/sigsetjmp.s
2550 @@ -0,0 +1,40 @@
2551 + .set noreorder
2552 + .global sigsetjmp
2553 + .global __sigsetjmp
2554 + .type sigsetjmp,@function
2555 + .type __sigsetjmp,@function
2556 +sigsetjmp:
2557 +__sigsetjmp:
2558 + lui $3, %hi(%neg(%gp_rel(sigsetjmp)))
2559 + daddiu $3, $3, %lo(%neg(%gp_rel(sigsetjmp)))
2560 +
2561 + # Comparing save mask with 0, if equals to 0 then
2562 + # sigsetjmp is equal to setjmp.
2563 + beq $5, $0, 1f
2564 + daddu $3, $3, $25
2565 +
2566 + sd $ra, 168($4)
2567 + sd $16, 176($4)
2568 +
2569 + # save base of got so that we can use it later onec we return from 'longjmp'
2570 + sd $3, 184($4)
2571 + ld $25, %got_disp(setjmp)($3)
2572 + jalr $25
2573 + # Move pointer-to-sigjmp_buf (i.e. $4) to $16 and save it at '24($4)' in 'setjmp'
2574 + # We have already saved $16 of sigsetjmp at 168($4).
2575 + move $16, $4
2576 +
2577 + move $5, $2 # Return from 'setjmp' or 'longjmp'
2578 + move $4, $16 # Restore the pointer-to-sigjmp_buf
2579 + ld $ra, 168($4) # Restore ra of sigsetjmp
2580 + ld $16, 176($4) # Restore $16 of sigsetjmp
2581 + ld $3, 184($4) # Restore base of got
2582 +
2583 + .hidden __sigsetjmp_tail
2584 + ld $25, %got_disp(__sigsetjmp_tail)($3)
2585 + jr $25
2586 + nop
2587 +1:
2588 + ld $25, %got_disp(setjmp)($3)
2589 + jr $25
2590 + nop
2591 --- /dev/null
2592 +++ b/src/thread/mips64/__unmapself.s
2593 @@ -0,0 +1,10 @@
2594 +.set noreorder
2595 +.global __unmapself
2596 +.type __unmapself, @function
2597 +__unmapself:
2598 + li $2, 5011
2599 + syscall
2600 + li $4, 0
2601 + li $2, 5058
2602 + syscall
2603 +
2604 --- /dev/null
2605 +++ b/src/thread/mips64/clone.s
2606 @@ -0,0 +1,29 @@
2607 +.set noreorder
2608 +.global __clone
2609 +.type __clone,@function
2610 +__clone:
2611 + # Save function pointer and argument pointer on new thread stack
2612 + and $5, $5, -16 # aligning stack to double word
2613 + dsubu $5, $5, 16
2614 + sd $4, 0($5) # save function pointer
2615 + sd $7, 8($5) # save argument pointer
2616 + # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid)
2617 + # sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls)
2618 + move $4, $6
2619 + move $6, $8
2620 + move $7, $9
2621 + move $8, $10
2622 + li $2, 5055 # system call number of sys_clone for mips n64 ABI
2623 + syscall
2624 + beq $7, $0, 1f
2625 + nop # delay slot
2626 + jr $ra
2627 + dsubu $2, $0, $2 # delay slot
2628 +1: beq $2, $0, 1f
2629 + nop # delay slot
2630 + jr $ra
2631 + nop # delay slot
2632 +1: ld $25, 0($sp) # function pointer
2633 + ld $4, 8($sp) # argument pointer
2634 + jr $25 # call the user's function
2635 + nop
2636 --- /dev/null
2637 +++ b/src/thread/mips64/syscall_cp.s
2638 @@ -0,0 +1,53 @@
2639 +.set noreorder
2640 +
2641 +.global __cp_begin
2642 +.hidden __cp_begin
2643 +.type __cp_begin,@function
2644 +.global __cp_end
2645 +.hidden __cp_end
2646 +.type __cp_end,@function
2647 +.global __cp_cancel
2648 +.hidden __cp_cancel
2649 +.type __cp_cancel,@function
2650 +.global __cp_cancel_data
2651 +.hidden __cp_cancel_data
2652 +.type __cp_cancel_data,@function
2653 +.hidden __cancel
2654 +.global __syscall_cp_asm
2655 +.hidden __syscall_cp_asm
2656 +.type __syscall_cp_asm,@function
2657 +__syscall_cp_asm:
2658 +__cp_begin:
2659 + lw $4, 0($4)
2660 + bne $4, $0, __cp_cancel # __syscall_cp_asm has 8 arguments and $4 will contain the
2661 + # cancellation flag and $5 is syscall number and passing remaining
2662 + # 6 arguments to _cancel system call
2663 + move $2, $5
2664 + move $4, $6
2665 + move $5, $7
2666 + move $6, $8
2667 + move $7, $9
2668 + move $8, $10
2669 + move $9, $11
2670 + ld $10, 0($sp)
2671 + syscall
2672 +__cp_end:
2673 + beq $7, $0, 1f # checking for summary overflow
2674 + nop
2675 + dsubu $2, $0, $2
2676 +1: jr $ra
2677 + nop
2678 +__cp_cancel: # if cancellation flag is 1 then call __cancel
2679 + move $2, $ra
2680 +.align 8
2681 + bal 1f
2682 + nop
2683 +__cp_cancel_data:
2684 + .gpdword __cp_cancel_data
2685 + .gpdword __cancel
2686 +1: ld $3, ($ra)
2687 + dsubu $3, $ra, $3
2688 + ld $25, 8($ra)
2689 + daddu $25, $25, $3
2690 + jr $25
2691 + move $ra, $2
2692 --- /dev/null
2693 +++ b/src/unistd/mips64/pipe.s
2694 @@ -0,0 +1,20 @@
2695 +.set noreorder
2696 +
2697 +.global pipe
2698 +.type pipe,@function
2699 +pipe:
2700 + lui $3, %hi(%neg(%gp_rel(pipe))) #using temporary reg $3 as $gp
2701 + daddiu $3, $3, %lo(%neg(%gp_rel(pipe)))
2702 + daddu $3, $3, $25
2703 + li $2, 5021
2704 + syscall
2705 + beq $7, $0, 1f
2706 + nop
2707 + ld $25, %got_disp(__syscall_ret)($3)
2708 + jr $25
2709 + dsubu $4, $0, $2
2710 +1: sw $2, 0($4)
2711 + sw $3, 4($4)
2712 + move $2, $0
2713 + jr $ra
2714 + nop