musl: update to latest git, adds some fixes for the mips64 port and regular expressions
[openwrt/openwrt.git] / toolchain / musl / patches / 001-update-to-git-2016-03-06.patch
1 commit 636a4799dd5bf11a1fcd209906c088ed948b821c
2 Author: Rich Felker <dalias@aerifal.cx>
3 Date: Sun Mar 6 17:11:29 2016 -0500
4
5 make configure check for unsupported (SPE) powerpc hard-float models
6
7 the SPE ABI may be compatible with soft-float, but actually making it
8 work requires some additional work, so for now it's best to make sure
9 broken builds don't happen.
10
11 commit 5a92dd95c77cee81755f1a441ae0b71e3ae2bcdb
12 Author: Felix Fietkau <nbd@openwrt.org>
13 Date: Mon Jan 25 13:20:52 2016 +0100
14
15 add powerpc soft-float support
16
17 Some PowerPC CPUs (e.g. Freescale MPC85xx) have a completely different
18 instruction set for floating point operations (SPE).
19 Executing regular PowerPC floating point instructions results in
20 "Illegal instruction" errors.
21
22 Make it possible to run these devices in soft-float mode.
23
24 commit 9543656cc32fda48fc463f332ee20e91eed2b768
25 Author: Alexander Monakov <amonakov@ispras.ru>
26 Date: Sun Mar 6 20:22:38 2016 +0300
27
28 env: avoid leaving dangling pointers in __env_map
29
30 This is the minimal fix for __putenv leaving a pointer to freed heap
31 storage in __env_map array, which could later on lead to errors such
32 as double-free.
33
34 commit 589aefa5b061647e8b9ad9bca3aaa8dc6222460a
35 Author: Rich Felker <dalias@aerifal.cx>
36 Date: Sun Mar 6 17:48:58 2016 +0000
37
38 update documentation files for mips64 port
39
40 commit 83933573aff71a5d178ab71912f177d2d844e63e
41 Author: Rich Felker <dalias@aerifal.cx>
42 Date: Sun Mar 6 17:41:56 2016 +0000
43
44 add mips64 port
45
46 patch by Mahesh Bodapati and Jaydeep Patil of Imagination
47 Technologies.
48
49 commit 71392a91c333d47b6b3c8f99c897e3b5a7eb6d58
50 Author: Rich Felker <dalias@aerifal.cx>
51 Date: Sun Mar 6 17:25:52 2016 +0000
52
53 generalize mips-specific reloc code not to hard-code sym/type encoding
54
55 this change is made in preparation for adding the mips64 port, which
56 needs a 64-bit (and mips64-specific) form of the R_INFO macro, but
57 it's a better abstraction anyway.
58
59 based on part of the mips64 port patch by Mahesh Bodapati and Jaydeep
60 Patil of Imagination Technologies.
61
62 commit b023c03b574acdfd73418314a5dcaa83e5cea5a0
63 Author: Szabolcs Nagy <nsz@port70.net>
64 Date: Fri Mar 4 21:23:33 2016 +0000
65
66 math: fix expf(-NAN) and exp2f(-NAN) to return -NAN instead of 0
67
68 expf(-NAN) was treated as expf(-large) which unconditionally
69 returns +0, so special case +-NAN.
70 reported by Petr Hosek.
71
72 commit db66ef1f7db7c5b672591a97a97bc789c9efe2f3
73 Author: Nathan Zadoks <nathan@nathan7.eu>
74 Date: Wed Mar 2 17:26:27 2016 +0100
75
76 add sched_getcpu vDSO support
77
78 This brings the call to an actually usable speed.
79 Quick unscientific benchmark: 14ns : 102ns :: vDSO : syscall
80
81 commit 98d335735d64ee34a34cb9c08ea2cb51a076d2a1
82 Author: Nathan Zadoks <nathan@nathan7.eu>
83 Date: Wed Mar 2 17:26:26 2016 +0100
84
85 add sched_getcpu
86
87 This is a GNU extension, but a fairly minor one, for a system call that
88 otherwise has no libc wrapper.
89
90 commit 29b13575376509bb21539711f30c1deaf0823033
91 Author: Szabolcs Nagy <nsz@port70.net>
92 Date: Mon Feb 29 16:36:25 2016 +0000
93
94 fix ^* at the start of a complete BRE
95
96 This is a workaround to treat * as literal * at the start of a BRE.
97
98 Ideally ^ would be treated as an anchor at the start of any BRE
99 subexpression and similarly $ would be an anchor at the end of any
100 subexpression. This is not required by the standard and hard to do
101 with the current code, but it's the existing practice. If it is
102 changed, * should be treated as literal after such anchor as well.
103
104 commit 39ea71fb8afddda879a1999f2a203dfdaf57a639
105 Author: Szabolcs Nagy <nsz@port70.net>
106 Date: Mon Feb 29 15:04:46 2016 +0000
107
108 fix * at the start of a BRE subexpression
109
110 commit 7eaa76fc2e7993582989d3838b1ac32dd8abac09 made * invalid at
111 the start of a BRE subexpression, but it should be accepted as
112 literal * there according to the standard.
113
114 This patch does not fix subexpressions starting with ^*.
115
116 commit 6e694d6960d9d50a119e8660c95bf9308e609053
117 Author: Michael Meeuwisse <mickeymeeuw@gmail.com>
118 Date: Tue Feb 23 23:49:57 2016 +0100
119
120 explicitly include stdio.h to get EOF definition needed by wctob
121
122 commit 6d70c08a2c37745df637b231711f6dec79dbc6e1
123 Author: Rich Felker <dalias@aerifal.cx>
124 Date: Wed Mar 2 00:34:51 2016 -0500
125
126 handle non-matching address family entries in hosts file
127
128 name_from_hosts failed to account for the possibility of an address
129 family error from name_from_numeric, wrongly counting such a return as
130 success and using the uninitialized address data as part of the
131 results passed up to the caller.
132
133 non-matching address family entries cannot simply be ignored or
134 results would be inconsistent with respect to whether AF_UNSPEC or a
135 specific address family is queried. instead, record that a
136 non-matching entry was seen, and fail the lookup with EAI_NONAME of no
137 matching-family entries are found.
138
139 commit fd224a800b68843c4d8d1002b07dd91041a7fa32
140 Author: Rich Felker <dalias@aerifal.cx>
141 Date: Tue Feb 23 13:04:56 2016 -0500
142
143 make aarch64 atomic_arch.h report that it defines pointer-sized ll/sc
144
145 at present this is done only for consistency, since this file defines
146 its own a_cas_p rather than using the new generic one from atomic.h
147 added in commit 225f6a6b5b7173b6655e4f5d49b5b9fea70bf3bb. these
148 definitions may however be useful if we ever need to add other
149 pointer-sized atomic operations.
150
151 commit 225f6a6b5b7173b6655e4f5d49b5b9fea70bf3bb
152 Author: Bobby Bingham <koorogi@koorogi.info>
153 Date: Mon Feb 22 21:14:23 2016 -0600
154
155 allow implementing a_cas_p with pointer-sized ll/sc
156
157 No current ports do this, but it will be useful for porting to 64-bit ll/sc
158 architectures, such as mips64 and powerpc64.
159
160 --- a/COPYRIGHT
161 +++ b/COPYRIGHT
162 @@ -43,6 +43,7 @@ Gianluca Anzolin
163 Hauke Mehrtens
164 Hiltjo Posthuma
165 Isaac Dunham
166 +Jaydeep Patil
167 Jens Gustedt
168 Jeremy Huntwork
169 Jo-Philipp Wich
170 @@ -55,6 +56,7 @@ Kylie McClain
171 Luca Barbato
172 Luka Perkov
173 M Farkas-Dyck (Strake)
174 +Mahesh Bodapati
175 Michael Forney
176 Natanael Copa
177 Nicholas J. Kain
178 @@ -123,6 +125,9 @@ Pennington for use in the ellcc project.
179 by Rich Felker for build system and code conventions during upstream
180 integration. It is licensed under the standard MIT terms.
181
182 +The mips64 port was contributed by Imagination Technologies and is
183 +licensed under the standard MIT terms.
184 +
185 The powerpc port was also originally written by Richard Pennington,
186 and later supplemented and integrated by John Spencer. It is licensed
187 under the standard MIT terms.
188 --- a/INSTALL
189 +++ b/INSTALL
190 @@ -62,6 +62,12 @@ and ABI combinations:
191 * MIPS2 or later, or kernel emulation of ll/sc (standard in Linux)
192 is required
193
194 +* MIPS64
195 + * ABI is n64 (LP64)
196 + * Big-endian default; little-endian variants also supported
197 + * Default ABI variant uses FPU registers; alternate soft-float ABI
198 + that does not use FPU registers or instructions is available
199 +
200 * PowerPC
201 * Only 32-bit is supported
202 * Compiler toolchain must provide 64-bit long double, not IBM
203 --- a/arch/aarch64/atomic_arch.h
204 +++ b/arch/aarch64/atomic_arch.h
205 @@ -34,6 +34,7 @@ static inline int a_cas(volatile int *p,
206 return old;
207 }
208
209 +#define a_ll_p a_ll_p
210 static inline void *a_ll_p(volatile void *p)
211 {
212 void *v;
213 @@ -41,6 +42,7 @@ static inline void *a_ll_p(volatile void
214 return v;
215 }
216
217 +#define a_sc_p a_sc_p
218 static inline int a_sc_p(volatile int *p, void *v)
219 {
220 int r;
221 --- /dev/null
222 +++ b/arch/mips64/atomic_arch.h
223 @@ -0,0 +1,50 @@
224 +#define a_ll a_ll
225 +static inline int a_ll(volatile int *p)
226 +{
227 + int v;
228 + __asm__ __volatile__ (
229 + "ll %0, %1"
230 + : "=r"(v) : "m"(*p));
231 + return v;
232 +}
233 +
234 +#define a_sc a_sc
235 +static inline int a_sc(volatile int *p, int v)
236 +{
237 + int r;
238 + __asm__ __volatile__ (
239 + "sc %0, %1"
240 + : "=r"(r), "=m"(*p) : "0"(v) : "memory");
241 + return r;
242 +}
243 +
244 +#define a_ll_p a_ll_p
245 +static inline void *a_ll_p(volatile long *p)
246 +{
247 + void *v;
248 + __asm__ __volatile__ (
249 + "lld %0, %1"
250 + : "=r"(v) : "m"(*p));
251 + return v;
252 +}
253 +
254 +#define a_sc_p a_sc_p
255 +static inline int a_sc_p(volatile long *p, void *v)
256 +{
257 + int r;
258 + __asm__ __volatile__ (
259 + "scd %0, %1"
260 + : "=r"(r), "=m"(*p) : "0"(v) : "memory");
261 + return r;
262 +}
263 +
264 +#define a_barrier a_barrier
265 +static inline void a_barrier()
266 +{
267 + /* mips2 sync, but using too many directives causes
268 + * gcc not to inline it, so encode with .long instead. */
269 + __asm__ __volatile__ (".long 0xf" : : : "memory");
270 +}
271 +
272 +#define a_pre_llsc a_barrier
273 +#define a_post_llsc a_barrier
274 --- /dev/null
275 +++ b/arch/mips64/bits/alltypes.h.in
276 @@ -0,0 +1,28 @@
277 +#define _Addr long
278 +#define _Int64 long
279 +#define _Reg long
280 +
281 +TYPEDEF __builtin_va_list va_list;
282 +TYPEDEF __builtin_va_list __isoc_va_list;
283 +
284 +#ifndef __cplusplus
285 +TYPEDEF int wchar_t;
286 +#endif
287 +
288 +TYPEDEF float float_t;
289 +TYPEDEF double double_t;
290 +
291 +TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
292 +
293 +TYPEDEF long time_t;
294 +TYPEDEF long suseconds_t;
295 +
296 +TYPEDEF unsigned nlink_t;
297 +
298 +TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
299 +TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
300 +TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
301 +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
302 +TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
303 +TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
304 +TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
305 --- /dev/null
306 +++ b/arch/mips64/bits/endian.h
307 @@ -0,0 +1,5 @@
308 +#if _MIPSEL || __MIPSEL || __MIPSEL__
309 +#define __BYTE_ORDER __LITTLE_ENDIAN
310 +#else
311 +#define __BYTE_ORDER __BIG_ENDIAN
312 +#endif
313 --- /dev/null
314 +++ b/arch/mips64/bits/errno.h
315 @@ -0,0 +1,134 @@
316 +#define EPERM 1
317 +#define ENOENT 2
318 +#define ESRCH 3
319 +#define EINTR 4
320 +#define EIO 5
321 +#define ENXIO 6
322 +#define E2BIG 7
323 +#define ENOEXEC 8
324 +#define EBADF 9
325 +#define ECHILD 10
326 +#define EAGAIN 11
327 +#define ENOMEM 12
328 +#define EACCES 13
329 +#define EFAULT 14
330 +#define ENOTBLK 15
331 +#define EBUSY 16
332 +#define EEXIST 17
333 +#define EXDEV 18
334 +#define ENODEV 19
335 +#define ENOTDIR 20
336 +#define EISDIR 21
337 +#define EINVAL 22
338 +#define ENFILE 23
339 +#define EMFILE 24
340 +#define ENOTTY 25
341 +#define ETXTBSY 26
342 +#define EFBIG 27
343 +#define ENOSPC 28
344 +#define ESPIPE 29
345 +#define EROFS 30
346 +#define EMLINK 31
347 +#define EPIPE 32
348 +#define EDOM 33
349 +#define ERANGE 34
350 +#define ENOMSG 35
351 +#define EIDRM 36
352 +#define ECHRNG 37
353 +#define EL2NSYNC 38
354 +#define EL3HLT 39
355 +#define EL3RST 40
356 +#define ELNRNG 41
357 +#define EUNATCH 42
358 +#define ENOCSI 43
359 +#define EL2HLT 44
360 +#define EDEADLK 45
361 +#define ENOLCK 46
362 +#define EBADE 50
363 +#define EBADR 51
364 +#define EXFULL 52
365 +#define ENOANO 53
366 +#define EBADRQC 54
367 +#define EBADSLT 55
368 +#define EDEADLOCK 56
369 +#define EBFONT 59
370 +#define ENOSTR 60
371 +#define ENODATA 61
372 +#define ETIME 62
373 +#define ENOSR 63
374 +#define ENONET 64
375 +#define ENOPKG 65
376 +#define EREMOTE 66
377 +#define ENOLINK 67
378 +#define EADV 68
379 +#define ESRMNT 69
380 +#define ECOMM 70
381 +#define EPROTO 71
382 +#define EDOTDOT 73
383 +#define EMULTIHOP 74
384 +#define EBADMSG 77
385 +#define ENAMETOOLONG 78
386 +#define EOVERFLOW 79
387 +#define ENOTUNIQ 80
388 +#define EBADFD 81
389 +#define EREMCHG 82
390 +#define ELIBACC 83
391 +#define ELIBBAD 84
392 +#define ELIBSCN 85
393 +#define ELIBMAX 86
394 +#define ELIBEXEC 87
395 +#define EILSEQ 88
396 +#define ENOSYS 89
397 +#define ELOOP 90
398 +#define ERESTART 91
399 +#define ESTRPIPE 92
400 +#define ENOTEMPTY 93
401 +#define EUSERS 94
402 +#define ENOTSOCK 95
403 +#define EDESTADDRREQ 96
404 +#define EMSGSIZE 97
405 +#define EPROTOTYPE 98
406 +#define ENOPROTOOPT 99
407 +#define EPROTONOSUPPORT 120
408 +#define ESOCKTNOSUPPORT 121
409 +#define EOPNOTSUPP 122
410 +#define ENOTSUP EOPNOTSUPP
411 +#define EPFNOSUPPORT 123
412 +#define EAFNOSUPPORT 124
413 +#define EADDRINUSE 125
414 +#define EADDRNOTAVAIL 126
415 +#define ENETDOWN 127
416 +#define ENETUNREACH 128
417 +#define ENETRESET 129
418 +#define ECONNABORTED 130
419 +#define ECONNRESET 131
420 +#define ENOBUFS 132
421 +#define EISCONN 133
422 +#define ENOTCONN 134
423 +#define EUCLEAN 135
424 +#define ENOTNAM 137
425 +#define ENAVAIL 138
426 +#define EISNAM 139
427 +#define EREMOTEIO 140
428 +#define ESHUTDOWN 143
429 +#define ETOOMANYREFS 144
430 +#define ETIMEDOUT 145
431 +#define ECONNREFUSED 146
432 +#define EHOSTDOWN 147
433 +#define EHOSTUNREACH 148
434 +#define EWOULDBLOCK EAGAIN
435 +#define EALREADY 149
436 +#define EINPROGRESS 150
437 +#define ESTALE 151
438 +#define ECANCELED 158
439 +#define ENOMEDIUM 159
440 +#define EMEDIUMTYPE 160
441 +#define ENOKEY 161
442 +#define EKEYEXPIRED 162
443 +#define EKEYREVOKED 163
444 +#define EKEYREJECTED 164
445 +#define EOWNERDEAD 165
446 +#define ENOTRECOVERABLE 166
447 +#define ERFKILL 167
448 +#define EHWPOISON 168
449 +#define EDQUOT 1133
450 --- /dev/null
451 +++ b/arch/mips64/bits/fcntl.h
452 @@ -0,0 +1,40 @@
453 +#define O_CREAT 0400
454 +#define O_EXCL 02000
455 +#define O_NOCTTY 04000
456 +#define O_TRUNC 01000
457 +#define O_APPEND 0010
458 +#define O_NONBLOCK 0200
459 +#define O_DSYNC 0020
460 +#define O_SYNC 040020
461 +#define O_RSYNC 040020
462 +#define O_DIRECTORY 0200000
463 +#define O_NOFOLLOW 0400000
464 +#define O_CLOEXEC 02000000
465 +
466 +#define O_ASYNC 010000
467 +#define O_DIRECT 0100000
468 +#define O_LARGEFILE 0
469 +#define O_NOATIME 01000000
470 +#define O_PATH 010000000
471 +#define O_TMPFILE 020200000
472 +#define O_NDELAY O_NONBLOCK
473 +
474 +#define F_DUPFD 0
475 +#define F_GETFD 1
476 +#define F_SETFD 2
477 +#define F_GETFL 3
478 +#define F_SETFL 4
479 +
480 +#define F_SETOWN 24
481 +#define F_GETOWN 23
482 +#define F_SETSIG 10
483 +#define F_GETSIG 11
484 +
485 +#define F_GETLK 14
486 +#define F_SETLK 6
487 +#define F_SETLKW 7
488 +
489 +#define F_SETOWN_EX 15
490 +#define F_GETOWN_EX 16
491 +
492 +#define F_GETOWNER_UIDS 17
493 --- /dev/null
494 +++ b/arch/mips64/bits/fenv.h
495 @@ -0,0 +1,25 @@
496 +#ifdef __mips_soft_float
497 +#define FE_ALL_EXCEPT 0
498 +#define FE_TONEAREST 0
499 +#else
500 +#define FE_INEXACT 4
501 +#define FE_UNDERFLOW 8
502 +#define FE_OVERFLOW 16
503 +#define FE_DIVBYZERO 32
504 +#define FE_INVALID 64
505 +
506 +#define FE_ALL_EXCEPT 124
507 +
508 +#define FE_TONEAREST 0
509 +#define FE_TOWARDZERO 1
510 +#define FE_UPWARD 2
511 +#define FE_DOWNWARD 3
512 +#endif
513 +
514 +typedef unsigned short fexcept_t;
515 +
516 +typedef struct {
517 + unsigned __cw;
518 +} fenv_t;
519 +
520 +#define FE_DFL_ENV ((const fenv_t *) -1)
521 --- /dev/null
522 +++ b/arch/mips64/bits/float.h
523 @@ -0,0 +1,16 @@
524 +#define FLT_EVAL_METHOD 0
525 +
526 +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
527 +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
528 +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
529 +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
530 +
531 +#define LDBL_MANT_DIG 113
532 +#define LDBL_MIN_EXP (-16381)
533 +#define LDBL_MAX_EXP 16384
534 +
535 +#define LDBL_DIG 33
536 +#define LDBL_MIN_10_EXP (-4931)
537 +#define LDBL_MAX_10_EXP 4932
538 +
539 +#define DECIMAL_DIG 36
540 --- /dev/null
541 +++ b/arch/mips64/bits/ioctl.h
542 @@ -0,0 +1,210 @@
543 +#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
544 +#define _IOC_NONE 1U
545 +#define _IOC_READ 2U
546 +#define _IOC_WRITE 4U
547 +
548 +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
549 +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
550 +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
551 +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
552 +
553 +#define TCGETA 0x5401
554 +#define TCSETA 0x5402
555 +#define TCSETAW 0x5403
556 +#define TCSETAF 0x5404
557 +#define TCSBRK 0x5405
558 +#define TCXONC 0x5406
559 +#define TCFLSH 0x5407
560 +#define TCGETS 0x540D
561 +#define TCSETS 0x540E
562 +#define TCSETSW 0x540F
563 +#define TCSETSF 0x5410
564 +
565 +#define TIOCEXCL 0x740D
566 +#define TIOCNXCL 0x740E
567 +#define TIOCOUTQ 0x7472
568 +#define TIOCSTI 0x5472
569 +#define TIOCMGET 0x741D
570 +#define TIOCMBIS 0x741B
571 +#define TIOCMBIC 0x741C
572 +#define TIOCMSET 0x741D
573 +
574 +#define TIOCPKT 0x5470
575 +#define TIOCSWINSZ _IOW('t', 103, struct winsize)
576 +#define TIOCGWINSZ _IOR('t', 104, struct winsize)
577 +#define TIOCNOTTY 0x5471
578 +#define TIOCSETD 0x7401
579 +#define TIOCGETD 0x7400
580 +
581 +#define FIOCLEX 0x6601
582 +#define FIONCLEX 0x6602
583 +#define FIOASYNC 0x667D
584 +#define FIONBIO 0x667E
585 +#define FIOQSIZE 0x667F
586 +
587 +#define TIOCGLTC 0x7474
588 +#define TIOCSLTC 0x7475
589 +#define TIOCSPGRP _IOW('t', 118, int)
590 +#define TIOCGPGRP _IOR('t', 119, int)
591 +#define TIOCCONS _IOW('t', 120, int)
592 +
593 +#define FIONREAD 0x467F
594 +#define TIOCINQ FIONREAD
595 +
596 +#define TIOCGETP 0x7408
597 +#define TIOCSETP 0x7409
598 +#define TIOCSETN 0x740A
599 +
600 +#define TIOCSBRK 0x5427
601 +#define TIOCCBRK 0x5428
602 +#define TIOCGSID 0x7416
603 +#define TIOCGPTN _IOR('T', 0x30, unsigned int)
604 +#define TIOCSPTLCK _IOW('T', 0x31, int)
605 +
606 +#define TIOCSCTTY 0x5480
607 +#define TIOCGSOFTCAR 0x5481
608 +#define TIOCSSOFTCAR 0x5482
609 +#define TIOCLINUX 0x5483
610 +#define TIOCGSERIAL 0x5484
611 +#define TIOCSSERIAL 0x5485
612 +#define TCSBRKP 0x5486
613 +
614 +#define TIOCSERCONFIG 0x5488
615 +#define TIOCSERGWILD 0x5489
616 +#define TIOCSERSWILD 0x548A
617 +#define TIOCGLCKTRMIOS 0x548B
618 +#define TIOCSLCKTRMIOS 0x548C
619 +#define TIOCSERGSTRUCT 0x548D
620 +#define TIOCSERGETLSR 0x548E
621 +#define TIOCSERGETMULTI 0x548F
622 +#define TIOCSERSETMULTI 0x5490
623 +#define TIOCMIWAIT 0x5491
624 +#define TIOCGICOUNT 0x5492
625 +#define TIOCGHAYESESP 0x5493
626 +#define TIOCSHAYESESP 0x5494
627 +
628 +#define TIOCTTYGSTRUCT 0x5426
629 +#define TCGETX 0x5432
630 +#define TCSETX 0x5433
631 +#define TCSETXF 0x5434
632 +#define TCSETXW 0x5435
633 +
634 +#define TIOCPKT_DATA 0
635 +#define TIOCPKT_FLUSHREAD 1
636 +#define TIOCPKT_FLUSHWRITE 2
637 +#define TIOCPKT_STOP 4
638 +#define TIOCPKT_START 8
639 +#define TIOCPKT_NOSTOP 16
640 +#define TIOCPKT_DOSTOP 32
641 +#define TIOCPKT_IOCTL 64
642 +
643 +#define TIOCSER_TEMT 0x01
644 +
645 +struct winsize {
646 + unsigned short ws_row;
647 + unsigned short ws_col;
648 + unsigned short ws_xpixel;
649 + unsigned short ws_ypixel;
650 +};
651 +
652 +#define TIOCM_LE 0x001
653 +#define TIOCM_DTR 0x002
654 +#define TIOCM_RTS 0x004
655 +#define TIOCM_ST 0x008
656 +#define TIOCM_SR 0x010
657 +#define TIOCM_CTS 0x020
658 +#define TIOCM_CAR 0x040
659 +#define TIOCM_RNG 0x080
660 +#define TIOCM_DSR 0x100
661 +#define TIOCM_CD TIOCM_CAR
662 +#define TIOCM_RI TIOCM_RNG
663 +#define TIOCM_OUT1 0x2000
664 +#define TIOCM_OUT2 0x4000
665 +#define TIOCM_LOOP 0x8000
666 +#define TIOCM_MODEM_BITS TIOCM_OUT2
667 +
668 +#define N_TTY 0
669 +#define N_SLIP 1
670 +#define N_MOUSE 2
671 +#define N_PPP 3
672 +#define N_STRIP 4
673 +#define N_AX25 5
674 +#define N_X25 6
675 +#define N_6PACK 7
676 +#define N_MASC 8
677 +#define N_R3964 9
678 +#define N_PROFIBUS_FDL 10
679 +#define N_IRDA 11
680 +#define N_SMSBLOCK 12
681 +#define N_HDLC 13
682 +#define N_SYNC_PPP 14
683 +#define N_HCI 15
684 +
685 +#define FIOSETOWN 0x8901
686 +#define SIOCSPGRP 0x8902
687 +#define FIOGETOWN 0x8903
688 +#define SIOCGPGRP 0x8904
689 +#define SIOCATMARK 0x8905
690 +#define SIOCGSTAMP 0x8906
691 +
692 +#define SIOCADDRT 0x890B
693 +#define SIOCDELRT 0x890C
694 +#define SIOCRTMSG 0x890D
695 +
696 +#define SIOCGIFNAME 0x8910
697 +#define SIOCSIFLINK 0x8911
698 +#define SIOCGIFCONF 0x8912
699 +#define SIOCGIFFLAGS 0x8913
700 +#define SIOCSIFFLAGS 0x8914
701 +#define SIOCGIFADDR 0x8915
702 +#define SIOCSIFADDR 0x8916
703 +#define SIOCGIFDSTADDR 0x8917
704 +#define SIOCSIFDSTADDR 0x8918
705 +#define SIOCGIFBRDADDR 0x8919
706 +#define SIOCSIFBRDADDR 0x891a
707 +#define SIOCGIFNETMASK 0x891b
708 +#define SIOCSIFNETMASK 0x891c
709 +#define SIOCGIFMETRIC 0x891d
710 +#define SIOCSIFMETRIC 0x891e
711 +#define SIOCGIFMEM 0x891f
712 +#define SIOCSIFMEM 0x8920
713 +#define SIOCGIFMTU 0x8921
714 +#define SIOCSIFMTU 0x8922
715 +#define SIOCSIFHWADDR 0x8924
716 +#define SIOCGIFENCAP 0x8925
717 +#define SIOCSIFENCAP 0x8926
718 +#define SIOCGIFHWADDR 0x8927
719 +#define SIOCGIFSLAVE 0x8929
720 +#define SIOCSIFSLAVE 0x8930
721 +#define SIOCADDMULTI 0x8931
722 +#define SIOCDELMULTI 0x8932
723 +#define SIOCGIFINDEX 0x8933
724 +#define SIOGIFINDEX SIOCGIFINDEX
725 +#define SIOCSIFPFLAGS 0x8934
726 +#define SIOCGIFPFLAGS 0x8935
727 +#define SIOCDIFADDR 0x8936
728 +#define SIOCSIFHWBROADCAST 0x8937
729 +#define SIOCGIFCOUNT 0x8938
730 +
731 +#define SIOCGIFBR 0x8940
732 +#define SIOCSIFBR 0x8941
733 +
734 +#define SIOCGIFTXQLEN 0x8942
735 +#define SIOCSIFTXQLEN 0x8943
736 +
737 +#define SIOCDARP 0x8953
738 +#define SIOCGARP 0x8954
739 +#define SIOCSARP 0x8955
740 +
741 +#define SIOCDRARP 0x8960
742 +#define SIOCGRARP 0x8961
743 +#define SIOCSRARP 0x8962
744 +
745 +#define SIOCGIFMAP 0x8970
746 +#define SIOCSIFMAP 0x8971
747 +
748 +#define SIOCADDDLCI 0x8980
749 +#define SIOCDELDLCI 0x8981
750 +
751 +#define SIOCDEVPRIVATE 0x89F0
752 +#define SIOCPROTOPRIVATE 0x89E0
753 --- /dev/null
754 +++ b/arch/mips64/bits/ipc.h
755 @@ -0,0 +1,14 @@
756 +struct ipc_perm {
757 + key_t __ipc_perm_key;
758 + uid_t uid;
759 + gid_t gid;
760 + uid_t cuid;
761 + gid_t cgid;
762 + mode_t mode;
763 + int __ipc_perm_seq;
764 + int __pad1;
765 + unsigned long __unused1;
766 + unsigned long __unused2;
767 +};
768 +
769 +#define IPC_64 0x100
770 --- /dev/null
771 +++ b/arch/mips64/bits/limits.h
772 @@ -0,0 +1,7 @@
773 +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
774 + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
775 +#define LONG_BIT 64
776 +#endif
777 +
778 +#define LONG_MAX 0x7fffffffffffffffL
779 +#define LLONG_MAX 0x7fffffffffffffffLL
780 --- /dev/null
781 +++ b/arch/mips64/bits/mman.h
782 @@ -0,0 +1,58 @@
783 +#define MAP_FAILED ((void *) -1)
784 +
785 +#define PROT_NONE 0
786 +#define PROT_READ 1
787 +#define PROT_WRITE 2
788 +#define PROT_EXEC 4
789 +#define PROT_GROWSDOWN 0x01000000
790 +#define PROT_GROWSUP 0x02000000
791 +
792 +#define MAP_SHARED 0x01
793 +#define MAP_PRIVATE 0x02
794 +#define MAP_FIXED 0x10
795 +
796 +#define MAP_TYPE 0x0f
797 +#define MAP_FILE 0x00
798 +#define MAP_ANON 0x800
799 +#define MAP_ANONYMOUS MAP_ANON
800 +#define MAP_NORESERVE 0x0400
801 +#define MAP_GROWSDOWN 0x1000
802 +#define MAP_DENYWRITE 0x2000
803 +#define MAP_EXECUTABLE 0x4000
804 +#define MAP_LOCKED 0x8000
805 +#define MAP_POPULATE 0x10000
806 +#define MAP_NONBLOCK 0x20000
807 +#define MAP_STACK 0x40000
808 +#define MAP_HUGETLB 0x80000
809 +
810 +#define POSIX_MADV_NORMAL 0
811 +#define POSIX_MADV_RANDOM 1
812 +#define POSIX_MADV_SEQUENTIAL 2
813 +#define POSIX_MADV_WILLNEED 3
814 +#define POSIX_MADV_DONTNEED 0
815 +
816 +#define MS_ASYNC 1
817 +#define MS_INVALIDATE 2
818 +#define MS_SYNC 4
819 +
820 +#define MCL_CURRENT 1
821 +#define MCL_FUTURE 2
822 +#define MCL_ONFAULT 4
823 +
824 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
825 +#define MADV_NORMAL 0
826 +#define MADV_RANDOM 1
827 +#define MADV_SEQUENTIAL 2
828 +#define MADV_WILLNEED 3
829 +#define MADV_DONTNEED 4
830 +#define MADV_REMOVE 9
831 +#define MADV_DONTFORK 10
832 +#define MADV_DOFORK 11
833 +#define MADV_MERGEABLE 12
834 +#define MADV_UNMERGEABLE 13
835 +#define MADV_HUGEPAGE 14
836 +#define MADV_NOHUGEPAGE 15
837 +#define MADV_DONTDUMP 16
838 +#define MADV_DODUMP 17
839 +#define MADV_HWPOISON 100
840 +#endif
841 --- /dev/null
842 +++ b/arch/mips64/bits/msg.h
843 @@ -0,0 +1,13 @@
844 +struct msqid_ds {
845 + struct ipc_perm msg_perm;
846 + time_t msg_stime;
847 + time_t msg_rtime;
848 + time_t msg_ctime;
849 + unsigned long msg_cbytes;
850 + msgqnum_t msg_qnum;
851 + msglen_t msg_qbytes;
852 + pid_t msg_lspid;
853 + pid_t msg_lrpid;
854 + unsigned long __pad1;
855 + unsigned long __pad2;
856 +};
857 --- /dev/null
858 +++ b/arch/mips64/bits/poll.h
859 @@ -0,0 +1,2 @@
860 +#define POLLWRNORM POLLOUT
861 +#define POLLWRBAND 0x100
862 --- /dev/null
863 +++ b/arch/mips64/bits/posix.h
864 @@ -0,0 +1,2 @@
865 +#define _POSIX_V6_LP64_OFFBIG 1
866 +#define _POSIX_V7_LP64_OFFBIG 1
867 --- /dev/null
868 +++ b/arch/mips64/bits/reg.h
869 @@ -0,0 +1,47 @@
870 +#undef __WORDSIZE
871 +#define __WORDSIZE 64
872 +
873 +#define EF_R0 0
874 +#define EF_R1 1
875 +#define EF_R2 2
876 +#define EF_R3 3
877 +#define EF_R4 4
878 +#define EF_R5 5
879 +#define EF_R6 6
880 +#define EF_R7 7
881 +#define EF_R8 8
882 +#define EF_R9 9
883 +#define EF_R10 10
884 +#define EF_R11 11
885 +#define EF_R12 12
886 +#define EF_R13 13
887 +#define EF_R14 14
888 +#define EF_R15 15
889 +#define EF_R16 16
890 +#define EF_R17 17
891 +#define EF_R18 18
892 +#define EF_R19 19
893 +#define EF_R20 20
894 +#define EF_R21 21
895 +#define EF_R22 22
896 +#define EF_R23 23
897 +#define EF_R24 24
898 +#define EF_R25 25
899 +
900 +#define EF_R26 26
901 +#define EF_R27 27
902 +#define EF_R28 28
903 +#define EF_R29 29
904 +#define EF_R30 30
905 +#define EF_R31 31
906 +
907 +#define EF_LO 32
908 +#define EF_HI 33
909 +
910 +#define EF_CP0_EPC 34
911 +#define EF_CP0_BADVADDR 35
912 +#define EF_CP0_STATUS 36
913 +#define EF_CP0_CAUSE 37
914 +#define EF_UNUSED0 38
915 +
916 +#define EF_SIZE 304
917 --- /dev/null
918 +++ b/arch/mips64/bits/resource.h
919 @@ -0,0 +1,5 @@
920 +#define RLIMIT_NOFILE 5
921 +#define RLIMIT_AS 6
922 +#define RLIMIT_RSS 7
923 +#define RLIMIT_NPROC 8
924 +#define RLIMIT_MEMLOCK 9
925 --- /dev/null
926 +++ b/arch/mips64/bits/sem.h
927 @@ -0,0 +1,14 @@
928 +struct semid_ds {
929 + struct ipc_perm sem_perm;
930 + time_t sem_otime;
931 + time_t sem_ctime;
932 +#if __BYTE_ORDER == __LITTLE_ENDIAN
933 + unsigned short sem_nsems;
934 + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
935 +#else
936 + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
937 + unsigned short sem_nsems;
938 +#endif
939 + time_t __unused3;
940 + time_t __unused4;
941 +};
942 --- /dev/null
943 +++ b/arch/mips64/bits/setjmp.h
944 @@ -0,0 +1 @@
945 +typedef unsigned long long __jmp_buf[23];
946 --- /dev/null
947 +++ b/arch/mips64/bits/shm.h
948 @@ -0,0 +1,24 @@
949 +#define SHMLBA 4096
950 +
951 +struct shmid_ds {
952 + struct ipc_perm shm_perm;
953 + size_t shm_segsz;
954 + time_t shm_atime;
955 + time_t shm_dtime;
956 + time_t shm_ctime;
957 + pid_t shm_cpid;
958 + pid_t shm_lpid;
959 + unsigned long shm_nattch;
960 + unsigned long __pad1;
961 + unsigned long __pad2;
962 +};
963 +
964 +struct shminfo {
965 + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
966 +};
967 +
968 +struct shm_info {
969 + int __used_ids;
970 + unsigned long shm_tot, shm_rss, shm_swp;
971 + unsigned long __swap_attempts, __swap_successes;
972 +};
973 --- /dev/null
974 +++ b/arch/mips64/bits/signal.h
975 @@ -0,0 +1,143 @@
976 +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
977 + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
978 +
979 +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
980 +#define MINSIGSTKSZ 2048
981 +#define SIGSTKSZ 8192
982 +#endif
983 +
984 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
985 +typedef unsigned long long greg_t, gregset_t[32];
986 +
987 +typedef struct {
988 + union {
989 + double fp_dregs[32];
990 + struct {
991 + float _fp_fregs;
992 + unsigned _fp_pad;
993 + } fp_fregs[32];
994 + } fp_r;
995 +} fpregset_t;
996 +
997 +struct sigcontext {
998 + unsigned long long sc_regs[32];
999 + unsigned long long sc_fpregs[32];
1000 + unsigned long long sc_mdhi;
1001 + unsigned long long sc_hi1;
1002 + unsigned long long sc_hi2;
1003 + unsigned long long sc_hi3;
1004 + unsigned long long sc_mdlo;
1005 + unsigned long long sc_lo1;
1006 + unsigned long long sc_lo2;
1007 + unsigned long long sc_lo3;
1008 + unsigned long long sc_pc;
1009 + unsigned int sc_fpc_csr;
1010 + unsigned int sc_used_math;
1011 + unsigned int sc_dsp;
1012 + unsigned int sc_reserved;
1013 +};
1014 +
1015 +typedef struct {
1016 + gregset_t gregs;
1017 + fpregset_t fpregs;
1018 + greg_t mdhi;
1019 + greg_t hi1;
1020 + greg_t hi2;
1021 + greg_t hi3;
1022 + greg_t mdlo;
1023 + greg_t lo1;
1024 + greg_t lo2;
1025 + greg_t lo3;
1026 + greg_t pc;
1027 + unsigned int fpc_csr;
1028 + unsigned int used_math;
1029 + unsigned int dsp;
1030 + unsigned int reserved;
1031 +} mcontext_t;
1032 +
1033 +#else
1034 +typedef struct {
1035 + unsigned long long __mc1[32];
1036 + double __mc2[32];
1037 + unsigned long long __mc3[9];
1038 + unsigned __mc4[4];
1039 +} mcontext_t;
1040 +#endif
1041 +
1042 +struct sigaltstack {
1043 + void *ss_sp;
1044 + size_t ss_size;
1045 + int ss_flags;
1046 +};
1047 +
1048 +typedef struct __ucontext {
1049 + unsigned long uc_flags;
1050 + struct __ucontext *uc_link;
1051 + stack_t uc_stack;
1052 + mcontext_t uc_mcontext;
1053 + sigset_t uc_sigmask;
1054 +} ucontext_t;
1055 +
1056 +#define SA_NOCLDSTOP 1
1057 +#define SA_NOCLDWAIT 0x10000
1058 +#define SA_SIGINFO 8
1059 +#define SA_ONSTACK 0x08000000
1060 +#define SA_RESTART 0x10000000
1061 +#define SA_NODEFER 0x40000000
1062 +#define SA_RESETHAND 0x80000000
1063 +#define SA_RESTORER 0x04000000
1064 +
1065 +#undef SIG_BLOCK
1066 +#undef SIG_UNBLOCK
1067 +#undef SIG_SETMASK
1068 +#define SIG_BLOCK 1
1069 +#define SIG_UNBLOCK 2
1070 +#define SIG_SETMASK 3
1071 +
1072 +#undef SI_ASYNCIO
1073 +#undef SI_MESGQ
1074 +#undef SI_TIMER
1075 +#define SI_ASYNCIO (-2)
1076 +#define SI_MESGQ (-4)
1077 +#define SI_TIMER (-3)
1078 +
1079 +#define __SI_SWAP_ERRNO_CODE
1080 +
1081 +#endif
1082 +
1083 +#define SIGHUP 1
1084 +#define SIGINT 2
1085 +#define SIGQUIT 3
1086 +#define SIGILL 4
1087 +#define SIGTRAP 5
1088 +#define SIGABRT 6
1089 +#define SIGIOT SIGABRT
1090 +#define SIGSTKFLT 7
1091 +#define SIGFPE 8
1092 +#define SIGKILL 9
1093 +#define SIGBUS 10
1094 +#define SIGSEGV 11
1095 +#define SIGSYS 12
1096 +#define SIGPIPE 13
1097 +#define SIGALRM 14
1098 +#define SIGTERM 15
1099 +#define SIGUSR1 16
1100 +#define SIGUSR2 17
1101 +#define SIGCHLD 18
1102 +#define SIGPWR 19
1103 +#define SIGWINCH 20
1104 +#define SIGURG 21
1105 +#define SIGIO 22
1106 +#define SIGPOLL SIGIO
1107 +#define SIGSTOP 23
1108 +#define SIGTSTP 24
1109 +#define SIGCONT 25
1110 +#define SIGTTIN 26
1111 +#define SIGTTOU 27
1112 +#define SIGVTALRM 28
1113 +#define SIGPROF 29
1114 +#define SIGXCPU 30
1115 +#define SIGXFSZ 31
1116 +#define SIGUNUSED SIGSYS
1117 +
1118 +#define _NSIG 128
1119 --- /dev/null
1120 +++ b/arch/mips64/bits/socket.h
1121 @@ -0,0 +1,68 @@
1122 +#include <endian.h>
1123 +
1124 +struct msghdr {
1125 + void *msg_name;
1126 + socklen_t msg_namelen;
1127 + struct iovec *msg_iov;
1128 +#if __BYTE_ORDER == __BIG_ENDIAN
1129 + int __pad1, msg_iovlen;
1130 +#else
1131 + int msg_iovlen, __pad1;
1132 +#endif
1133 + void *msg_control;
1134 +#if __BYTE_ORDER == __BIG_ENDIAN
1135 + int __pad2;
1136 + socklen_t msg_controllen;
1137 +#else
1138 + socklen_t msg_controllen;
1139 + int __pad2;
1140 +#endif
1141 + int msg_flags;
1142 +};
1143 +
1144 +struct cmsghdr {
1145 +#if __BYTE_ORDER == __BIG_ENDIAN
1146 + int __pad1;
1147 + socklen_t cmsg_len;
1148 +#else
1149 + socklen_t cmsg_len;
1150 + int __pad1;
1151 +#endif
1152 + int cmsg_level;
1153 + int cmsg_type;
1154 +};
1155 +
1156 +#define SOCK_STREAM 2
1157 +#define SOCK_DGRAM 1
1158 +#define SOL_SOCKET 65535
1159 +#define SO_DEBUG 1
1160 +
1161 +#define SO_REUSEADDR 0x0004
1162 +#define SO_KEEPALIVE 0x0008
1163 +#define SO_DONTROUTE 0x0010
1164 +#define SO_BROADCAST 0x0020
1165 +#define SO_LINGER 0x0080
1166 +#define SO_OOBINLINE 0x0100
1167 +#define SO_REUSEPORT 0x0200
1168 +#define SO_SNDBUF 0x1001
1169 +#define SO_RCVBUF 0x1002
1170 +#define SO_SNDLOWAT 0x1003
1171 +#define SO_RCVLOWAT 0x1004
1172 +#define SO_RCVTIMEO 0x1006
1173 +#define SO_SNDTIMEO 0x1005
1174 +#define SO_ERROR 0x1007
1175 +#define SO_TYPE 0x1008
1176 +#define SO_ACCEPTCONN 0x1009
1177 +#define SO_PROTOCOL 0x1028
1178 +#define SO_DOMAIN 0x1029
1179 +
1180 +#define SO_NO_CHECK 11
1181 +#define SO_PRIORITY 12
1182 +#define SO_BSDCOMPAT 14
1183 +#define SO_PASSCRED 17
1184 +#define SO_PEERCRED 18
1185 +#define SO_SNDBUFFORCE 31
1186 +#define SO_RCVBUFFORCE 33
1187 +
1188 +#define SOCK_NONBLOCK 0200
1189 +#define SOCK_CLOEXEC 02000000
1190 --- /dev/null
1191 +++ b/arch/mips64/bits/stat.h
1192 @@ -0,0 +1,23 @@
1193 +#include <string.h>
1194 +#include <bits/alltypes.h>
1195 +
1196 +struct stat {
1197 + dev_t st_dev;
1198 + int __pad1[3];
1199 + ino_t st_ino;
1200 + mode_t st_mode;
1201 + nlink_t st_nlink;
1202 + uid_t st_uid;
1203 + gid_t st_gid;
1204 + dev_t st_rdev;
1205 + unsigned int __pad2[2];
1206 + off_t st_size;
1207 + int __pad3;
1208 + struct timespec st_atim;
1209 + struct timespec st_mtim;
1210 + struct timespec st_ctim;
1211 + blksize_t st_blksize;
1212 + unsigned int __pad4;
1213 + blkcnt_t st_blocks;
1214 + int __pad5[14];
1215 +};
1216 --- /dev/null
1217 +++ b/arch/mips64/bits/statfs.h
1218 @@ -0,0 +1,8 @@
1219 +struct statfs {
1220 + unsigned long f_type, f_bsize, f_frsize;
1221 + fsblkcnt_t f_blocks, f_bfree;
1222 + fsfilcnt_t f_files, f_ffree;
1223 + fsblkcnt_t f_bavail;
1224 + fsid_t f_fsid;
1225 + unsigned long f_namelen, f_flags, f_spare[5];
1226 +};
1227 --- /dev/null
1228 +++ b/arch/mips64/bits/stdint.h
1229 @@ -0,0 +1,20 @@
1230 +typedef int32_t int_fast16_t;
1231 +typedef int32_t int_fast32_t;
1232 +typedef uint32_t uint_fast16_t;
1233 +typedef uint32_t uint_fast32_t;
1234 +
1235 +#define INT_FAST16_MIN INT32_MIN
1236 +#define INT_FAST32_MIN INT32_MIN
1237 +
1238 +#define INT_FAST16_MAX INT32_MAX
1239 +#define INT_FAST32_MAX INT32_MAX
1240 +
1241 +#define UINT_FAST16_MAX UINT32_MAX
1242 +#define UINT_FAST32_MAX UINT32_MAX
1243 +
1244 +#define INTPTR_MIN INT64_MIN
1245 +#define INTPTR_MAX INT64_MAX
1246 +#define UINTPTR_MAX UINT64_MAX
1247 +#define PTRDIFF_MIN INT64_MIN
1248 +#define PTRDIFF_MAX INT64_MAX
1249 +#define SIZE_MAX UINT64_MAX
1250 --- /dev/null
1251 +++ b/arch/mips64/bits/syscall.h
1252 @@ -0,0 +1,633 @@
1253 +#define __NR_read 5000
1254 +#define __NR_write 5001
1255 +#define __NR_open 5002
1256 +#define __NR_close 5003
1257 +#define __NR_stat 5004
1258 +#define __NR_fstat 5005
1259 +#define __NR_lstat 5006
1260 +#define __NR_poll 5007
1261 +#define __NR_lseek 5008
1262 +#define __NR_mmap 5009
1263 +#define __NR_mprotect 5010
1264 +#define __NR_munmap 5011
1265 +#define __NR_brk 5012
1266 +#define __NR_rt_sigaction 5013
1267 +#define __NR_rt_sigprocmask 5014
1268 +#define __NR_ioctl 5015
1269 +#define __NR_pread64 5016
1270 +#define __NR_pwrite64 5017
1271 +#define __NR_readv 5018
1272 +#define __NR_writev 5019
1273 +#define __NR_access 5020
1274 +#define __NR_pipe 5021
1275 +#define __NR__newselect 5022
1276 +#define __NR_sched_yield 5023
1277 +#define __NR_mremap 5024
1278 +#define __NR_msync 5025
1279 +#define __NR_mincore 5026
1280 +#define __NR_madvise 5027
1281 +#define __NR_shmget 5028
1282 +#define __NR_shmat 5029
1283 +#define __NR_shmctl 5030
1284 +#define __NR_dup 5031
1285 +#define __NR_dup2 5032
1286 +#define __NR_pause 5033
1287 +#define __NR_nanosleep 5034
1288 +#define __NR_getitimer 5035
1289 +#define __NR_setitimer 5036
1290 +#define __NR_alarm 5037
1291 +#define __NR_getpid 5038
1292 +#define __NR_sendfile 5039
1293 +#define __NR_socket 5040
1294 +#define __NR_connect 5041
1295 +#define __NR_accept 5042
1296 +#define __NR_sendto 5043
1297 +#define __NR_recvfrom 5044
1298 +#define __NR_sendmsg 5045
1299 +#define __NR_recvmsg 5046
1300 +#define __NR_shutdown 5047
1301 +#define __NR_bind 5048
1302 +#define __NR_listen 5049
1303 +#define __NR_getsockname 5050
1304 +#define __NR_getpeername 5051
1305 +#define __NR_socketpair 5052
1306 +#define __NR_setsockopt 5053
1307 +#define __NR_getsockopt 5054
1308 +#define __NR_clone 5055
1309 +#define __NR_fork 5056
1310 +#define __NR_execve 5057
1311 +#define __NR_exit 5058
1312 +#define __NR_wait4 5059
1313 +#define __NR_kill 5060
1314 +#define __NR_uname 5061
1315 +#define __NR_semget 5062
1316 +#define __NR_semop 5063
1317 +#define __NR_semctl 5064
1318 +#define __NR_shmdt 5065
1319 +#define __NR_msgget 5066
1320 +#define __NR_msgsnd 5067
1321 +#define __NR_msgrcv 5068
1322 +#define __NR_msgctl 5069
1323 +#define __NR_fcntl 5070
1324 +#define __NR_flock 5071
1325 +#define __NR_fsync 5072
1326 +#define __NR_fdatasync 5073
1327 +#define __NR_truncate 5074
1328 +#define __NR_ftruncate 5075
1329 +#define __NR_getdents 5076
1330 +#define __NR_getcwd 5077
1331 +#define __NR_chdir 5078
1332 +#define __NR_fchdir 5079
1333 +#define __NR_rename 5080
1334 +#define __NR_mkdir 5081
1335 +#define __NR_rmdir 5082
1336 +#define __NR_creat 5083
1337 +#define __NR_link 5084
1338 +#define __NR_unlink 5085
1339 +#define __NR_symlink 5086
1340 +#define __NR_readlink 5087
1341 +#define __NR_chmod 5088
1342 +#define __NR_fchmod 5089
1343 +#define __NR_chown 5090
1344 +#define __NR_fchown 5091
1345 +#define __NR_lchown 5092
1346 +#define __NR_umask 5093
1347 +#define __NR_gettimeofday 5094
1348 +#define __NR_getrlimit 5095
1349 +#define __NR_getrusage 5096
1350 +#define __NR_sysinfo 5097
1351 +#define __NR_times 5098
1352 +#define __NR_ptrace 5099
1353 +#define __NR_getuid 5100
1354 +#define __NR_syslog 5101
1355 +#define __NR_getgid 5102
1356 +#define __NR_setuid 5103
1357 +#define __NR_setgid 5104
1358 +#define __NR_geteuid 5105
1359 +#define __NR_getegid 5106
1360 +#define __NR_setpgid 5107
1361 +#define __NR_getppid 5108
1362 +#define __NR_getpgrp 5109
1363 +#define __NR_setsid 5110
1364 +#define __NR_setreuid 5111
1365 +#define __NR_setregid 5112
1366 +#define __NR_getgroups 5113
1367 +#define __NR_setgroups 5114
1368 +#define __NR_setresuid 5115
1369 +#define __NR_getresuid 5116
1370 +#define __NR_setresgid 5117
1371 +#define __NR_getresgid 5118
1372 +#define __NR_getpgid 5119
1373 +#define __NR_setfsuid 5120
1374 +#define __NR_setfsgid 5121
1375 +#define __NR_getsid 5122
1376 +#define __NR_capget 5123
1377 +#define __NR_capset 5124
1378 +#define __NR_rt_sigpending 5125
1379 +#define __NR_rt_sigtimedwait 5126
1380 +#define __NR_rt_sigqueueinfo 5127
1381 +#define __NR_rt_sigsuspend 5128
1382 +#define __NR_sigaltstack 5129
1383 +#define __NR_utime 5130
1384 +#define __NR_mknod 5131
1385 +#define __NR_personality 5132
1386 +#define __NR_ustat 5133
1387 +#define __NR_statfs 5134
1388 +#define __NR_fstatfs 5135
1389 +#define __NR_sysfs 5136
1390 +#define __NR_getpriority 5137
1391 +#define __NR_setpriority 5138
1392 +#define __NR_sched_setparam 5139
1393 +#define __NR_sched_getparam 5140
1394 +#define __NR_sched_setscheduler 5141
1395 +#define __NR_sched_getscheduler 5142
1396 +#define __NR_sched_get_priority_max 5143
1397 +#define __NR_sched_get_priority_min 5144
1398 +#define __NR_sched_rr_get_interval 5145
1399 +#define __NR_mlock 5146
1400 +#define __NR_munlock 5147
1401 +#define __NR_mlockall 5148
1402 +#define __NR_munlockall 5149
1403 +#define __NR_vhangup 5150
1404 +#define __NR_pivot_root 5151
1405 +#define __NR__sysctl 5152
1406 +#define __NR_prctl 5153
1407 +#define __NR_adjtimex 5154
1408 +#define __NR_setrlimit 5155
1409 +#define __NR_chroot 5156
1410 +#define __NR_sync 5157
1411 +#define __NR_acct 5158
1412 +#define __NR_settimeofday 5159
1413 +#define __NR_mount 5160
1414 +#define __NR_umount2 5161
1415 +#define __NR_swapon 5162
1416 +#define __NR_swapoff 5163
1417 +#define __NR_reboot 5164
1418 +#define __NR_sethostname 5165
1419 +#define __NR_setdomainname 5166
1420 +#define __NR_create_module 5167
1421 +#define __NR_init_module 5168
1422 +#define __NR_delete_module 5169
1423 +#define __NR_get_kernel_syms 5170
1424 +#define __NR_query_module 5171
1425 +#define __NR_quotactl 5172
1426 +#define __NR_nfsservctl 5173
1427 +#define __NR_getpmsg 5174
1428 +#define __NR_putpmsg 5175
1429 +#define __NR_afs_syscall 5176
1430 +#define __NR_reserved177 5177
1431 +#define __NR_gettid 5178
1432 +#define __NR_readahead 5179
1433 +#define __NR_setxattr 5180
1434 +#define __NR_lsetxattr 5181
1435 +#define __NR_fsetxattr 5182
1436 +#define __NR_getxattr 5183
1437 +#define __NR_lgetxattr 5184
1438 +#define __NR_fgetxattr 5185
1439 +#define __NR_listxattr 5186
1440 +#define __NR_llistxattr 5187
1441 +#define __NR_flistxattr 5188
1442 +#define __NR_removexattr 5189
1443 +#define __NR_lremovexattr 5190
1444 +#define __NR_fremovexattr 5191
1445 +#define __NR_tkill 5192
1446 +#define __NR_reserved193 5193
1447 +#define __NR_futex 5194
1448 +#define __NR_sched_setaffinity 5195
1449 +#define __NR_sched_getaffinity 5196
1450 +#define __NR_cacheflush 5197
1451 +#define __NR_cachectl 5198
1452 +#define __NR_sysmips 5199
1453 +#define __NR_io_setup 5200
1454 +#define __NR_io_destroy 5201
1455 +#define __NR_io_getevents 5202
1456 +#define __NR_io_submit 5203
1457 +#define __NR_io_cancel 5204
1458 +#define __NR_exit_group 5205
1459 +#define __NR_lookup_dcookie 5206
1460 +#define __NR_epoll_create 5207
1461 +#define __NR_epoll_ctl 5208
1462 +#define __NR_epoll_wait 5209
1463 +#define __NR_remap_file_pages 5210
1464 +#define __NR_rt_sigreturn 5211
1465 +#define __NR_set_tid_address 5212
1466 +#define __NR_restart_syscall 5213
1467 +#define __NR_semtimedop 5214
1468 +#define __NR_fadvise64 5215
1469 +#define __NR_timer_create 5216
1470 +#define __NR_timer_settime 5217
1471 +#define __NR_timer_gettime 5218
1472 +#define __NR_timer_getoverrun 5219
1473 +#define __NR_timer_delete 5220
1474 +#define __NR_clock_settime 5221
1475 +#define __NR_clock_gettime 5222
1476 +#define __NR_clock_getres 5223
1477 +#define __NR_clock_nanosleep 5224
1478 +#define __NR_tgkill 5225
1479 +#define __NR_utimes 5226
1480 +#define __NR_mbind 5227
1481 +#define __NR_get_mempolicy 5228
1482 +#define __NR_set_mempolicy 5229
1483 +#define __NR_mq_open 5230
1484 +#define __NR_mq_unlink 5231
1485 +#define __NR_mq_timedsend 5232
1486 +#define __NR_mq_timedreceive 5233
1487 +#define __NR_mq_notify 5234
1488 +#define __NR_mq_getsetattr 5235
1489 +#define __NR_vserver 5236
1490 +#define __NR_waitid 5237
1491 +#define __NR_add_key 5239
1492 +#define __NR_request_key 5240
1493 +#define __NR_keyctl 5241
1494 +#define __NR_set_thread_area 5242
1495 +#define __NR_inotify_init 5243
1496 +#define __NR_inotify_add_watch 5244
1497 +#define __NR_inotify_rm_watch 5245
1498 +#define __NR_migrate_pages 5246
1499 +#define __NR_openat 5247
1500 +#define __NR_mkdirat 5248
1501 +#define __NR_mknodat 5249
1502 +#define __NR_fchownat 5250
1503 +#define __NR_futimesat 5251
1504 +#define __NR_newfstatat 5252
1505 +#define __NR_unlinkat 5253
1506 +#define __NR_renameat 5254
1507 +#define __NR_linkat 5255
1508 +#define __NR_symlinkat 5256
1509 +#define __NR_readlinkat 5257
1510 +#define __NR_fchmodat 5258
1511 +#define __NR_faccessat 5259
1512 +#define __NR_pselect6 5260
1513 +#define __NR_ppoll 5261
1514 +#define __NR_unshare 5262
1515 +#define __NR_splice 5263
1516 +#define __NR_sync_file_range 5264
1517 +#define __NR_tee 5265
1518 +#define __NR_vmsplice 5266
1519 +#define __NR_move_pages 5267
1520 +#define __NR_set_robust_list 5268
1521 +#define __NR_get_robust_list 5269
1522 +#define __NR_kexec_load 5270
1523 +#define __NR_getcpu 5271
1524 +#define __NR_epoll_pwait 5272
1525 +#define __NR_ioprio_set 5273
1526 +#define __NR_ioprio_get 5274
1527 +#define __NR_utimensat 5275
1528 +#define __NR_signalfd 5276
1529 +#define __NR_timerfd 5277
1530 +#define __NR_eventfd 5278
1531 +#define __NR_fallocate 5279
1532 +#define __NR_timerfd_create 5280
1533 +#define __NR_timerfd_gettime 5281
1534 +#define __NR_timerfd_settime 5282
1535 +#define __NR_signalfd4 5283
1536 +#define __NR_eventfd2 5284
1537 +#define __NR_epoll_create1 5285
1538 +#define __NR_dup3 5286
1539 +#define __NR_pipe2 5287
1540 +#define __NR_inotify_init1 5288
1541 +#define __NR_preadv 5289
1542 +#define __NR_pwritev 5290
1543 +#define __NR_rt_tgsigqueueinfo 5291
1544 +#define __NR_perf_event_open 5292
1545 +#define __NR_accept4 5293
1546 +#define __NR_recvmmsg 5294
1547 +#define __NR_fanotify_init 5295
1548 +#define __NR_fanotify_mark 5296
1549 +#define __NR_prlimit64 5297
1550 +#define __NR_name_to_handle_at 5298
1551 +#define __NR_open_by_handle_at 5299
1552 +#define __NR_clock_adjtime 5300
1553 +#define __NR_syncfs 5301
1554 +#define __NR_sendmmsg 5302
1555 +#define __NR_setns 5303
1556 +#define __NR_process_vm_readv 5304
1557 +#define __NR_process_vm_writev 5305
1558 +#define __NR_kcmp 5306
1559 +#define __NR_finit_module 5307
1560 +#define __NR_getdents64 5308
1561 +#define __NR_sched_setattr 5309
1562 +#define __NR_sched_getattr 5310
1563 +#define __NR_renameat2 5311
1564 +#define __NR_seccomp 5312
1565 +#define __NR_getrandom 5313
1566 +#define __NR_memfd_create 5314
1567 +#define __NR_bpf 5315
1568 +#define __NR_execveat 5316
1569 +
1570 +#define SYS_read 5000
1571 +#define SYS_write 5001
1572 +#define SYS_open 5002
1573 +#define SYS_close 5003
1574 +#define SYS_stat 5004
1575 +#define SYS_fstat 5005
1576 +#define SYS_lstat 5006
1577 +#define SYS_poll 5007
1578 +#define SYS_lseek 5008
1579 +#define SYS_mmap 5009
1580 +#define SYS_mprotect 5010
1581 +#define SYS_munmap 5011
1582 +#define SYS_brk 5012
1583 +#define SYS_rt_sigaction 5013
1584 +#define SYS_rt_sigprocmask 5014
1585 +#define SYS_ioctl 5015
1586 +#define SYS_pread64 5016
1587 +#define SYS_pwrite64 5017
1588 +#define SYS_readv 5018
1589 +#define SYS_writev 5019
1590 +#define SYS_access 5020
1591 +#define SYS_pipe 5021
1592 +#define SYS__newselect 5022
1593 +#define SYS_sched_yield 5023
1594 +#define SYS_mremap 5024
1595 +#define SYS_msync 5025
1596 +#define SYS_mincore 5026
1597 +#define SYS_madvise 5027
1598 +#define SYS_shmget 5028
1599 +#define SYS_shmat 5029
1600 +#define SYS_shmctl 5030
1601 +#define SYS_dup 5031
1602 +#define SYS_dup2 5032
1603 +#define SYS_pause 5033
1604 +#define SYS_nanosleep 5034
1605 +#define SYS_getitimer 5035
1606 +#define SYS_setitimer 5036
1607 +#define SYS_alarm 5037
1608 +#define SYS_getpid 5038
1609 +#define SYS_sendfile 5039
1610 +#define SYS_socket 5040
1611 +#define SYS_connect 5041
1612 +#define SYS_accept 5042
1613 +#define SYS_sendto 5043
1614 +#define SYS_recvfrom 5044
1615 +#define SYS_sendmsg 5045
1616 +#define SYS_recvmsg 5046
1617 +#define SYS_shutdown 5047
1618 +#define SYS_bind 5048
1619 +#define SYS_listen 5049
1620 +#define SYS_getsockname 5050
1621 +#define SYS_getpeername 5051
1622 +#define SYS_socketpair 5052
1623 +#define SYS_setsockopt 5053
1624 +#define SYS_getsockopt 5054
1625 +#define SYS_clone 5055
1626 +#define SYS_fork 5056
1627 +#define SYS_execve 5057
1628 +#define SYS_exit 5058
1629 +#define SYS_wait4 5059
1630 +#define SYS_kill 5060
1631 +#define SYS_uname 5061
1632 +#define SYS_semget 5062
1633 +#define SYS_semop 5063
1634 +#define SYS_semctl 5064
1635 +#define SYS_shmdt 5065
1636 +#define SYS_msgget 5066
1637 +#define SYS_msgsnd 5067
1638 +#define SYS_msgrcv 5068
1639 +#define SYS_msgctl 5069
1640 +#define SYS_fcntl 5070
1641 +#define SYS_flock 5071
1642 +#define SYS_fsync 5072
1643 +#define SYS_fdatasync 5073
1644 +#define SYS_truncate 5074
1645 +#define SYS_ftruncate 5075
1646 +#define SYS_getdents 5076
1647 +#define SYS_getcwd 5077
1648 +#define SYS_chdir 5078
1649 +#define SYS_fchdir 5079
1650 +#define SYS_rename 5080
1651 +#define SYS_mkdir 5081
1652 +#define SYS_rmdir 5082
1653 +#define SYS_creat 5083
1654 +#define SYS_link 5084
1655 +#define SYS_unlink 5085
1656 +#define SYS_symlink 5086
1657 +#define SYS_readlink 5087
1658 +#define SYS_chmod 5088
1659 +#define SYS_fchmod 5089
1660 +#define SYS_chown 5090
1661 +#define SYS_fchown 5091
1662 +#define SYS_lchown 5092
1663 +#define SYS_umask 5093
1664 +#define SYS_gettimeofday 5094
1665 +#define SYS_getrlimit 5095
1666 +#define SYS_getrusage 5096
1667 +#define SYS_sysinfo 5097
1668 +#define SYS_times 5098
1669 +#define SYS_ptrace 5099
1670 +#define SYS_getuid 5100
1671 +#define SYS_syslog 5101
1672 +#define SYS_getgid 5102
1673 +#define SYS_setuid 5103
1674 +#define SYS_setgid 5104
1675 +#define SYS_geteuid 5105
1676 +#define SYS_getegid 5106
1677 +#define SYS_setpgid 5107
1678 +#define SYS_getppid 5108
1679 +#define SYS_getpgrp 5109
1680 +#define SYS_setsid 5110
1681 +#define SYS_setreuid 5111
1682 +#define SYS_setregid 5112
1683 +#define SYS_getgroups 5113
1684 +#define SYS_setgroups 5114
1685 +#define SYS_setresuid 5115
1686 +#define SYS_getresuid 5116
1687 +#define SYS_setresgid 5117
1688 +#define SYS_getresgid 5118
1689 +#define SYS_getpgid 5119
1690 +#define SYS_setfsuid 5120
1691 +#define SYS_setfsgid 5121
1692 +#define SYS_getsid 5122
1693 +#define SYS_capget 5123
1694 +#define SYS_capset 5124
1695 +#define SYS_rt_sigpending 5125
1696 +#define SYS_rt_sigtimedwait 5126
1697 +#define SYS_rt_sigqueueinfo 5127
1698 +#define SYS_rt_sigsuspend 5128
1699 +#define SYS_sigaltstack 5129
1700 +#define SYS_utime 5130
1701 +#define SYS_mknod 5131
1702 +#define SYS_personality 5132
1703 +#define SYS_ustat 5133
1704 +#define SYS_statfs 5134
1705 +#define SYS_fstatfs 5135
1706 +#define SYS_sysfs 5136
1707 +#define SYS_getpriority 5137
1708 +#define SYS_setpriority 5138
1709 +#define SYS_sched_setparam 5139
1710 +#define SYS_sched_getparam 5140
1711 +#define SYS_sched_setscheduler 5141
1712 +#define SYS_sched_getscheduler 5142
1713 +#define SYS_sched_get_priority_max 5143
1714 +#define SYS_sched_get_priority_min 5144
1715 +#define SYS_sched_rr_get_interval 5145
1716 +#define SYS_mlock 5146
1717 +#define SYS_munlock 5147
1718 +#define SYS_mlockall 5148
1719 +#define SYS_munlockall 5149
1720 +#define SYS_vhangup 5150
1721 +#define SYS_pivot_root 5151
1722 +#define SYS__sysctl 5152
1723 +#define SYS_prctl 5153
1724 +#define SYS_adjtimex 5154
1725 +#define SYS_setrlimit 5155
1726 +#define SYS_chroot 5156
1727 +#define SYS_sync 5157
1728 +#define SYS_acct 5158
1729 +#define SYS_settimeofday 5159
1730 +#define SYS_mount 5160
1731 +#define SYS_umount2 5161
1732 +#define SYS_swapon 5162
1733 +#define SYS_swapoff 5163
1734 +#define SYS_reboot 5164
1735 +#define SYS_sethostname 5165
1736 +#define SYS_setdomainname 5166
1737 +#define SYS_create_module 5167
1738 +#define SYS_init_module 5168
1739 +#define SYS_delete_module 5169
1740 +#define SYS_get_kernel_syms 5170
1741 +#define SYS_query_module 5171
1742 +#define SYS_quotactl 5172
1743 +#define SYS_nfsservctl 5173
1744 +#define SYS_getpmsg 5174
1745 +#define SYS_putpmsg 5175
1746 +#define SYS_afs_syscall 5176
1747 +#define SYS_reserved177 5177
1748 +#define SYS_gettid 5178
1749 +#define SYS_readahead 5179
1750 +#define SYS_setxattr 5180
1751 +#define SYS_lsetxattr 5181
1752 +#define SYS_fsetxattr 5182
1753 +#define SYS_getxattr 5183
1754 +#define SYS_lgetxattr 5184
1755 +#define SYS_fgetxattr 5185
1756 +#define SYS_listxattr 5186
1757 +#define SYS_llistxattr 5187
1758 +#define SYS_flistxattr 5188
1759 +#define SYS_removexattr 5189
1760 +#define SYS_lremovexattr 5190
1761 +#define SYS_fremovexattr 5191
1762 +#define SYS_tkill 5192
1763 +#define SYS_reserved193 5193
1764 +#define SYS_futex 5194
1765 +#define SYS_sched_setaffinity 5195
1766 +#define SYS_sched_getaffinity 5196
1767 +#define SYS_cacheflush 5197
1768 +#define SYS_cachectl 5198
1769 +#define SYS_sysmips 5199
1770 +#define SYS_io_setup 5200
1771 +#define SYS_io_destroy 5201
1772 +#define SYS_io_getevents 5202
1773 +#define SYS_io_submit 5203
1774 +#define SYS_io_cancel 5204
1775 +#define SYS_exit_group 5205
1776 +#define SYS_lookup_dcookie 5206
1777 +#define SYS_epoll_create 5207
1778 +#define SYS_epoll_ctl 5208
1779 +#define SYS_epoll_wait 5209
1780 +#define SYS_remap_file_pages 5210
1781 +#define SYS_rt_sigreturn 5211
1782 +#define SYS_set_tid_address 5212
1783 +#define SYS_restart_syscall 5213
1784 +#define SYS_semtimedop 5214
1785 +#define SYS_fadvise64 5215
1786 +#define SYS_timer_create 5216
1787 +#define SYS_timer_settime 5217
1788 +#define SYS_timer_gettime 5218
1789 +#define SYS_timer_getoverrun 5219
1790 +#define SYS_timer_delete 5220
1791 +#define SYS_clock_settime 5221
1792 +#define SYS_clock_gettime 5222
1793 +#define SYS_clock_getres 5223
1794 +#define SYS_clock_nanosleep 5224
1795 +#define SYS_tgkill 5225
1796 +#define SYS_utimes 5226
1797 +#define SYS_mbind 5227
1798 +#define SYS_get_mempolicy 5228
1799 +#define SYS_set_mempolicy 5229
1800 +#define SYS_mq_open 5230
1801 +#define SYS_mq_unlink 5231
1802 +#define SYS_mq_timedsend 5232
1803 +#define SYS_mq_timedreceive 5233
1804 +#define SYS_mq_notify 5234
1805 +#define SYS_mq_getsetattr 5235
1806 +#define SYS_vserver 5236
1807 +#define SYS_waitid 5237
1808 +#define SYS_add_key 5239
1809 +#define SYS_request_key 5240
1810 +#define SYS_keyctl 5241
1811 +#define SYS_set_thread_area 5242
1812 +#define SYS_inotify_init 5243
1813 +#define SYS_inotify_add_watch 5244
1814 +#define SYS_inotify_rm_watch 5245
1815 +#define SYS_migrate_pages 5246
1816 +#define SYS_openat 5247
1817 +#define SYS_mkdirat 5248
1818 +#define SYS_mknodat 5249
1819 +#define SYS_fchownat 5250
1820 +#define SYS_futimesat 5251
1821 +#define SYS_newfstatat 5252
1822 +#define SYS_unlinkat 5253
1823 +#define SYS_renameat 5254
1824 +#define SYS_linkat 5255
1825 +#define SYS_symlinkat 5256
1826 +#define SYS_readlinkat 5257
1827 +#define SYS_fchmodat 5258
1828 +#define SYS_faccessat 5259
1829 +#define SYS_pselect6 5260
1830 +#define SYS_ppoll 5261
1831 +#define SYS_unshare 5262
1832 +#define SYS_splice 5263
1833 +#define SYS_sync_file_range 5264
1834 +#define SYS_tee 5265
1835 +#define SYS_vmsplice 5266
1836 +#define SYS_move_pages 5267
1837 +#define SYS_set_robust_list 5268
1838 +#define SYS_get_robust_list 5269
1839 +#define SYS_kexec_load 5270
1840 +#define SYS_getcpu 5271
1841 +#define SYS_epoll_pwait 5272
1842 +#define SYS_ioprio_set 5273
1843 +#define SYS_ioprio_get 5274
1844 +#define SYS_utimensat 5275
1845 +#define SYS_signalfd 5276
1846 +#define SYS_timerfd 5277
1847 +#define SYS_eventfd 5278
1848 +#define SYS_fallocate 5279
1849 +#define SYS_timerfd_create 5280
1850 +#define SYS_timerfd_gettime 5281
1851 +#define SYS_timerfd_settime 5282
1852 +#define SYS_signalfd4 5283
1853 +#define SYS_eventfd2 5284
1854 +#define SYS_epoll_create1 5285
1855 +#define SYS_dup3 5286
1856 +#define SYS_pipe2 5287
1857 +#define SYS_inotify_init1 5288
1858 +#define SYS_preadv 5289
1859 +#define SYS_pwritev 5290
1860 +#define SYS_rt_tgsigqueueinfo 5291
1861 +#define SYS_perf_event_open 5292
1862 +#define SYS_accept4 5293
1863 +#define SYS_recvmmsg 5294
1864 +#define SYS_fanotify_init 5295
1865 +#define SYS_fanotify_mark 5296
1866 +#define SYS_prlimit64 5297
1867 +#define SYS_name_to_handle_at 5298
1868 +#define SYS_open_by_handle_at 5299
1869 +#define SYS_clock_adjtime 5300
1870 +#define SYS_syncfs 5301
1871 +#define SYS_sendmmsg 5302
1872 +#define SYS_setns 5303
1873 +#define SYS_process_vm_readv 5304
1874 +#define SYS_process_vm_writev 5305
1875 +#define SYS_kcmp 5306
1876 +#define SYS_finit_module 5307
1877 +#define SYS_getdents64 5308
1878 +#define SYS_sched_setattr 5309
1879 +#define SYS_sched_getattr 5310
1880 +#define SYS_renameat2 5311
1881 +#define SYS_seccomp 5312
1882 +#define SYS_getrandom 5313
1883 +#define SYS_memfd_create 5314
1884 +#define SYS_bpf 5315
1885 +#define SYS_execveat 5316
1886 --- /dev/null
1887 +++ b/arch/mips64/bits/termios.h
1888 @@ -0,0 +1,166 @@
1889 +struct termios {
1890 + tcflag_t c_iflag;
1891 + tcflag_t c_oflag;
1892 + tcflag_t c_cflag;
1893 + tcflag_t c_lflag;
1894 + cc_t c_line;
1895 + cc_t c_cc[NCCS];
1896 +};
1897 +
1898 +#define VINTR 0
1899 +#define VQUIT 1
1900 +#define VERASE 2
1901 +#define VKILL 3
1902 +#define VMIN 4
1903 +#define VTIME 5
1904 +#define VEOL2 6
1905 +#define VSWTC 7
1906 +#define VSWTCH 7
1907 +#define VSTART 8
1908 +#define VSTOP 9
1909 +#define VSUSP 10
1910 +#define VREPRINT 12
1911 +#define VDISCARD 13
1912 +#define VWERASE 14
1913 +#define VLNEXT 15
1914 +#define VEOF 16
1915 +#define VEOL 17
1916 +
1917 +#define IGNBRK 0000001
1918 +#define BRKINT 0000002
1919 +#define IGNPAR 0000004
1920 +#define PARMRK 0000010
1921 +#define INPCK 0000020
1922 +#define ISTRIP 0000040
1923 +#define INLCR 0000100
1924 +#define IGNCR 0000200
1925 +#define ICRNL 0000400
1926 +#define IUCLC 0001000
1927 +#define IXON 0002000
1928 +#define IXANY 0004000
1929 +#define IXOFF 0010000
1930 +#define IMAXBEL 0020000
1931 +#define IUTF8 0040000
1932 +
1933 +#define OPOST 0000001
1934 +#define OLCUC 0000002
1935 +#define ONLCR 0000004
1936 +#define OCRNL 0000010
1937 +#define ONOCR 0000020
1938 +#define ONLRET 0000040
1939 +#define OFILL 0000100
1940 +#define OFDEL 0000200
1941 +#define NLDLY 0000400
1942 +#define NL0 0000000
1943 +#define NL1 0000400
1944 +#define CRDLY 0003000
1945 +#define CR0 0000000
1946 +#define CR1 0001000
1947 +#define CR2 0002000
1948 +#define CR3 0003000
1949 +#define TABDLY 0014000
1950 +#define TAB0 0000000
1951 +#define TAB1 0004000
1952 +#define TAB2 0010000
1953 +#define TAB3 0014000
1954 +#define BSDLY 0020000
1955 +#define BS0 0000000
1956 +#define BS1 0020000
1957 +#define FFDLY 0100000
1958 +#define FF0 0000000
1959 +#define FF1 0100000
1960 +
1961 +#define VTDLY 0040000
1962 +#define VT0 0000000
1963 +#define VT1 0040000
1964 +
1965 +#define B0 0000000
1966 +#define B50 0000001
1967 +#define B75 0000002
1968 +#define B110 0000003
1969 +#define B134 0000004
1970 +#define B150 0000005
1971 +#define B200 0000006
1972 +#define B300 0000007
1973 +#define B600 0000010
1974 +#define B1200 0000011
1975 +#define B1800 0000012
1976 +#define B2400 0000013
1977 +#define B4800 0000014
1978 +#define B9600 0000015
1979 +#define B19200 0000016
1980 +#define B38400 0000017
1981 +#define EXTA 0000016
1982 +#define EXTB 0000017
1983 +
1984 +#define BOTHER 0010000
1985 +#define B57600 0010001
1986 +#define B115200 0010002
1987 +#define B230400 0010003
1988 +#define B460800 0010004
1989 +#define B500000 0010005
1990 +#define B576000 0010006
1991 +#define B921600 0010007
1992 +#define B1000000 0010010
1993 +#define B1152000 0010011
1994 +#define B1500000 0010012
1995 +#define B2000000 0010013
1996 +#define B2500000 0010014
1997 +#define B3000000 0010015
1998 +#define B3500000 0010016
1999 +#define B4000000 0010017
2000 +
2001 +#define CBAUD 0010017
2002 +
2003 +#define CSIZE 0000060
2004 +#define CS5 0000000
2005 +#define CS6 0000020
2006 +#define CS7 0000040
2007 +#define CS8 0000060
2008 +#define CSTOPB 0000100
2009 +#define CREAD 0000200
2010 +#define PARENB 0000400
2011 +#define PARODD 0001000
2012 +#define HUPCL 0002000
2013 +#define CLOCAL 0004000
2014 +
2015 +#define ISIG 0000001
2016 +#define ICANON 0000002
2017 +#define XCASE 0000004
2018 +#define ECHO 0000010
2019 +#define ECHOE 0000020
2020 +#define ECHOK 0000040
2021 +#define ECHONL 0000100
2022 +#define NOFLSH 0000200
2023 +#define IEXTEN 0000400
2024 +#define ECHOCTL 0001000
2025 +#define ECHOPRT 0002000
2026 +#define ECHOKE 0004000
2027 +#define FLUSHO 0020000
2028 +#define PENDIN 0040000
2029 +#define TOSTOP 0100000
2030 +#define ITOSTOP 0100000
2031 +
2032 +#define TCOOFF 0
2033 +#define TCOON 1
2034 +#define TCIOFF 2
2035 +#define TCION 3
2036 +
2037 +#define TCIFLUSH 0
2038 +#define TCOFLUSH 1
2039 +#define TCIOFLUSH 2
2040 +
2041 +#define TCSANOW 0
2042 +#define TCSADRAIN 1
2043 +#define TCSAFLUSH 2
2044 +
2045 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
2046 +#define CBAUDEX 0010000
2047 +#define CIBAUD 002003600000
2048 +#define IBSHIFT 16
2049 +#define CMSPAR 010000000000
2050 +#define CRTSCTS 020000000000
2051 +#define EXTPROC 0200000
2052 +#define XTABS 0014000
2053 +#define TIOCSER_TEMT 1
2054 +#endif
2055 --- /dev/null
2056 +++ b/arch/mips64/bits/user.h
2057 @@ -0,0 +1,15 @@
2058 +struct user {
2059 + unsigned long regs[102];
2060 + unsigned long u_tsize, u_dsize, u_ssize;
2061 + unsigned long long start_code, start_data, start_stack;
2062 + long long signal;
2063 + unsigned long long *u_ar0;
2064 + unsigned long long magic;
2065 + char u_comm[32];
2066 +};
2067 +
2068 +#define ELF_NGREG 45
2069 +#define ELF_NFPREG 33
2070 +
2071 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
2072 +typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
2073 --- /dev/null
2074 +++ b/arch/mips64/crt_arch.h
2075 @@ -0,0 +1,33 @@
2076 +__asm__(
2077 +".set push\n"
2078 +".set noreorder\n"
2079 +".text \n"
2080 +".global _" START "\n"
2081 +".global " START "\n"
2082 +".global " START "_data\n"
2083 +".type _" START ", @function\n"
2084 +".type " START ", @function\n"
2085 +".type " START "_data, @function\n"
2086 +"_" START ":\n"
2087 +"" START ":\n"
2088 +".align 8 \n"
2089 +" bal 1f \n"
2090 +" move $fp, $0 \n"
2091 +"" START "_data: \n"
2092 +" .gpdword " START "_data \n"
2093 +" .gpdword " START "_c \n"
2094 +".weak _DYNAMIC \n"
2095 +".hidden _DYNAMIC \n"
2096 +" .gpdword _DYNAMIC \n"
2097 +"1: ld $gp, 0($ra) \n"
2098 +" dsubu $gp, $ra, $gp \n"
2099 +" move $4, $sp \n"
2100 +" ld $5, 16($ra) \n"
2101 +" daddu $5, $5, $gp \n"
2102 +" ld $25, 8($ra) \n"
2103 +" daddu $25, $25, $gp \n"
2104 +" and $sp, $sp, -16 \n"
2105 +" jalr $25 \n"
2106 +" nop \n"
2107 +".set pop \n"
2108 +);
2109 --- /dev/null
2110 +++ b/arch/mips64/ksigaction.h
2111 @@ -0,0 +1,8 @@
2112 +struct k_sigaction {
2113 + unsigned flags;
2114 + void (*handler)(int);
2115 + unsigned long mask[2];
2116 + void (*restorer)();
2117 +};
2118 +
2119 +void __restore(), __restore_rt();
2120 --- /dev/null
2121 +++ b/arch/mips64/pthread_arch.h
2122 @@ -0,0 +1,18 @@
2123 +static inline struct pthread *__pthread_self()
2124 +{
2125 +#ifdef __clang__
2126 + char *tp;
2127 + __asm__ __volatile__ (".word 0x7c03e83b ; move %0, $3" : "=r" (tp) : : "$3" );
2128 +#else
2129 + register char *tp __asm__("$3");
2130 + __asm__ __volatile__ (".word 0x7c03e83b" : "=r" (tp) );
2131 +#endif
2132 + return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
2133 +}
2134 +
2135 +#define TLS_ABOVE_TP
2136 +#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
2137 +
2138 +#define DTP_OFFSET 0x8000
2139 +
2140 +#define MC_PC pc
2141 --- /dev/null
2142 +++ b/arch/mips64/reloc.h
2143 @@ -0,0 +1,60 @@
2144 +#ifndef __RELOC_H__
2145 +#define __RELOC_H__
2146 +
2147 +#define _GNU_SOURCE
2148 +#include <endian.h>
2149 +
2150 +#if __BYTE_ORDER == __LITTLE_ENDIAN
2151 +#define ENDIAN_SUFFIX "el"
2152 +#else
2153 +#define ENDIAN_SUFFIX ""
2154 +#endif
2155 +
2156 +#ifdef __mips_soft_float
2157 +#define FP_SUFFIX "-sf"
2158 +#else
2159 +#define FP_SUFFIX ""
2160 +#endif
2161 +
2162 +#define LDSO_ARCH "mips64" ENDIAN_SUFFIX FP_SUFFIX
2163 +
2164 +#define TPOFF_K (-0x7000)
2165 +
2166 +#define REL_SYM_OR_REL 4611
2167 +#define REL_PLT R_MIPS_JUMP_SLOT
2168 +#define REL_COPY R_MIPS_COPY
2169 +#define REL_DTPMOD R_MIPS_TLS_DTPMOD64
2170 +#define REL_DTPOFF R_MIPS_TLS_DTPREL64
2171 +#define REL_TPOFF R_MIPS_TLS_TPREL64
2172 +
2173 +#undef R_TYPE
2174 +#undef R_SYM
2175 +#undef R_INFO
2176 +#define R_TYPE(x) (be64toh(x)&0x7fffffff)
2177 +#define R_SYM(x) (be32toh(be64toh(x)>>32))
2178 +#define R_INFO(s,t) (htobe64((uint64_t)htobe32(s)<<32 | (uint64_t)t))
2179 +
2180 +#define NEED_MIPS_GOT_RELOCS 1
2181 +#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
2182 +#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
2183 +
2184 +#define CRTJMP(pc,sp) __asm__ __volatile__( \
2185 + "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
2186 +
2187 +#define GETFUNCSYM(fp, sym, got) __asm__ ( \
2188 + ".hidden " #sym "\n" \
2189 + ".set push \n" \
2190 + ".set noreorder \n" \
2191 + ".align 8 \n" \
2192 + " bal 1f \n" \
2193 + " nop \n" \
2194 + " .gpdword . \n" \
2195 + " .gpdword " #sym " \n" \
2196 + "1: ld %0, ($ra) \n" \
2197 + " dsubu %0, $ra, %0 \n" \
2198 + " ld $ra, 8($ra) \n" \
2199 + " daddu %0, %0, $ra \n" \
2200 + ".set pop \n" \
2201 + : "=r"(*(fp)) : : "memory", "ra" )
2202 +
2203 +#endif
2204 --- /dev/null
2205 +++ b/arch/mips64/syscall_arch.h
2206 @@ -0,0 +1,281 @@
2207 +#define __SYSCALL_LL_E(x) (x)
2208 +#define __SYSCALL_LL_O(x) (x)
2209 +
2210 +__attribute__((visibility("hidden")))
2211 +long (__syscall)(long, ...);
2212 +
2213 +#define SYSCALL_RLIM_INFINITY (-1UL/2)
2214 +
2215 +#include <sys/stat.h>
2216 +struct kernel_stat {
2217 + unsigned int st_dev;
2218 + unsigned int __pad1[3];
2219 + unsigned long long st_ino;
2220 + unsigned int st_mode;
2221 + unsigned int st_nlink;
2222 + int st_uid;
2223 + int st_gid;
2224 + unsigned int st_rdev;
2225 + unsigned int __pad2[3];
2226 + long long st_size;
2227 + unsigned int st_atime_sec;
2228 + unsigned int st_atime_nsec;
2229 + unsigned int st_mtime_sec;
2230 + unsigned int st_mtime_nsec;
2231 + unsigned int st_ctime_sec;
2232 + unsigned int st_ctime_nsec;
2233 + unsigned int st_blksize;
2234 + unsigned int __pad3;
2235 + unsigned long long st_blocks;
2236 +};
2237 +
2238 +static void __stat_fix(struct kernel_stat *kst, struct stat *st)
2239 +{
2240 + st->st_dev = kst->st_dev;
2241 + st->st_ino = kst->st_ino;
2242 + st->st_mode = kst->st_mode;
2243 + st->st_nlink = kst->st_nlink;
2244 + st->st_uid = kst->st_uid;
2245 + st->st_gid = kst->st_gid;
2246 + st->st_rdev = kst->st_rdev;
2247 + st->st_size = kst->st_size;
2248 + st->st_atim.tv_sec = kst->st_atime_sec;
2249 + st->st_atim.tv_nsec = kst->st_atime_nsec;
2250 + st->st_mtim.tv_sec = kst->st_mtime_sec;
2251 + st->st_mtim.tv_nsec = kst->st_mtime_nsec;
2252 + st->st_ctim.tv_sec = kst->st_ctime_sec;
2253 + st->st_ctim.tv_nsec = kst->st_ctime_nsec;
2254 + st->st_blksize = kst->st_blksize;
2255 + st->st_blocks = kst->st_blocks;
2256 +}
2257 +
2258 +#ifndef __clang__
2259 +
2260 +static inline long __syscall0(long n)
2261 +{
2262 + register long r7 __asm__("$7");
2263 + register long r2 __asm__("$2");
2264 + __asm__ __volatile__ (
2265 + "daddu $2,$0,%2 ; syscall"
2266 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
2267 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2268 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2269 + return r7 ? -r2 : r2;
2270 +}
2271 +
2272 +static inline long __syscall1(long n, long a)
2273 +{
2274 + register long r4 __asm__("$4") = a;
2275 + register long r7 __asm__("$7");
2276 + register long r2 __asm__("$2");
2277 + __asm__ __volatile__ (
2278 + "daddu $2,$0,%2 ; syscall"
2279 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2280 + "r"(r4)
2281 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2282 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2283 + return r7 ? -r2 : r2;
2284 +}
2285 +
2286 +static inline long __syscall2(long n, long a, long b)
2287 +{
2288 + struct kernel_stat kst;
2289 + long ret;
2290 + register long r4 __asm__("$4");
2291 + register long r5 __asm__("$5");
2292 + register long r7 __asm__("$7");
2293 + register long r2 __asm__("$2");
2294 +
2295 + r5 = b;
2296 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2297 + r5 = (long) &kst;
2298 +
2299 + r4 = a;
2300 + __asm__ __volatile__ (
2301 + "daddu $2,$0,%2 ; syscall"
2302 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2303 + "r"(r4), "r"(r5)
2304 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2305 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2306 +
2307 + if (r7) return -r2;
2308 + ret = r2;
2309 +
2310 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2311 + __stat_fix(&kst, (struct stat *)b);
2312 +
2313 + return ret;
2314 +}
2315 +
2316 +static inline long __syscall3(long n, long a, long b, long c)
2317 +{
2318 + struct kernel_stat kst;
2319 + long ret;
2320 + register long r4 __asm__("$4");
2321 + register long r5 __asm__("$5");
2322 + register long r6 __asm__("$6");
2323 + register long r7 __asm__("$7");
2324 + register long r2 __asm__("$2");
2325 +
2326 + r5 = b;
2327 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2328 + r5 = (long) &kst;
2329 +
2330 + r4 = a;
2331 + r6 = c;
2332 + __asm__ __volatile__ (
2333 + "daddu $2,$0,%2 ; syscall"
2334 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2335 + "r"(r4), "r"(r5), "r"(r6)
2336 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2337 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2338 +
2339 + if (r7) return -r2;
2340 + ret = r2;
2341 +
2342 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2343 + __stat_fix(&kst, (struct stat *)b);
2344 +
2345 + return ret;
2346 +}
2347 +
2348 +static inline long __syscall4(long n, long a, long b, long c, long d)
2349 +{
2350 + struct kernel_stat kst;
2351 + long ret;
2352 + register long r4 __asm__("$4");
2353 + register long r5 __asm__("$5");
2354 + register long r6 __asm__("$6");
2355 + register long r7 __asm__("$7");
2356 + register long r2 __asm__("$2");
2357 +
2358 + r5 = b;
2359 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2360 + r5 = (long) &kst;
2361 +
2362 + r4 = a;
2363 + r6 = c;
2364 + r7 = d;
2365 + __asm__ __volatile__ (
2366 + "daddu $2,$0,%2 ; syscall"
2367 + : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
2368 + "r"(r4), "r"(r5), "r"(r6)
2369 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
2370 + "$14", "$15", "$24", "$25", "hi", "lo", "memory");
2371 +
2372 + if (r7) return -r2;
2373 + ret = r2;
2374 +
2375 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2376 + __stat_fix(&kst, (struct stat *)b);
2377 +
2378 + return ret;
2379 +}
2380 +
2381 +#else
2382 +
2383 +static inline long __syscall0(long n)
2384 +{
2385 + return (__syscall)(n);
2386 +}
2387 +
2388 +static inline long __syscall1(long n, long a)
2389 +{
2390 + return (__syscall)(n, a);
2391 +}
2392 +
2393 +static inline long __syscall2(long n, long a, long b)
2394 +{
2395 + long r2;
2396 + long old_b = b;
2397 + struct kernel_stat kst;
2398 +
2399 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2400 + b = (long) &kst;
2401 +
2402 + r2 = (__syscall)(n, a, b);
2403 + if (r2 > -4096UL) return r2;
2404 +
2405 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2406 + __stat_fix(&kst, (struct stat *)old_b);
2407 +
2408 + return r2;
2409 +}
2410 +
2411 +static inline long __syscall3(long n, long a, long b, long c)
2412 +{
2413 + long r2;
2414 + long old_b = b;
2415 + struct kernel_stat kst;
2416 +
2417 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2418 + b = (long) &kst;
2419 +
2420 + r2 = (__syscall)(n, a, b, c);
2421 + if (r2 > -4096UL) return r2;
2422 +
2423 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2424 + __stat_fix(&kst, (struct stat *)old_b);
2425 +
2426 + return r2;
2427 +}
2428 +
2429 +static inline long __syscall4(long n, long a, long b, long c, long d)
2430 +{
2431 + long r2;
2432 + long old_b = b;
2433 + struct kernel_stat kst;
2434 +
2435 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2436 + b = (long) &kst;
2437 +
2438 + r2 = (__syscall)(n, a, b, c, d);
2439 + if (r2 > -4096UL) return r2;
2440 +
2441 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2442 + __stat_fix(&kst, (struct stat *)old_b);
2443 +
2444 + return r2;
2445 +}
2446 +
2447 +#endif
2448 +
2449 +static inline long __syscall5(long n, long a, long b, long c, long d, long e)
2450 +{
2451 + long r2;
2452 + long old_b = b;
2453 + struct kernel_stat kst;
2454 +
2455 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2456 + b = (long) &kst;
2457 +
2458 + r2 = (__syscall)(n, a, b, c, d, e);
2459 + if (r2 > -4096UL) return r2;
2460 +
2461 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2462 + __stat_fix(&kst, (struct stat *)old_b);
2463 +
2464 + return r2;
2465 +}
2466 +
2467 +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
2468 +{
2469 + long r2;
2470 + long old_b = b;
2471 + struct kernel_stat kst;
2472 +
2473 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2474 + b = (long) &kst;
2475 +
2476 + r2 = (__syscall)(n, a, b, c, d, e, f);
2477 + if (r2 > -4096UL) return r2;
2478 +
2479 + if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
2480 + __stat_fix(&kst, (struct stat *)old_b);
2481 +
2482 + return r2;
2483 +}
2484 +
2485 +#define VDSO_USEFUL
2486 +#define VDSO_CGT_SYM "__vdso_clock_gettime"
2487 +#define VDSO_CGT_VER "LINUX_2.6"
2488 --- a/arch/powerpc/bits/fenv.h
2489 +++ b/arch/powerpc/bits/fenv.h
2490 @@ -1,3 +1,7 @@
2491 +#ifdef _SOFT_FLOAT
2492 +#define FE_ALL_EXCEPT 0
2493 +#define FE_TONEAREST 0
2494 +#else
2495 #define FE_TONEAREST 0
2496 #define FE_TOWARDZERO 1
2497 #define FE_UPWARD 2
2498 @@ -24,6 +28,7 @@
2499
2500 #define FE_ALL_INVALID 0x01f80700
2501 #endif
2502 +#endif
2503
2504 typedef unsigned fexcept_t;
2505 typedef double fenv_t;
2506 --- a/arch/powerpc/reloc.h
2507 +++ b/arch/powerpc/reloc.h
2508 @@ -1,4 +1,10 @@
2509 -#define LDSO_ARCH "powerpc"
2510 +#ifdef _SOFT_FLOAT
2511 +#define FP_SUFFIX "-sf"
2512 +#else
2513 +#define FP_SUFFIX ""
2514 +#endif
2515 +
2516 +#define LDSO_ARCH "powerpc" FP_SUFFIX
2517
2518 #define TPOFF_K (-0x7000)
2519
2520 --- a/arch/x86_64/syscall_arch.h
2521 +++ b/arch/x86_64/syscall_arch.h
2522 @@ -64,3 +64,5 @@ static __inline long __syscall6(long n,
2523 #define VDSO_USEFUL
2524 #define VDSO_CGT_SYM "__vdso_clock_gettime"
2525 #define VDSO_CGT_VER "LINUX_2.6"
2526 +#define VDSO_GETCPU_SYM "__vdso_getcpu"
2527 +#define VDSO_GETCPU_VER "LINUX_2.6"
2528 --- a/configure
2529 +++ b/configure
2530 @@ -299,7 +299,7 @@ printf "%s\n" "$target"
2531 #
2532 case "$target" in
2533 # Catch these early to simplify matching for 32-bit archs
2534 -mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;;
2535 +powerpc64*) fail "$0: unsupported target \"$target\"" ;;
2536 arm*) ARCH=arm ;;
2537 aarch64*) ARCH=aarch64 ;;
2538 i?86-nt32*) ARCH=nt32 ;;
2539 @@ -307,6 +307,7 @@ i?86*) ARCH=i386 ;;
2540 x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
2541 x86_64-nt64*) ARCH=nt64 ;;
2542 x86_64*) ARCH=x86_64 ;;
2543 +mips64*) ARCH=mips64 ;;
2544 mips*) ARCH=mips ;;
2545 microblaze*) ARCH=microblaze ;;
2546 or1k*) ARCH=or1k ;;
2547 @@ -615,6 +616,17 @@ trycppif "_MIPSEL || __MIPSEL || __MIPSE
2548 trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
2549 fi
2550
2551 +if test "$ARCH" = "mips64" ; then
2552 +trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" && SUBARCH=${SUBARCH}el
2553 +trycppif __mips_soft_float "$t" && SUBARCH=${SUBARCH}-sf
2554 +fi
2555 +
2556 +if test "$ARCH" = "powerpc" ; then
2557 +trycppif "__NO_FPRS__ && !_SOFT_FLOAT" "$t" && fail \
2558 + "$0: error: compiler's floating point configuration is unsupported"
2559 +trycppif _SOFT_FLOAT "$t" && SUBARCH=${SUBARCH}-sf
2560 +fi
2561 +
2562 test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \
2563 && SUBARCH=${SUBARCH}el
2564
2565 --- /dev/null
2566 +++ b/crt/mips64/crti.s
2567 @@ -0,0 +1,17 @@
2568 +.set noreorder
2569 +
2570 +.section .init
2571 +.global _init
2572 +.align 3
2573 +_init:
2574 + dsubu $sp, $sp, 32
2575 + sd $gp, 16($sp)
2576 + sd $ra, 24($sp)
2577 +
2578 +.section .fini
2579 +.global _fini
2580 +.align 3
2581 +_fini:
2582 + dsubu $sp, $sp, 32
2583 + sd $gp, 16($sp)
2584 + sd $ra, 24($sp)
2585 --- /dev/null
2586 +++ b/crt/mips64/crtn.s
2587 @@ -0,0 +1,13 @@
2588 +.set noreorder
2589 +
2590 +.section .init
2591 + ld $gp,16($sp)
2592 + ld $ra,24($sp)
2593 + j $ra
2594 + daddu $sp,$sp,32
2595 +
2596 +.section .fini
2597 + ld $gp,16($sp)
2598 + ld $ra,24($sp)
2599 + j $ra
2600 + daddu $sp,$sp,32
2601 --- a/include/sched.h
2602 +++ b/include/sched.h
2603 @@ -76,6 +76,7 @@ void free(void *);
2604
2605 typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
2606 int __sched_cpucount(size_t, const cpu_set_t *);
2607 +int sched_getcpu(void);
2608 int sched_getaffinity(pid_t, size_t, cpu_set_t *);
2609 int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
2610
2611 --- a/ldso/dynlink.c
2612 +++ b/ldso/dynlink.c
2613 @@ -1134,7 +1134,7 @@ static void do_mips_relocs(struct dso *p
2614 Sym *sym = p->syms + j;
2615 rel[0] = (unsigned char *)got - base;
2616 for (i-=j; i; i--, sym++, rel[0]+=sizeof(size_t)) {
2617 - rel[1] = sym-p->syms << 8 | R_MIPS_JUMP_SLOT;
2618 + rel[1] = R_INFO(sym-p->syms, R_MIPS_JUMP_SLOT);
2619 do_relocs(p, rel, sizeof rel, 2);
2620 }
2621 }
2622 --- a/src/env/putenv.c
2623 +++ b/src/env/putenv.c
2624 @@ -30,6 +30,7 @@ int __putenv(char *s, int a)
2625 }
2626 } else {
2627 free(__env_map[j]);
2628 + __env_map[j] = s;
2629 }
2630 }
2631 }
2632 --- /dev/null
2633 +++ b/src/fenv/mips64/fenv-sf.c
2634 @@ -0,0 +1,3 @@
2635 +#ifdef __mips_soft_float
2636 +#include "../fenv.c"
2637 +#endif
2638 --- /dev/null
2639 +++ b/src/fenv/mips64/fenv.S
2640 @@ -0,0 +1,71 @@
2641 +#ifndef __mips_soft_float
2642 +
2643 +.set noreorder
2644 +
2645 +.global feclearexcept
2646 +.type feclearexcept,@function
2647 +feclearexcept:
2648 + and $4, $4, 0x7c
2649 + cfc1 $5, $31
2650 + or $5, $5, $4
2651 + xor $5, $5, $4
2652 + ctc1 $5, $31
2653 + jr $ra
2654 + li $2, 0
2655 +
2656 +.global feraiseexcept
2657 +.type feraiseexcept,@function
2658 +feraiseexcept:
2659 + and $4, $4, 0x7c
2660 + cfc1 $5, $31
2661 + or $5, $5, $4
2662 + ctc1 $5, $31
2663 + jr $ra
2664 + li $2, 0
2665 +
2666 +.global fetestexcept
2667 +.type fetestexcept,@function
2668 +fetestexcept:
2669 + and $4, $4, 0x7c
2670 + cfc1 $2, $31
2671 + jr $ra
2672 + and $2, $2, $4
2673 +
2674 +.global fegetround
2675 +.type fegetround,@function
2676 +fegetround:
2677 + cfc1 $2, $31
2678 + jr $ra
2679 + andi $2, $2, 3
2680 +
2681 +.global __fesetround
2682 +.type __fesetround,@function
2683 +__fesetround:
2684 + cfc1 $5, $31
2685 + li $6, -4
2686 + and $5, $5, $6
2687 + or $5, $5, $4
2688 + ctc1 $5, $31
2689 + jr $ra
2690 + li $2, 0
2691 +
2692 +.global fegetenv
2693 +.type fegetenv,@function
2694 +fegetenv:
2695 + cfc1 $5, $31
2696 + sw $5, 0($4)
2697 + jr $ra
2698 + li $2, 0
2699 +
2700 +.global fesetenv
2701 +.type fesetenv,@function
2702 +fesetenv:
2703 + daddiu $5, $4, 1
2704 + beq $5, $0, 1f
2705 + nop
2706 + lw $5, 0($4)
2707 +1: ctc1 $5, $31
2708 + jr $ra
2709 + li $2, 0
2710 +
2711 +#endif
2712 --- /dev/null
2713 +++ b/src/fenv/powerpc/fenv-sf.c
2714 @@ -0,0 +1,3 @@
2715 +#ifdef _SOFT_FLOAT
2716 +#include "../fenv.c"
2717 +#endif
2718 --- /dev/null
2719 +++ b/src/fenv/powerpc/fenv.S
2720 @@ -0,0 +1,129 @@
2721 +#ifndef _SOFT_FLOAT
2722 +.global feclearexcept
2723 +.type feclearexcept,@function
2724 +feclearexcept:
2725 + andis. 3,3,0x3e00
2726 + /* if (r3 & FE_INVALID) r3 |= all_invalid_flags */
2727 + andis. 0,3,0x2000
2728 + stwu 1,-16(1)
2729 + beq- 0,1f
2730 + oris 3,3,0x01f8
2731 + ori 3,3,0x0700
2732 +1:
2733 + /*
2734 + * note: fpscr contains various fpu status and control
2735 + * flags and we dont check if r3 may alter other flags
2736 + * than the exception related ones
2737 + * ufpscr &= ~r3
2738 + */
2739 + mffs 0
2740 + stfd 0,8(1)
2741 + lwz 9,12(1)
2742 + andc 9,9,3
2743 + stw 9,12(1)
2744 + lfd 0,8(1)
2745 + mtfsf 255,0
2746 +
2747 + /* return 0 */
2748 + li 3,0
2749 + addi 1,1,16
2750 + blr
2751 +
2752 +.global feraiseexcept
2753 +.type feraiseexcept,@function
2754 +feraiseexcept:
2755 + andis. 3,3,0x3e00
2756 + /* if (r3 & FE_INVALID) r3 |= software_invalid_flag */
2757 + andis. 0,3,0x2000
2758 + stwu 1,-16(1)
2759 + beq- 0,1f
2760 + ori 3,3,0x0400
2761 +1:
2762 + /* fpscr |= r3 */
2763 + mffs 0
2764 + stfd 0,8(1)
2765 + lwz 9,12(1)
2766 + or 9,9,3
2767 + stw 9,12(1)
2768 + lfd 0,8(1)
2769 + mtfsf 255,0
2770 +
2771 + /* return 0 */
2772 + li 3,0
2773 + addi 1,1,16
2774 + blr
2775 +
2776 +.global fetestexcept
2777 +.type fetestexcept,@function
2778 +fetestexcept:
2779 + andis. 3,3,0x3e00
2780 + /* return r3 & fpscr */
2781 + stwu 1,-16(1)
2782 + mffs 0
2783 + stfd 0,8(1)
2784 + lwz 9,12(1)
2785 + addi 1,1,16
2786 + and 3,3,9
2787 + blr
2788 +
2789 +.global fegetround
2790 +.type fegetround,@function
2791 +fegetround:
2792 + /* return fpscr & 3 */
2793 + stwu 1,-16(1)
2794 + mffs 0
2795 + stfd 0,8(1)
2796 + lwz 3,12(1)
2797 + addi 1,1,16
2798 + clrlwi 3,3,30
2799 + blr
2800 +
2801 +.global __fesetround
2802 +.type __fesetround,@function
2803 +__fesetround:
2804 + /*
2805 + * note: invalid input is not checked, r3 < 4 must hold
2806 + * fpscr = (fpscr & -4U) | r3
2807 + */
2808 + stwu 1,-16(1)
2809 + mffs 0
2810 + stfd 0,8(1)
2811 + lwz 9,12(1)
2812 + clrrwi 9,9,2
2813 + or 9,9,3
2814 + stw 9,12(1)
2815 + lfd 0,8(1)
2816 + mtfsf 255,0
2817 +
2818 + /* return 0 */
2819 + li 3,0
2820 + addi 1,1,16
2821 + blr
2822 +
2823 +.global fegetenv
2824 +.type fegetenv,@function
2825 +fegetenv:
2826 + /* *r3 = fpscr */
2827 + mffs 0
2828 + stfd 0,0(3)
2829 + /* return 0 */
2830 + li 3,0
2831 + blr
2832 +
2833 +.global fesetenv
2834 +.type fesetenv,@function
2835 +fesetenv:
2836 + cmpwi 3, -1
2837 + bne 1f
2838 + mflr 4
2839 + bl 2f
2840 + .zero 8
2841 +2: mflr 3
2842 + mtlr 4
2843 +1: /* fpscr = *r3 */
2844 + lfd 0,0(3)
2845 + mtfsf 255,0
2846 + /* return 0 */
2847 + li 3,0
2848 + blr
2849 +#endif
2850 --- a/src/fenv/powerpc/fenv.s
2851 +++ /dev/null
2852 @@ -1,123 +0,0 @@
2853 -.global feclearexcept
2854 -.type feclearexcept,@function
2855 -feclearexcept:
2856 - andis. 3,3,0x3e00
2857 - # if (r3 & FE_INVALID) r3 |= all_invalid_flags
2858 - andis. 0,3,0x2000
2859 - stwu 1,-16(1)
2860 - beq- 0,1f
2861 - oris 3,3,0x01f8
2862 - ori 3,3,0x0700
2863 -1:
2864 - # note: fpscr contains various fpu status and control
2865 - # flags and we dont check if r3 may alter other flags
2866 - # than the exception related ones
2867 - # fpscr &= ~r3
2868 - mffs 0
2869 - stfd 0,8(1)
2870 - lwz 9,12(1)
2871 - andc 9,9,3
2872 - stw 9,12(1)
2873 - lfd 0,8(1)
2874 - mtfsf 255,0
2875 -
2876 - # return 0
2877 - li 3,0
2878 - addi 1,1,16
2879 - blr
2880 -
2881 -.global feraiseexcept
2882 -.type feraiseexcept,@function
2883 -feraiseexcept:
2884 - andis. 3,3,0x3e00
2885 - # if (r3 & FE_INVALID) r3 |= software_invalid_flag
2886 - andis. 0,3,0x2000
2887 - stwu 1,-16(1)
2888 - beq- 0,1f
2889 - ori 3,3,0x0400
2890 -1:
2891 - # fpscr |= r3
2892 - mffs 0
2893 - stfd 0,8(1)
2894 - lwz 9,12(1)
2895 - or 9,9,3
2896 - stw 9,12(1)
2897 - lfd 0,8(1)
2898 - mtfsf 255,0
2899 -
2900 - # return 0
2901 - li 3,0
2902 - addi 1,1,16
2903 - blr
2904 -
2905 -.global fetestexcept
2906 -.type fetestexcept,@function
2907 -fetestexcept:
2908 - andis. 3,3,0x3e00
2909 - # return r3 & fpscr
2910 - stwu 1,-16(1)
2911 - mffs 0
2912 - stfd 0,8(1)
2913 - lwz 9,12(1)
2914 - addi 1,1,16
2915 - and 3,3,9
2916 - blr
2917 -
2918 -.global fegetround
2919 -.type fegetround,@function
2920 -fegetround:
2921 - # return fpscr & 3
2922 - stwu 1,-16(1)
2923 - mffs 0
2924 - stfd 0,8(1)
2925 - lwz 3,12(1)
2926 - addi 1,1,16
2927 - clrlwi 3,3,30
2928 - blr
2929 -
2930 -.global __fesetround
2931 -.type __fesetround,@function
2932 -__fesetround:
2933 - # note: invalid input is not checked, r3 < 4 must hold
2934 - # fpscr = (fpscr & -4U) | r3
2935 - stwu 1,-16(1)
2936 - mffs 0
2937 - stfd 0,8(1)
2938 - lwz 9,12(1)
2939 - clrrwi 9,9,2
2940 - or 9,9,3
2941 - stw 9,12(1)
2942 - lfd 0,8(1)
2943 - mtfsf 255,0
2944 -
2945 - # return 0
2946 - li 3,0
2947 - addi 1,1,16
2948 - blr
2949 -
2950 -.global fegetenv
2951 -.type fegetenv,@function
2952 -fegetenv:
2953 - # *r3 = fpscr
2954 - mffs 0
2955 - stfd 0,0(3)
2956 - # return 0
2957 - li 3,0
2958 - blr
2959 -
2960 -.global fesetenv
2961 -.type fesetenv,@function
2962 -fesetenv:
2963 - cmpwi 3, -1
2964 - bne 1f
2965 - mflr 4
2966 - bl 2f
2967 - .zero 8
2968 -2: mflr 3
2969 - mtlr 4
2970 -1: # fpscr = *r3
2971 - lfd 0,0(3)
2972 - mtfsf 255,0
2973 - # return 0
2974 - li 3,0
2975 - blr
2976 --- a/src/internal/atomic.h
2977 +++ b/src/internal/atomic.h
2978 @@ -82,6 +82,23 @@ static inline int a_fetch_or(volatile in
2979
2980 #endif
2981
2982 +#ifdef a_ll_p
2983 +
2984 +#ifndef a_cas_p
2985 +#define a_cas_p a_cas_p
2986 +static inline void *a_cas_p(volatile void *p, void *t, void *s)
2987 +{
2988 + void *old;
2989 + a_pre_llsc();
2990 + do old = a_ll_p(p);
2991 + while (old==t && !a_sc_p(p, s));
2992 + a_post_llsc();
2993 + return old;
2994 +}
2995 +#endif
2996 +
2997 +#endif
2998 +
2999 #ifndef a_cas
3000 #error missing definition of a_cas
3001 #endif
3002 @@ -209,6 +226,7 @@ static inline void a_or_64(volatile uint
3003 #endif
3004
3005 #ifndef a_cas_p
3006 +typedef char a_cas_p_undefined_but_pointer_not_32bit[-sizeof(char) == 0xffffffff ? 1 : -1];
3007 #define a_cas_p a_cas_p
3008 static inline void *a_cas_p(volatile void *p, void *t, void *s)
3009 {
3010 --- a/src/internal/dynlink.h
3011 +++ b/src/internal/dynlink.h
3012 @@ -11,12 +11,14 @@ typedef Elf32_Phdr Phdr;
3013 typedef Elf32_Sym Sym;
3014 #define R_TYPE(x) ((x)&255)
3015 #define R_SYM(x) ((x)>>8)
3016 +#define R_INFO ELF32_R_INFO
3017 #else
3018 typedef Elf64_Ehdr Ehdr;
3019 typedef Elf64_Phdr Phdr;
3020 typedef Elf64_Sym Sym;
3021 #define R_TYPE(x) ((x)&0x7fffffff)
3022 #define R_SYM(x) ((x)>>32)
3023 +#define R_INFO ELF64_R_INFO
3024 #endif
3025
3026 /* These enum constants provide unmatchable default values for
3027 --- /dev/null
3028 +++ b/src/internal/mips64/syscall.s
3029 @@ -0,0 +1,19 @@
3030 +.set noreorder
3031 +.global __syscall
3032 +.hidden __syscall
3033 +.type __syscall,@function
3034 +__syscall:
3035 + move $2, $4
3036 + move $4, $5
3037 + move $5, $6
3038 + move $6, $7
3039 + move $7, $8
3040 + move $8, $9
3041 + move $9, $10
3042 + move $10, $11
3043 + syscall
3044 + beq $7, $0, 1f
3045 + nop
3046 + dsubu $2, $0, $2
3047 +1: jr $ra
3048 + nop
3049 --- /dev/null
3050 +++ b/src/ldso/mips64/dlsym.s
3051 @@ -0,0 +1,17 @@
3052 +.set noreorder
3053 +.global dlsym
3054 +.hidden __dlsym
3055 +.type dlsym,@function
3056 +dlsym:
3057 + lui $3, %hi(%neg(%gp_rel(dlsym)))
3058 + daddiu $3, $3, %lo(%neg(%gp_rel(dlsym)))
3059 + daddu $3, $3, $25
3060 + move $6, $ra
3061 + ld $25, %got_disp(__dlsym)($3)
3062 + daddiu $sp, $sp, -32
3063 + sd $ra, 24($sp)
3064 + jalr $25
3065 + nop
3066 + ld $ra, 24($sp)
3067 + jr $ra
3068 + daddiu $sp, $sp, 32
3069 --- a/src/math/exp2f.c
3070 +++ b/src/math/exp2f.c
3071 @@ -91,6 +91,8 @@ float exp2f(float x)
3072 /* Filter out exceptional cases. */
3073 ix = u.i & 0x7fffffff;
3074 if (ix > 0x42fc0000) { /* |x| > 126 */
3075 + if (ix > 0x7f800000) /* NaN */
3076 + return x;
3077 if (u.i >= 0x43000000 && u.i < 0x80000000) { /* x >= 128 */
3078 x *= 0x1p127f;
3079 return x;
3080 --- a/src/math/expf.c
3081 +++ b/src/math/expf.c
3082 @@ -39,6 +39,8 @@ float expf(float x)
3083
3084 /* special cases */
3085 if (hx >= 0x42aeac50) { /* if |x| >= -87.33655f or NaN */
3086 + if (hx > 0x7f800000) /* NaN */
3087 + return x;
3088 if (hx >= 0x42b17218 && !sign) { /* x >= 88.722839f */
3089 /* overflow */
3090 x *= 0x1p127f;
3091 --- a/src/multibyte/wctob.c
3092 +++ b/src/multibyte/wctob.c
3093 @@ -1,4 +1,5 @@
3094 #include <wchar.h>
3095 +#include <stdio.h>
3096 #include <stdlib.h>
3097 #include "internal.h"
3098
3099 --- a/src/network/lookup_name.c
3100 +++ b/src/network/lookup_name.c
3101 @@ -49,7 +49,7 @@ static int name_from_hosts(struct addres
3102 {
3103 char line[512];
3104 size_t l = strlen(name);
3105 - int cnt = 0;
3106 + int cnt = 0, badfam = 0;
3107 unsigned char _buf[1032];
3108 FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
3109 if (!f) switch (errno) {
3110 @@ -71,8 +71,16 @@ static int name_from_hosts(struct addres
3111 /* Isolate IP address to parse */
3112 for (p=line; *p && !isspace(*p); p++);
3113 *p++ = 0;
3114 - if (name_from_numeric(buf+cnt, line, family))
3115 + switch (name_from_numeric(buf+cnt, line, family)) {
3116 + case 1:
3117 cnt++;
3118 + break;
3119 + case 0:
3120 + continue;
3121 + default:
3122 + badfam = EAI_NONAME;
3123 + continue;
3124 + }
3125
3126 /* Extract first name as canonical name */
3127 for (; *p && isspace(*p); p++);
3128 @@ -81,7 +89,7 @@ static int name_from_hosts(struct addres
3129 if (is_valid_hostname(p)) memcpy(canon, p, z-p+1);
3130 }
3131 __fclose_ca(f);
3132 - return cnt;
3133 + return cnt ? cnt : badfam;
3134 }
3135
3136 struct dpc_ctx {
3137 --- a/src/regex/regcomp.c
3138 +++ b/src/regex/regcomp.c
3139 @@ -889,7 +889,6 @@ static reg_errcode_t parse_atom(tre_pars
3140 s++;
3141 break;
3142 case '*':
3143 - return REG_BADPAT;
3144 case '{':
3145 case '+':
3146 case '?':
3147 @@ -978,9 +977,6 @@ static reg_errcode_t tre_parse(tre_parse
3148 }
3149
3150 parse_iter:
3151 - /* extension: repetitions are rejected after an empty node
3152 - eg. (+), |*, {2}, but assertions are not treated as empty
3153 - so ^* or $? are accepted currently. */
3154 for (;;) {
3155 int min, max;
3156
3157 @@ -998,6 +994,10 @@ static reg_errcode_t tre_parse(tre_parse
3158 if (*s=='\\')
3159 s++;
3160
3161 + /* handle ^* at the start of a complete BRE. */
3162 + if (!ere && s==ctx->re+1 && s[-1]=='^')
3163 + break;
3164 +
3165 /* extension: multiple consecutive *+?{,} is unspecified,
3166 but (a+)+ has to be supported so accepting a++ makes
3167 sense, note however that the RE_DUP_MAX limit can be
3168 --- /dev/null
3169 +++ b/src/sched/sched_getcpu.c
3170 @@ -0,0 +1,44 @@
3171 +#define _GNU_SOURCE
3172 +#include <errno.h>
3173 +#include <sched.h>
3174 +#include "syscall.h"
3175 +#include "atomic.h"
3176 +
3177 +#ifdef VDSO_GETCPU_SYM
3178 +
3179 +void *__vdsosym(const char *, const char *);
3180 +
3181 +static void *volatile vdso_func;
3182 +
3183 +typedef long (*getcpu_f)(unsigned *, unsigned *, void *);
3184 +
3185 +static long getcpu_init(unsigned *cpu, unsigned *node, void *unused)
3186 +{
3187 + void *p = __vdsosym(VDSO_GETCPU_VER, VDSO_GETCPU_SYM);
3188 + getcpu_f f = (getcpu_f)p;
3189 + a_cas_p(&vdso_func, (void *)getcpu_init, p);
3190 + return f ? f(cpu, node, unused) : -ENOSYS;
3191 +}
3192 +
3193 +static void *volatile vdso_func = (void *)getcpu_init;
3194 +
3195 +#endif
3196 +
3197 +int sched_getcpu(void)
3198 +{
3199 + int r;
3200 + unsigned cpu;
3201 +
3202 +#ifdef VDSO_GETCPU_SYM
3203 + getcpu_f f = (getcpu_f)vdso_func;
3204 + if (f) {
3205 + r = f(&cpu, 0, 0);
3206 + if (!r) return cpu;
3207 + if (r != -ENOSYS) return __syscall_ret(r);
3208 + }
3209 +#endif
3210 +
3211 + r = __syscall(SYS_getcpu, &cpu, 0, 0);
3212 + if (!r) return cpu;
3213 + return __syscall_ret(r);
3214 +}
3215 --- /dev/null
3216 +++ b/src/setjmp/mips64/longjmp.S
3217 @@ -0,0 +1,37 @@
3218 +.set noreorder
3219 +.global _longjmp
3220 +.global longjmp
3221 +.type _longjmp,@function
3222 +.type longjmp,@function
3223 +_longjmp:
3224 +longjmp:
3225 + move $2, $5
3226 +
3227 + bne $2, $0, 1f
3228 + nop
3229 + daddu $2, $2, 1
3230 +1:
3231 +#ifndef __mips_soft_float
3232 + ldc1 $24, 96($4)
3233 + ldc1 $25, 104($4)
3234 + ldc1 $26, 112($4)
3235 + ldc1 $27, 120($4)
3236 + ldc1 $28, 128($4)
3237 + ldc1 $29, 136($4)
3238 + ldc1 $30, 144($4)
3239 + ldc1 $31, 152($4)
3240 +#endif
3241 + ld $ra, 0($4)
3242 + ld $sp, 8($4)
3243 + ld $gp, 16($4)
3244 + ld $16, 24($4)
3245 + ld $17, 32($4)
3246 + ld $18, 40($4)
3247 + ld $19, 48($4)
3248 + ld $20, 56($4)
3249 + ld $21, 64($4)
3250 + ld $22, 72($4)
3251 + ld $23, 80($4)
3252 + ld $30, 88($4)
3253 + jr $ra
3254 + nop
3255 --- /dev/null
3256 +++ b/src/setjmp/mips64/setjmp.S
3257 @@ -0,0 +1,34 @@
3258 +.set noreorder
3259 +.global __setjmp
3260 +.global _setjmp
3261 +.global setjmp
3262 +.type __setjmp,@function
3263 +.type _setjmp,@function
3264 +.type setjmp,@function
3265 +__setjmp:
3266 +_setjmp:
3267 +setjmp:
3268 + sd $ra, 0($4)
3269 + sd $sp, 8($4)
3270 + sd $gp, 16($4)
3271 + sd $16, 24($4)
3272 + sd $17, 32($4)
3273 + sd $18, 40($4)
3274 + sd $19, 48($4)
3275 + sd $20, 56($4)
3276 + sd $21, 64($4)
3277 + sd $22, 72($4)
3278 + sd $23, 80($4)
3279 + sd $30, 88($4)
3280 +#ifndef __mips_soft_float
3281 + sdc1 $24, 96($4)
3282 + sdc1 $25, 104($4)
3283 + sdc1 $26, 112($4)
3284 + sdc1 $27, 120($4)
3285 + sdc1 $28, 128($4)
3286 + sdc1 $29, 136($4)
3287 + sdc1 $30, 144($4)
3288 + sdc1 $31, 152($4)
3289 +#endif
3290 + jr $ra
3291 + li $2, 0
3292 --- /dev/null
3293 +++ b/src/setjmp/powerpc/longjmp.S
3294 @@ -0,0 +1,69 @@
3295 + .global _longjmp
3296 + .global longjmp
3297 + .type _longjmp,@function
3298 + .type longjmp,@function
3299 +_longjmp:
3300 +longjmp:
3301 + /*
3302 + * void longjmp(jmp_buf env, int val);
3303 + * put val into return register and restore the env saved in setjmp
3304 + * if val(r4) is 0, put 1 there.
3305 + */
3306 + /* 0) move old return address into r0 */
3307 + lwz 0, 0(3)
3308 + /* 1) put it into link reg */
3309 + mtlr 0
3310 + /* 2 ) restore stack ptr */
3311 + lwz 1, 4(3)
3312 + /* 3) restore control reg */
3313 + lwz 0, 8(3)
3314 + mtcr 0
3315 + /* 4) restore r14-r31 */
3316 + lwz 14, 12(3)
3317 + lwz 15, 16(3)
3318 + lwz 16, 20(3)
3319 + lwz 17, 24(3)
3320 + lwz 18, 28(3)
3321 + lwz 19, 32(3)
3322 + lwz 20, 36(3)
3323 + lwz 21, 40(3)
3324 + lwz 22, 44(3)
3325 + lwz 23, 48(3)
3326 + lwz 24, 52(3)
3327 + lwz 25, 56(3)
3328 + lwz 26, 60(3)
3329 + lwz 27, 64(3)
3330 + lwz 28, 68(3)
3331 + lwz 29, 72(3)
3332 + lwz 30, 76(3)
3333 + lwz 31, 80(3)
3334 +#ifndef _SOFT_FLOAT
3335 + lfd 14,88(3)
3336 + lfd 15,96(3)
3337 + lfd 16,104(3)
3338 + lfd 17,112(3)
3339 + lfd 18,120(3)
3340 + lfd 19,128(3)
3341 + lfd 20,136(3)
3342 + lfd 21,144(3)
3343 + lfd 22,152(3)
3344 + lfd 23,160(3)
3345 + lfd 24,168(3)
3346 + lfd 25,176(3)
3347 + lfd 26,184(3)
3348 + lfd 27,192(3)
3349 + lfd 28,200(3)
3350 + lfd 29,208(3)
3351 + lfd 30,216(3)
3352 + lfd 31,224(3)
3353 +#endif
3354 + /* 5) put val into return reg r3 */
3355 + mr 3, 4
3356 +
3357 + /* 6) check if return value is 0, make it 1 in that case */
3358 + cmpwi cr7, 4, 0
3359 + bne cr7, 1f
3360 + li 3, 1
3361 +1:
3362 + blr
3363 +
3364 --- a/src/setjmp/powerpc/longjmp.s
3365 +++ /dev/null
3366 @@ -1,65 +0,0 @@
3367 - .global _longjmp
3368 - .global longjmp
3369 - .type _longjmp,@function
3370 - .type longjmp,@function
3371 -_longjmp:
3372 -longjmp:
3373 -# void longjmp(jmp_buf env, int val);
3374 -# put val into return register and restore the env saved in setjmp
3375 -# if val(r4) is 0, put 1 there.
3376 - # 0) move old return address into r0
3377 - lwz 0, 0(3)
3378 - # 1) put it into link reg
3379 - mtlr 0
3380 - #2 ) restore stack ptr
3381 - lwz 1, 4(3)
3382 - #3) restore control reg
3383 - lwz 0, 8(3)
3384 - mtcr 0
3385 - #4) restore r14-r31
3386 - lwz 14, 12(3)
3387 - lwz 15, 16(3)
3388 - lwz 16, 20(3)
3389 - lwz 17, 24(3)
3390 - lwz 18, 28(3)
3391 - lwz 19, 32(3)
3392 - lwz 20, 36(3)
3393 - lwz 21, 40(3)
3394 - lwz 22, 44(3)
3395 - lwz 23, 48(3)
3396 - lwz 24, 52(3)
3397 - lwz 25, 56(3)
3398 - lwz 26, 60(3)
3399 - lwz 27, 64(3)
3400 - lwz 28, 68(3)
3401 - lwz 29, 72(3)
3402 - lwz 30, 76(3)
3403 - lwz 31, 80(3)
3404 - lfd 14,88(3)
3405 - lfd 15,96(3)
3406 - lfd 16,104(3)
3407 - lfd 17,112(3)
3408 - lfd 18,120(3)
3409 - lfd 19,128(3)
3410 - lfd 20,136(3)
3411 - lfd 21,144(3)
3412 - lfd 22,152(3)
3413 - lfd 23,160(3)
3414 - lfd 24,168(3)
3415 - lfd 25,176(3)
3416 - lfd 26,184(3)
3417 - lfd 27,192(3)
3418 - lfd 28,200(3)
3419 - lfd 29,208(3)
3420 - lfd 30,216(3)
3421 - lfd 31,224(3)
3422 - #5) put val into return reg r3
3423 - mr 3, 4
3424 -
3425 - #6) check if return value is 0, make it 1 in that case
3426 - cmpwi cr7, 4, 0
3427 - bne cr7, 1f
3428 - li 3, 1
3429 -1:
3430 - blr
3431 -
3432 --- /dev/null
3433 +++ b/src/setjmp/powerpc/setjmp.S
3434 @@ -0,0 +1,63 @@
3435 + .global ___setjmp
3436 + .hidden ___setjmp
3437 + .global __setjmp
3438 + .global _setjmp
3439 + .global setjmp
3440 + .type __setjmp,@function
3441 + .type _setjmp,@function
3442 + .type setjmp,@function
3443 +___setjmp:
3444 +__setjmp:
3445 +_setjmp:
3446 +setjmp:
3447 + /* 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg) */
3448 + mflr 0
3449 + stw 0, 0(3)
3450 + /* 1) store reg1 (SP) */
3451 + stw 1, 4(3)
3452 + /* 2) store cr */
3453 + mfcr 0
3454 + stw 0, 8(3)
3455 + /* 3) store r14-31 */
3456 + stw 14, 12(3)
3457 + stw 15, 16(3)
3458 + stw 16, 20(3)
3459 + stw 17, 24(3)
3460 + stw 18, 28(3)
3461 + stw 19, 32(3)
3462 + stw 20, 36(3)
3463 + stw 21, 40(3)
3464 + stw 22, 44(3)
3465 + stw 23, 48(3)
3466 + stw 24, 52(3)
3467 + stw 25, 56(3)
3468 + stw 26, 60(3)
3469 + stw 27, 64(3)
3470 + stw 28, 68(3)
3471 + stw 29, 72(3)
3472 + stw 30, 76(3)
3473 + stw 31, 80(3)
3474 +#ifndef _SOFT_FLOAT
3475 + stfd 14,88(3)
3476 + stfd 15,96(3)
3477 + stfd 16,104(3)
3478 + stfd 17,112(3)
3479 + stfd 18,120(3)
3480 + stfd 19,128(3)
3481 + stfd 20,136(3)
3482 + stfd 21,144(3)
3483 + stfd 22,152(3)
3484 + stfd 23,160(3)
3485 + stfd 24,168(3)
3486 + stfd 25,176(3)
3487 + stfd 26,184(3)
3488 + stfd 27,192(3)
3489 + stfd 28,200(3)
3490 + stfd 29,208(3)
3491 + stfd 30,216(3)
3492 + stfd 31,224(3)
3493 +#endif
3494 + /* 4) set return value to 0 */
3495 + li 3, 0
3496 + /* 5) return */
3497 + blr
3498 --- a/src/setjmp/powerpc/setjmp.s
3499 +++ /dev/null
3500 @@ -1,61 +0,0 @@
3501 - .global ___setjmp
3502 - .hidden ___setjmp
3503 - .global __setjmp
3504 - .global _setjmp
3505 - .global setjmp
3506 - .type __setjmp,@function
3507 - .type _setjmp,@function
3508 - .type setjmp,@function
3509 -___setjmp:
3510 -__setjmp:
3511 -_setjmp:
3512 -setjmp:
3513 - # 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg)
3514 - mflr 0
3515 - stw 0, 0(3)
3516 - # 1) store reg1 (SP)
3517 - stw 1, 4(3)
3518 - # 2) store cr
3519 - mfcr 0
3520 - stw 0, 8(3)
3521 - # 3) store r14-31
3522 - stw 14, 12(3)
3523 - stw 15, 16(3)
3524 - stw 16, 20(3)
3525 - stw 17, 24(3)
3526 - stw 18, 28(3)
3527 - stw 19, 32(3)
3528 - stw 20, 36(3)
3529 - stw 21, 40(3)
3530 - stw 22, 44(3)
3531 - stw 23, 48(3)
3532 - stw 24, 52(3)
3533 - stw 25, 56(3)
3534 - stw 26, 60(3)
3535 - stw 27, 64(3)
3536 - stw 28, 68(3)
3537 - stw 29, 72(3)
3538 - stw 30, 76(3)
3539 - stw 31, 80(3)
3540 - stfd 14,88(3)
3541 - stfd 15,96(3)
3542 - stfd 16,104(3)
3543 - stfd 17,112(3)
3544 - stfd 18,120(3)
3545 - stfd 19,128(3)
3546 - stfd 20,136(3)
3547 - stfd 21,144(3)
3548 - stfd 22,152(3)
3549 - stfd 23,160(3)
3550 - stfd 24,168(3)
3551 - stfd 25,176(3)
3552 - stfd 26,184(3)
3553 - stfd 27,192(3)
3554 - stfd 28,200(3)
3555 - stfd 29,208(3)
3556 - stfd 30,216(3)
3557 - stfd 31,224(3)
3558 - # 4) set return value to 0
3559 - li 3, 0
3560 - # 5) return
3561 - blr
3562 --- /dev/null
3563 +++ b/src/signal/mips64/restore.s
3564 @@ -0,0 +1,9 @@
3565 +.set noreorder
3566 +.global __restore_rt
3567 +.global __restore
3568 +.type __restore_rt,@function
3569 +.type __restore,@function
3570 +__restore_rt:
3571 +__restore:
3572 + li $2,5211
3573 + syscall
3574 --- /dev/null
3575 +++ b/src/signal/mips64/sigsetjmp.s
3576 @@ -0,0 +1,38 @@
3577 +.set noreorder
3578 +.global sigsetjmp
3579 +.global __sigsetjmp
3580 +.type sigsetjmp,@function
3581 +.type __sigsetjmp,@function
3582 +sigsetjmp:
3583 +__sigsetjmp:
3584 + lui $3, %hi(%neg(%gp_rel(sigsetjmp)))
3585 + daddiu $3, $3, %lo(%neg(%gp_rel(sigsetjmp)))
3586 +
3587 + # comparing save mask with 0, if equals to 0 then
3588 + # sigsetjmp is equal to setjmp.
3589 + beq $5, $0, 1f
3590 + daddu $3, $3, $25
3591 + sd $ra, 160($4)
3592 + sd $16, 168($4)
3593 +
3594 + # save base of got so that we can use it later
3595 + # once we return from 'longjmp'
3596 + sd $3, 176($4)
3597 + ld $25, %got_disp(setjmp)($3)
3598 + jalr $25
3599 + move $16, $4
3600 +
3601 + move $5, $2 # Return from 'setjmp' or 'longjmp'
3602 + move $4, $16 # Restore the pointer-to-sigjmp_buf
3603 + ld $ra, 160($4) # Restore ra of sigsetjmp
3604 + ld $16, 168($4) # Restore $16 of sigsetjmp
3605 + ld $3, 176($4) # Restore base of got
3606 +
3607 +.hidden __sigsetjmp_tail
3608 + ld $25, %got_disp(__sigsetjmp_tail)($3)
3609 + jr $25
3610 + nop
3611 +1:
3612 + ld $25, %got_disp(setjmp)($3)
3613 + jr $25
3614 + nop
3615 --- /dev/null
3616 +++ b/src/thread/mips64/__unmapself.s
3617 @@ -0,0 +1,9 @@
3618 +.set noreorder
3619 +.global __unmapself
3620 +.type __unmapself, @function
3621 +__unmapself:
3622 + li $2, 5011
3623 + syscall
3624 + li $4, 0
3625 + li $2, 5058
3626 + syscall
3627 --- /dev/null
3628 +++ b/src/thread/mips64/clone.s
3629 @@ -0,0 +1,30 @@
3630 +.set noreorder
3631 +.global __clone
3632 +.type __clone,@function
3633 +__clone:
3634 + # Save function pointer and argument pointer on new thread stack
3635 + and $5, $5, -16 # aligning stack to double word
3636 + dsubu $5, $5, 16
3637 + sd $4, 0($5) # save function pointer
3638 + sd $7, 8($5) # save argument pointer
3639 +
3640 + # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid)
3641 + # sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls)
3642 + move $4, $6
3643 + move $6, $8
3644 + move $7, $9
3645 + move $8, $10
3646 + li $2, 5055
3647 + syscall
3648 + beq $7, $0, 1f
3649 + nop
3650 + jr $ra
3651 + dsubu $2, $0, $2
3652 +1: beq $2, $0, 1f
3653 + nop
3654 + jr $ra
3655 + nop
3656 +1: ld $25, 0($sp) # function pointer
3657 + ld $4, 8($sp) # argument pointer
3658 + jr $25 # call the user's function
3659 + nop
3660 --- /dev/null
3661 +++ b/src/thread/mips64/syscall_cp.s
3662 @@ -0,0 +1,52 @@
3663 +.set noreorder
3664 +.global __cp_begin
3665 +.hidden __cp_begin
3666 +.type __cp_begin,@function
3667 +.global __cp_end
3668 +.hidden __cp_end
3669 +.type __cp_end,@function
3670 +.global __cp_cancel
3671 +.hidden __cp_cancel
3672 +.type __cp_cancel,@function
3673 +.global __cp_cancel_data
3674 +.hidden __cp_cancel_data
3675 +.type __cp_cancel_data,@function
3676 +.hidden __cancel
3677 +.global __syscall_cp_asm
3678 +.hidden __syscall_cp_asm
3679 +.type __syscall_cp_asm,@function
3680 +__syscall_cp_asm:
3681 +__cp_begin:
3682 + lw $4, 0($4)
3683 + bne $4, $0, __cp_cancel
3684 + move $2, $5
3685 + move $4, $6
3686 + move $5, $7
3687 + move $6, $8
3688 + move $7, $9
3689 + move $8, $10
3690 + move $9, $11
3691 + ld $10, 0($sp)
3692 + syscall
3693 +__cp_end:
3694 + beq $7, $0, 1f
3695 + nop
3696 + dsubu $2, $0, $2
3697 +1: jr $ra
3698 + nop
3699 +
3700 + # if cancellation flag is 1 then call __cancel
3701 +__cp_cancel:
3702 + move $2, $ra
3703 +.align 8
3704 + bal 1f
3705 + nop
3706 +__cp_cancel_data:
3707 + .gpdword __cp_cancel_data
3708 + .gpdword __cancel
3709 +1: ld $3, ($ra)
3710 + dsubu $3, $ra, $3
3711 + ld $25, 8($ra)
3712 + daddu $25, $25, $3