authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-12 13:18:52-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-12 13:18:52-04:00
log5734b7a37a75b927ca31e52ad915d7de125993d9
treee050b6f837a4c9a0cb5a3ffd016f3fb72e98a304
parentb7c331eb610bae76dab7f65044012282344acbd5
signaturelock-open Commit is signed but in an unrecognized format.

building musl start files from source


314 files changed, 13420 insertions(+), 29 deletions(-)

.gitattributes+1
...@@ -4,6 +4,7 @@ langref.html.in text eol=lf...@@ -4,6 +4,7 @@ langref.html.in text eol=lf
4c_headers/ linguist-vendored 4c_headers/ linguist-vendored
5deps/ linguist-vendored 5deps/ linguist-vendored
6libc/glibc/ linguist-vendored 6libc/glibc/ linguist-vendored
7libc/musl/ linguist-vendored
7libc/include/ linguist-vendored 8libc/include/ linguist-vendored
8libcxx/ linguist-vendored 9libcxx/ linguist-vendored
9libunwind/ linguist-vendored 10libunwind/ linguist-vendored
CMakeLists.txt+308
...@@ -4299,6 +4299,314 @@ set(ZIG_LIBC_FILES...@@ -4299,6 +4299,314 @@ set(ZIG_LIBC_FILES
4299 "include/x86_64-linux-musl/bits/stat.h"4299 "include/x86_64-linux-musl/bits/stat.h"
4300 "include/x86_64-linux-musl/bits/syscall.h"4300 "include/x86_64-linux-musl/bits/syscall.h"
4301 "include/x86_64-linux-musl/bits/user.h"4301 "include/x86_64-linux-musl/bits/user.h"
4302 "musl/crt/mips64/crtn.s"
4303 "musl/crt/mips64/crti.s"
4304 "musl/crt/crt1.c"
4305 "musl/crt/x32/crtn.s"
4306 "musl/crt/x32/crti.s"
4307 "musl/crt/crtn.c"
4308 "musl/crt/powerpc64/crtn.s"
4309 "musl/crt/powerpc64/crti.s"
4310 "musl/crt/crti.c"
4311 "musl/crt/microblaze/crtn.s"
4312 "musl/crt/microblaze/crti.s"
4313 "musl/crt/arm/crtn.s"
4314 "musl/crt/arm/crti.s"
4315 "musl/crt/rcrt1.c"
4316 "musl/crt/s390x/crtn.s"
4317 "musl/crt/s390x/crti.s"
4318 "musl/crt/mips/crtn.s"
4319 "musl/crt/mips/crti.s"
4320 "musl/crt/x86_64/crtn.s"
4321 "musl/crt/x86_64/crti.s"
4322 "musl/crt/i386/crtn.s"
4323 "musl/crt/i386/crti.s"
4324 "musl/crt/aarch64/crtn.s"
4325 "musl/crt/aarch64/crti.s"
4326 "musl/crt/mipsn32/crtn.s"
4327 "musl/crt/mipsn32/crti.s"
4328 "musl/crt/or1k/crtn.s"
4329 "musl/crt/or1k/crti.s"
4330 "musl/crt/powerpc/crtn.s"
4331 "musl/crt/powerpc/crti.s"
4332 "musl/crt/Scrt1.c"
4333 "musl/crt/sh/crtn.s"
4334 "musl/crt/sh/crti.s"
4335 "musl/src/internal/libc.h"
4336 "musl/src/include/features.h"
4337 "musl/arch/mips64/pthread_arch.h"
4338 "musl/arch/mips64/crt_arch.h"
4339 "musl/arch/mips64/ksigaction.h"
4340 "musl/arch/mips64/reloc.h"
4341 "musl/arch/mips64/syscall_arch.h"
4342 "musl/arch/mips64/atomic_arch.h"
4343 "musl/arch/mips64/bits/float.h"
4344 "musl/arch/mips64/bits/errno.h"
4345 "musl/arch/mips64/bits/mman.h"
4346 "musl/arch/mips64/bits/stdint.h"
4347 "musl/arch/mips64/bits/termios.h"
4348 "musl/arch/mips64/bits/reg.h"
4349 "musl/arch/mips64/bits/ipc.h"
4350 "musl/arch/mips64/bits/fenv.h"
4351 "musl/arch/mips64/bits/msg.h"
4352 "musl/arch/mips64/bits/ptrace.h"
4353 "musl/arch/mips64/bits/resource.h"
4354 "musl/arch/mips64/bits/posix.h"
4355 "musl/arch/mips64/bits/setjmp.h"
4356 "musl/arch/mips64/bits/alltypes.h.in"
4357 "musl/arch/mips64/bits/syscall.h.in"
4358 "musl/arch/mips64/bits/shm.h"
4359 "musl/arch/mips64/bits/hwcap.h"
4360 "musl/arch/mips64/bits/endian.h"
4361 "musl/arch/mips64/bits/limits.h"
4362 "musl/arch/mips64/bits/poll.h"
4363 "musl/arch/mips64/bits/ioctl.h"
4364 "musl/arch/mips64/bits/fcntl.h"
4365 "musl/arch/mips64/bits/signal.h"
4366 "musl/arch/mips64/bits/stat.h"
4367 "musl/arch/mips64/bits/user.h"
4368 "musl/arch/mips64/bits/sem.h"
4369 "musl/arch/mips64/bits/socket.h"
4370 "musl/arch/mips64/bits/statfs.h"
4371 "musl/arch/generic/bits/errno.h"
4372 "musl/arch/generic/bits/mman.h"
4373 "musl/arch/generic/bits/termios.h"
4374 "musl/arch/generic/bits/kd.h"
4375 "musl/arch/generic/bits/ipc.h"
4376 "musl/arch/generic/bits/fenv.h"
4377 "musl/arch/generic/bits/msg.h"
4378 "musl/arch/generic/bits/vt.h"
4379 "musl/arch/generic/bits/ptrace.h"
4380 "musl/arch/generic/bits/io.h"
4381 "musl/arch/generic/bits/resource.h"
4382 "musl/arch/generic/bits/link.h"
4383 "musl/arch/generic/bits/shm.h"
4384 "musl/arch/generic/bits/hwcap.h"
4385 "musl/arch/generic/bits/poll.h"
4386 "musl/arch/generic/bits/ioctl.h"
4387 "musl/arch/generic/bits/fcntl.h"
4388 "musl/arch/generic/bits/ioctl_fix.h"
4389 "musl/arch/generic/bits/sem.h"
4390 "musl/arch/generic/bits/socket.h"
4391 "musl/arch/generic/bits/statfs.h"
4392 "musl/arch/generic/bits/soundcard.h"
4393 "musl/arch/powerpc64/pthread_arch.h"
4394 "musl/arch/powerpc64/crt_arch.h"
4395 "musl/arch/powerpc64/reloc.h"
4396 "musl/arch/powerpc64/syscall_arch.h"
4397 "musl/arch/powerpc64/atomic_arch.h"
4398 "musl/arch/powerpc64/bits/float.h"
4399 "musl/arch/powerpc64/bits/errno.h"
4400 "musl/arch/powerpc64/bits/mman.h"
4401 "musl/arch/powerpc64/bits/stdint.h"
4402 "musl/arch/powerpc64/bits/termios.h"
4403 "musl/arch/powerpc64/bits/reg.h"
4404 "musl/arch/powerpc64/bits/ipc.h"
4405 "musl/arch/powerpc64/bits/fenv.h"
4406 "musl/arch/powerpc64/bits/msg.h"
4407 "musl/arch/powerpc64/bits/ptrace.h"
4408 "musl/arch/powerpc64/bits/posix.h"
4409 "musl/arch/powerpc64/bits/setjmp.h"
4410 "musl/arch/powerpc64/bits/alltypes.h.in"
4411 "musl/arch/powerpc64/bits/syscall.h.in"
4412 "musl/arch/powerpc64/bits/shm.h"
4413 "musl/arch/powerpc64/bits/hwcap.h"
4414 "musl/arch/powerpc64/bits/endian.h"
4415 "musl/arch/powerpc64/bits/limits.h"
4416 "musl/arch/powerpc64/bits/ioctl.h"
4417 "musl/arch/powerpc64/bits/fcntl.h"
4418 "musl/arch/powerpc64/bits/signal.h"
4419 "musl/arch/powerpc64/bits/stat.h"
4420 "musl/arch/powerpc64/bits/user.h"
4421 "musl/arch/powerpc64/bits/sem.h"
4422 "musl/arch/powerpc64/bits/socket.h"
4423 "musl/arch/arm/pthread_arch.h"
4424 "musl/arch/arm/crt_arch.h"
4425 "musl/arch/arm/reloc.h"
4426 "musl/arch/arm/syscall_arch.h"
4427 "musl/arch/arm/atomic_arch.h"
4428 "musl/arch/arm/bits/float.h"
4429 "musl/arch/arm/bits/stdint.h"
4430 "musl/arch/arm/bits/reg.h"
4431 "musl/arch/arm/bits/fenv.h"
4432 "musl/arch/arm/bits/ptrace.h"
4433 "musl/arch/arm/bits/posix.h"
4434 "musl/arch/arm/bits/setjmp.h"
4435 "musl/arch/arm/bits/alltypes.h.in"
4436 "musl/arch/arm/bits/syscall.h.in"
4437 "musl/arch/arm/bits/hwcap.h"
4438 "musl/arch/arm/bits/endian.h"
4439 "musl/arch/arm/bits/limits.h"
4440 "musl/arch/arm/bits/fcntl.h"
4441 "musl/arch/arm/bits/signal.h"
4442 "musl/arch/arm/bits/stat.h"
4443 "musl/arch/arm/bits/user.h"
4444 "musl/arch/arm/bits/ioctl_fix.h"
4445 "musl/arch/s390x/pthread_arch.h"
4446 "musl/arch/s390x/crt_arch.h"
4447 "musl/arch/s390x/reloc.h"
4448 "musl/arch/s390x/syscall_arch.h"
4449 "musl/arch/s390x/atomic_arch.h"
4450 "musl/arch/s390x/bits/float.h"
4451 "musl/arch/s390x/bits/stdint.h"
4452 "musl/arch/s390x/bits/reg.h"
4453 "musl/arch/s390x/bits/ipc.h"
4454 "musl/arch/s390x/bits/fenv.h"
4455 "musl/arch/s390x/bits/msg.h"
4456 "musl/arch/s390x/bits/ptrace.h"
4457 "musl/arch/s390x/bits/link.h"
4458 "musl/arch/s390x/bits/posix.h"
4459 "musl/arch/s390x/bits/setjmp.h"
4460 "musl/arch/s390x/bits/alltypes.h.in"
4461 "musl/arch/s390x/bits/syscall.h.in"
4462 "musl/arch/s390x/bits/shm.h"
4463 "musl/arch/s390x/bits/hwcap.h"
4464 "musl/arch/s390x/bits/endian.h"
4465 "musl/arch/s390x/bits/limits.h"
4466 "musl/arch/s390x/bits/fcntl.h"
4467 "musl/arch/s390x/bits/signal.h"
4468 "musl/arch/s390x/bits/stat.h"
4469 "musl/arch/s390x/bits/user.h"
4470 "musl/arch/s390x/bits/ioctl_fix.h"
4471 "musl/arch/s390x/bits/sem.h"
4472 "musl/arch/s390x/bits/socket.h"
4473 "musl/arch/s390x/bits/statfs.h"
4474 "musl/arch/mips/pthread_arch.h"
4475 "musl/arch/mips/crt_arch.h"
4476 "musl/arch/mips/ksigaction.h"
4477 "musl/arch/mips/reloc.h"
4478 "musl/arch/mips/syscall_arch.h"
4479 "musl/arch/mips/atomic_arch.h"
4480 "musl/arch/mips/bits/float.h"
4481 "musl/arch/mips/bits/errno.h"
4482 "musl/arch/mips/bits/mman.h"
4483 "musl/arch/mips/bits/stdint.h"
4484 "musl/arch/mips/bits/termios.h"
4485 "musl/arch/mips/bits/reg.h"
4486 "musl/arch/mips/bits/fenv.h"
4487 "musl/arch/mips/bits/msg.h"
4488 "musl/arch/mips/bits/ptrace.h"
4489 "musl/arch/mips/bits/resource.h"
4490 "musl/arch/mips/bits/posix.h"
4491 "musl/arch/mips/bits/setjmp.h"
4492 "musl/arch/mips/bits/alltypes.h.in"
4493 "musl/arch/mips/bits/syscall.h.in"
4494 "musl/arch/mips/bits/shm.h"
4495 "musl/arch/mips/bits/hwcap.h"
4496 "musl/arch/mips/bits/endian.h"
4497 "musl/arch/mips/bits/limits.h"
4498 "musl/arch/mips/bits/poll.h"
4499 "musl/arch/mips/bits/ioctl.h"
4500 "musl/arch/mips/bits/fcntl.h"
4501 "musl/arch/mips/bits/signal.h"
4502 "musl/arch/mips/bits/stat.h"
4503 "musl/arch/mips/bits/user.h"
4504 "musl/arch/mips/bits/sem.h"
4505 "musl/arch/mips/bits/socket.h"
4506 "musl/arch/mips/bits/statfs.h"
4507 "musl/arch/x86_64/pthread_arch.h"
4508 "musl/arch/x86_64/crt_arch.h"
4509 "musl/arch/x86_64/ksigaction.h"
4510 "musl/arch/x86_64/reloc.h"
4511 "musl/arch/x86_64/syscall_arch.h"
4512 "musl/arch/x86_64/atomic_arch.h"
4513 "musl/arch/x86_64/bits/float.h"
4514 "musl/arch/x86_64/bits/mman.h"
4515 "musl/arch/x86_64/bits/stdint.h"
4516 "musl/arch/x86_64/bits/reg.h"
4517 "musl/arch/x86_64/bits/ipc.h"
4518 "musl/arch/x86_64/bits/fenv.h"
4519 "musl/arch/x86_64/bits/msg.h"
4520 "musl/arch/x86_64/bits/ptrace.h"
4521 "musl/arch/x86_64/bits/io.h"
4522 "musl/arch/x86_64/bits/posix.h"
4523 "musl/arch/x86_64/bits/setjmp.h"
4524 "musl/arch/x86_64/bits/alltypes.h.in"
4525 "musl/arch/x86_64/bits/syscall.h.in"
4526 "musl/arch/x86_64/bits/shm.h"
4527 "musl/arch/x86_64/bits/endian.h"
4528 "musl/arch/x86_64/bits/limits.h"
4529 "musl/arch/x86_64/bits/fcntl.h"
4530 "musl/arch/x86_64/bits/signal.h"
4531 "musl/arch/x86_64/bits/stat.h"
4532 "musl/arch/x86_64/bits/user.h"
4533 "musl/arch/x86_64/bits/socket.h"
4534 "musl/arch/i386/pthread_arch.h"
4535 "musl/arch/i386/crt_arch.h"
4536 "musl/arch/i386/reloc.h"
4537 "musl/arch/i386/syscall_arch.h"
4538 "musl/arch/i386/atomic_arch.h"
4539 "musl/arch/i386/bits/float.h"
4540 "musl/arch/i386/bits/mman.h"
4541 "musl/arch/i386/bits/stdint.h"
4542 "musl/arch/i386/bits/reg.h"
4543 "musl/arch/i386/bits/fenv.h"
4544 "musl/arch/i386/bits/ptrace.h"
4545 "musl/arch/i386/bits/io.h"
4546 "musl/arch/i386/bits/posix.h"
4547 "musl/arch/i386/bits/setjmp.h"
4548 "musl/arch/i386/bits/alltypes.h.in"
4549 "musl/arch/i386/bits/syscall.h.in"
4550 "musl/arch/i386/bits/endian.h"
4551 "musl/arch/i386/bits/limits.h"
4552 "musl/arch/i386/bits/signal.h"
4553 "musl/arch/i386/bits/stat.h"
4554 "musl/arch/i386/bits/user.h"
4555 "musl/arch/aarch64/pthread_arch.h"
4556 "musl/arch/aarch64/crt_arch.h"
4557 "musl/arch/aarch64/reloc.h"
4558 "musl/arch/aarch64/syscall_arch.h"
4559 "musl/arch/aarch64/atomic_arch.h"
4560 "musl/arch/aarch64/bits/float.h"
4561 "musl/arch/aarch64/bits/stdint.h"
4562 "musl/arch/aarch64/bits/reg.h"
4563 "musl/arch/aarch64/bits/ipc.h"
4564 "musl/arch/aarch64/bits/fenv.h"
4565 "musl/arch/aarch64/bits/msg.h"
4566 "musl/arch/aarch64/bits/posix.h"
4567 "musl/arch/aarch64/bits/setjmp.h"
4568 "musl/arch/aarch64/bits/alltypes.h.in"
4569 "musl/arch/aarch64/bits/syscall.h.in"
4570 "musl/arch/aarch64/bits/shm.h"
4571 "musl/arch/aarch64/bits/hwcap.h"
4572 "musl/arch/aarch64/bits/endian.h"
4573 "musl/arch/aarch64/bits/limits.h"
4574 "musl/arch/aarch64/bits/fcntl.h"
4575 "musl/arch/aarch64/bits/signal.h"
4576 "musl/arch/aarch64/bits/stat.h"
4577 "musl/arch/aarch64/bits/user.h"
4578 "musl/arch/aarch64/bits/sem.h"
4579 "musl/arch/aarch64/bits/socket.h"
4580 "musl/arch/powerpc/pthread_arch.h"
4581 "musl/arch/powerpc/crt_arch.h"
4582 "musl/arch/powerpc/reloc.h"
4583 "musl/arch/powerpc/syscall_arch.h"
4584 "musl/arch/powerpc/atomic_arch.h"
4585 "musl/arch/powerpc/bits/float.h"
4586 "musl/arch/powerpc/bits/errno.h"
4587 "musl/arch/powerpc/bits/mman.h"
4588 "musl/arch/powerpc/bits/stdint.h"
4589 "musl/arch/powerpc/bits/termios.h"
4590 "musl/arch/powerpc/bits/reg.h"
4591 "musl/arch/powerpc/bits/ipc.h"
4592 "musl/arch/powerpc/bits/fenv.h"
4593 "musl/arch/powerpc/bits/msg.h"
4594 "musl/arch/powerpc/bits/ptrace.h"
4595 "musl/arch/powerpc/bits/posix.h"
4596 "musl/arch/powerpc/bits/setjmp.h"
4597 "musl/arch/powerpc/bits/alltypes.h.in"
4598 "musl/arch/powerpc/bits/syscall.h.in"
4599 "musl/arch/powerpc/bits/shm.h"
4600 "musl/arch/powerpc/bits/hwcap.h"
4601 "musl/arch/powerpc/bits/endian.h"
4602 "musl/arch/powerpc/bits/limits.h"
4603 "musl/arch/powerpc/bits/ioctl.h"
4604 "musl/arch/powerpc/bits/fcntl.h"
4605 "musl/arch/powerpc/bits/signal.h"
4606 "musl/arch/powerpc/bits/stat.h"
4607 "musl/arch/powerpc/bits/user.h"
4608 "musl/arch/powerpc/bits/sem.h"
4609 "musl/arch/powerpc/bits/socket.h"
4302)4610)
43034611
4304set(ZIG_LIBUNWIND_FILES4612set(ZIG_LIBUNWIND_FILES
libc/musl/arch/aarch64/atomic_arch.h created+82
...@@ -0,0 +1,82 @@
1#define a_ll a_ll
2static inline int a_ll(volatile int *p)
3{
4 int v;
5 __asm__ __volatile__ ("ldaxr %w0,%1" : "=r"(v) : "Q"(*p));
6 return v;
7}
8
9#define a_sc a_sc
10static inline int a_sc(volatile int *p, int v)
11{
12 int r;
13 __asm__ __volatile__ ("stlxr %w0,%w2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
14 return !r;
15}
16
17#define a_barrier a_barrier
18static inline void a_barrier()
19{
20 __asm__ __volatile__ ("dmb ish" : : : "memory");
21}
22
23#define a_cas a_cas
24static inline int a_cas(volatile int *p, int t, int s)
25{
26 int old;
27 do {
28 old = a_ll(p);
29 if (old != t) {
30 a_barrier();
31 break;
32 }
33 } while (!a_sc(p, s));
34 return old;
35}
36
37#define a_ll_p a_ll_p
38static inline void *a_ll_p(volatile void *p)
39{
40 void *v;
41 __asm__ __volatile__ ("ldaxr %0, %1" : "=r"(v) : "Q"(*(void *volatile *)p));
42 return v;
43}
44
45#define a_sc_p a_sc_p
46static inline int a_sc_p(volatile int *p, void *v)
47{
48 int r;
49 __asm__ __volatile__ ("stlxr %w0,%2,%1" : "=&r"(r), "=Q"(*(void *volatile *)p) : "r"(v) : "memory");
50 return !r;
51}
52
53#define a_cas_p a_cas_p
54static inline void *a_cas_p(volatile void *p, void *t, void *s)
55{
56 void *old;
57 do {
58 old = a_ll_p(p);
59 if (old != t) {
60 a_barrier();
61 break;
62 }
63 } while (!a_sc_p(p, s));
64 return old;
65}
66
67#define a_ctz_64 a_ctz_64
68static inline int a_ctz_64(uint64_t x)
69{
70 __asm__(
71 " rbit %0, %1\n"
72 " clz %0, %0\n"
73 : "=r"(x) : "r"(x));
74 return x;
75}
76
77#define a_clz_64 a_clz_64
78static inline int a_clz_64(uint64_t x)
79{
80 __asm__("clz %0, %1" : "=r"(x) : "r"(x));
81 return x;
82}
libc/musl/arch/aarch64/bits/alltypes.h.in created+30
...@@ -0,0 +1,30 @@
1#define _Addr long
2#define _Int64 long
3#define _Reg long
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF unsigned wchar_t;
10#endif
11TYPEDEF unsigned wint_t;
12
13TYPEDEF int blksize_t;
14TYPEDEF unsigned int nlink_t;
15
16TYPEDEF float float_t;
17TYPEDEF double double_t;
18
19TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
20
21TYPEDEF long time_t;
22TYPEDEF long suseconds_t;
23
24TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
25TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
26TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
27TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
28TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
29TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
30TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
libc/musl/arch/aarch64/bits/endian.h created+5
...@@ -0,0 +1,5 @@
1#if __AARCH64EB__
2#define __BYTE_ORDER __BIG_ENDIAN
3#else
4#define __BYTE_ORDER __LITTLE_ENDIAN
5#endif
libc/musl/arch/aarch64/bits/fcntl.h created+38
...@@ -0,0 +1,38 @@
1#define O_CREAT 0100
2#define O_EXCL 0200
3#define O_NOCTTY 0400
4#define O_TRUNC 01000
5#define O_APPEND 02000
6#define O_NONBLOCK 04000
7#define O_DSYNC 010000
8#define O_SYNC 04010000
9#define O_RSYNC 04010000
10#define O_DIRECTORY 040000
11#define O_NOFOLLOW 0100000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 020000
15#define O_DIRECT 0200000
16#define O_LARGEFILE 0400000
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020040000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27#define F_GETLK 5
28#define F_SETLK 6
29#define F_SETLKW 7
30#define F_SETOWN 8
31#define F_GETOWN 9
32#define F_SETSIG 10
33#define F_GETSIG 11
34
35#define F_SETOWN_EX 15
36#define F_GETOWN_EX 16
37
38#define F_GETOWNER_UIDS 17
libc/musl/arch/aarch64/bits/fenv.h created+19
...@@ -0,0 +1,19 @@
1#define FE_INVALID 1
2#define FE_DIVBYZERO 2
3#define FE_OVERFLOW 4
4#define FE_UNDERFLOW 8
5#define FE_INEXACT 16
6#define FE_ALL_EXCEPT 31
7#define FE_TONEAREST 0
8#define FE_DOWNWARD 0x800000
9#define FE_UPWARD 0x400000
10#define FE_TOWARDZERO 0xc00000
11
12typedef unsigned int fexcept_t;
13
14typedef struct {
15 unsigned int __fpcr;
16 unsigned int __fpsr;
17} fenv_t;
18
19#define FE_DFL_ENV ((const fenv_t *) -1)
libc/musl/arch/aarch64/bits/float.h created+16
...@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
4#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
5#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
6#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
7
8#define LDBL_MANT_DIG 113
9#define LDBL_MIN_EXP (-16381)
10#define LDBL_MAX_EXP 16384
11
12#define LDBL_DIG 33
13#define LDBL_MIN_10_EXP (-4931)
14#define LDBL_MAX_10_EXP 4932
15
16#define DECIMAL_DIG 36
libc/musl/arch/aarch64/bits/hwcap.h created+28
...@@ -0,0 +1,28 @@
1#define HWCAP_FP (1 << 0)
2#define HWCAP_ASIMD (1 << 1)
3#define HWCAP_EVTSTRM (1 << 2)
4#define HWCAP_AES (1 << 3)
5#define HWCAP_PMULL (1 << 4)
6#define HWCAP_SHA1 (1 << 5)
7#define HWCAP_SHA2 (1 << 6)
8#define HWCAP_CRC32 (1 << 7)
9#define HWCAP_ATOMICS (1 << 8)
10#define HWCAP_FPHP (1 << 9)
11#define HWCAP_ASIMDHP (1 << 10)
12#define HWCAP_CPUID (1 << 11)
13#define HWCAP_ASIMDRDM (1 << 12)
14#define HWCAP_JSCVT (1 << 13)
15#define HWCAP_FCMA (1 << 14)
16#define HWCAP_LRCPC (1 << 15)
17#define HWCAP_DCPOP (1 << 16)
18#define HWCAP_SHA3 (1 << 17)
19#define HWCAP_SM3 (1 << 18)
20#define HWCAP_SM4 (1 << 19)
21#define HWCAP_ASIMDDP (1 << 20)
22#define HWCAP_SHA512 (1 << 21)
23#define HWCAP_SVE (1 << 22)
24#define HWCAP_ASIMDFHM (1 << 23)
25#define HWCAP_DIT (1 << 24)
26#define HWCAP_USCAT (1 << 25)
27#define HWCAP_ILRCPC (1 << 26)
28#define HWCAP_FLAGM (1 << 27)
libc/musl/arch/aarch64/bits/ipc.h created+14
...@@ -0,0 +1,14 @@
1struct ipc_perm {
2 key_t __ipc_perm_key;
3 uid_t uid;
4 gid_t gid;
5 uid_t cuid;
6 gid_t cgid;
7 mode_t mode;
8 unsigned short __ipc_perm_seq;
9
10 unsigned long __pad1;
11 unsigned long __pad2;
12};
13
14#define IPC_64 0
libc/musl/arch/aarch64/bits/limits.h created+7
...@@ -0,0 +1,7 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define LONG_BIT 64
4#endif
5
6#define LONG_MAX 0x7fffffffffffffffL
7#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/aarch64/bits/msg.h created+13
...@@ -0,0 +1,13 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 time_t msg_stime;
4 time_t msg_rtime;
5 time_t msg_ctime;
6 unsigned long msg_cbytes;
7 msgqnum_t msg_qnum;
8 msglen_t msg_qbytes;
9 pid_t msg_lspid;
10 pid_t msg_lrpid;
11 unsigned long __pad1;
12 unsigned long __pad2;
13};
libc/musl/arch/aarch64/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_LP64_OFF64 1
2#define _POSIX_V7_LP64_OFF64 1
libc/musl/arch/aarch64/bits/reg.h created+2
...@@ -0,0 +1,2 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
libc/musl/arch/aarch64/bits/sem.h created+14
...@@ -0,0 +1,14 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 time_t sem_otime;
4 time_t sem_ctime;
5#if __BYTE_ORDER == __LITTLE_ENDIAN
6 unsigned short sem_nsems;
7 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
8#else
9 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
10 unsigned short sem_nsems;
11#endif
12 time_t __unused3;
13 time_t __unused4;
14};
libc/musl/arch/aarch64/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[22];
libc/musl/arch/aarch64/bits/shm.h created+24
...@@ -0,0 +1,24 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 time_t shm_atime;
7 time_t shm_dtime;
8 time_t shm_ctime;
9 pid_t shm_cpid;
10 pid_t shm_lpid;
11 unsigned long shm_nattch;
12 unsigned long __pad1;
13 unsigned long __pad2;
14};
15
16struct shminfo {
17 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
18};
19
20struct shm_info {
21 int __used_ids;
22 unsigned long shm_tot, shm_rss, shm_swp;
23 unsigned long __swap_attempts, __swap_successes;
24};
libc/musl/arch/aarch64/bits/signal.h created+153
...@@ -0,0 +1,153 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 6144
6#define SIGSTKSZ 12288
7#endif
8
9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10typedef unsigned long greg_t;
11typedef unsigned long gregset_t[34];
12
13typedef struct {
14 long double vregs[32];
15 unsigned int fpsr;
16 unsigned int fpcr;
17} fpregset_t;
18typedef struct sigcontext {
19 unsigned long fault_address;
20 unsigned long regs[31];
21 unsigned long sp, pc, pstate;
22 long double __reserved[256];
23} mcontext_t;
24
25#define FPSIMD_MAGIC 0x46508001
26#define ESR_MAGIC 0x45535201
27#define EXTRA_MAGIC 0x45585401
28#define SVE_MAGIC 0x53564501
29struct _aarch64_ctx {
30 unsigned int magic;
31 unsigned int size;
32};
33struct fpsimd_context {
34 struct _aarch64_ctx head;
35 unsigned int fpsr;
36 unsigned int fpcr;
37 long double vregs[32];
38};
39struct esr_context {
40 struct _aarch64_ctx head;
41 unsigned long esr;
42};
43struct extra_context {
44 struct _aarch64_ctx head;
45 unsigned long datap;
46 unsigned int size;
47 unsigned int __reserved[3];
48};
49struct sve_context {
50 struct _aarch64_ctx head;
51 unsigned short vl;
52 unsigned short __reserved[3];
53};
54#define SVE_VQ_BYTES 16
55#define SVE_VQ_MIN 1
56#define SVE_VQ_MAX 512
57#define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES)
58#define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES)
59#define SVE_NUM_ZREGS 32
60#define SVE_NUM_PREGS 16
61#define sve_vl_valid(vl) \
62 ((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
63#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
64#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
65#define SVE_SIG_ZREG_SIZE(vq) ((unsigned)(vq) * SVE_VQ_BYTES)
66#define SVE_SIG_PREG_SIZE(vq) ((unsigned)(vq) * (SVE_VQ_BYTES / 8))
67#define SVE_SIG_FFR_SIZE(vq) SVE_SIG_PREG_SIZE(vq)
68#define SVE_SIG_REGS_OFFSET \
69 ((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1)) \
70 / SVE_VQ_BYTES * SVE_VQ_BYTES)
71#define SVE_SIG_ZREGS_OFFSET SVE_SIG_REGS_OFFSET
72#define SVE_SIG_ZREG_OFFSET(vq, n) \
73 (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
74#define SVE_SIG_ZREGS_SIZE(vq) \
75 (SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
76#define SVE_SIG_PREGS_OFFSET(vq) \
77 (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
78#define SVE_SIG_PREG_OFFSET(vq, n) \
79 (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
80#define SVE_SIG_PREGS_SIZE(vq) \
81 (SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
82#define SVE_SIG_FFR_OFFSET(vq) \
83 (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
84#define SVE_SIG_REGS_SIZE(vq) \
85 (SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
86#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
87#else
88typedef struct {
89 long double __regs[18+256];
90} mcontext_t;
91#endif
92
93struct sigaltstack {
94 void *ss_sp;
95 int ss_flags;
96 size_t ss_size;
97};
98
99typedef struct __ucontext {
100 unsigned long uc_flags;
101 struct __ucontext *uc_link;
102 stack_t uc_stack;
103 sigset_t uc_sigmask;
104 mcontext_t uc_mcontext;
105} ucontext_t;
106
107#define SA_NOCLDSTOP 1
108#define SA_NOCLDWAIT 2
109#define SA_SIGINFO 4
110#define SA_ONSTACK 0x08000000
111#define SA_RESTART 0x10000000
112#define SA_NODEFER 0x40000000
113#define SA_RESETHAND 0x80000000
114#define SA_RESTORER 0x04000000
115
116#endif
117
118#define SIGHUP 1
119#define SIGINT 2
120#define SIGQUIT 3
121#define SIGILL 4
122#define SIGTRAP 5
123#define SIGABRT 6
124#define SIGIOT SIGABRT
125#define SIGBUS 7
126#define SIGFPE 8
127#define SIGKILL 9
128#define SIGUSR1 10
129#define SIGSEGV 11
130#define SIGUSR2 12
131#define SIGPIPE 13
132#define SIGALRM 14
133#define SIGTERM 15
134#define SIGSTKFLT 16
135#define SIGCHLD 17
136#define SIGCONT 18
137#define SIGSTOP 19
138#define SIGTSTP 20
139#define SIGTTIN 21
140#define SIGTTOU 22
141#define SIGURG 23
142#define SIGXCPU 24
143#define SIGXFSZ 25
144#define SIGVTALRM 26
145#define SIGPROF 27
146#define SIGWINCH 28
147#define SIGIO 29
148#define SIGPOLL 29
149#define SIGPWR 30
150#define SIGSYS 31
151#define SIGUNUSED SIGSYS
152
153#define _NSIG 65
libc/musl/arch/aarch64/bits/socket.h created+33
...@@ -0,0 +1,33 @@
1#include <endian.h>
2
3struct msghdr {
4 void *msg_name;
5 socklen_t msg_namelen;
6 struct iovec *msg_iov;
7#if __BYTE_ORDER == __BIG_ENDIAN
8 int __pad1, msg_iovlen;
9#else
10 int msg_iovlen, __pad1;
11#endif
12 void *msg_control;
13#if __BYTE_ORDER == __BIG_ENDIAN
14 int __pad2;
15 socklen_t msg_controllen;
16#else
17 socklen_t msg_controllen;
18 int __pad2;
19#endif
20 int msg_flags;
21};
22
23struct cmsghdr {
24#if __BYTE_ORDER == __BIG_ENDIAN
25 int __pad1;
26 socklen_t cmsg_len;
27#else
28 socklen_t cmsg_len;
29 int __pad1;
30#endif
31 int cmsg_level;
32 int cmsg_type;
33};
libc/musl/arch/aarch64/bits/stat.h created+18
...@@ -0,0 +1,18 @@
1struct stat {
2 dev_t st_dev;
3 ino_t st_ino;
4 mode_t st_mode;
5 nlink_t st_nlink;
6 uid_t st_uid;
7 gid_t st_gid;
8 dev_t st_rdev;
9 unsigned long __pad;
10 off_t st_size;
11 blksize_t st_blksize;
12 int __pad2;
13 blkcnt_t st_blocks;
14 struct timespec st_atim;
15 struct timespec st_mtim;
16 struct timespec st_ctim;
17 unsigned __unused[2];
18};
libc/musl/arch/aarch64/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT64_MIN
16#define INTPTR_MAX INT64_MAX
17#define UINTPTR_MAX UINT64_MAX
18#define PTRDIFF_MIN INT64_MIN
19#define PTRDIFF_MAX INT64_MAX
20#define SIZE_MAX UINT64_MAX
libc/musl/arch/aarch64/bits/syscall.h.in created+278
...@@ -0,0 +1,278 @@
1#define __NR_io_setup 0
2#define __NR_io_destroy 1
3#define __NR_io_submit 2
4#define __NR_io_cancel 3
5#define __NR_io_getevents 4
6#define __NR_setxattr 5
7#define __NR_lsetxattr 6
8#define __NR_fsetxattr 7
9#define __NR_getxattr 8
10#define __NR_lgetxattr 9
11#define __NR_fgetxattr 10
12#define __NR_listxattr 11
13#define __NR_llistxattr 12
14#define __NR_flistxattr 13
15#define __NR_removexattr 14
16#define __NR_lremovexattr 15
17#define __NR_fremovexattr 16
18#define __NR_getcwd 17
19#define __NR_lookup_dcookie 18
20#define __NR_eventfd2 19
21#define __NR_epoll_create1 20
22#define __NR_epoll_ctl 21
23#define __NR_epoll_pwait 22
24#define __NR_dup 23
25#define __NR_dup3 24
26#define __NR_fcntl 25
27#define __NR_inotify_init1 26
28#define __NR_inotify_add_watch 27
29#define __NR_inotify_rm_watch 28
30#define __NR_ioctl 29
31#define __NR_ioprio_set 30
32#define __NR_ioprio_get 31
33#define __NR_flock 32
34#define __NR_mknodat 33
35#define __NR_mkdirat 34
36#define __NR_unlinkat 35
37#define __NR_symlinkat 36
38#define __NR_linkat 37
39#define __NR_renameat 38
40#define __NR_umount2 39
41#define __NR_mount 40
42#define __NR_pivot_root 41
43#define __NR_nfsservctl 42
44#define __NR_statfs 43
45#define __NR_fstatfs 44
46#define __NR_truncate 45
47#define __NR_ftruncate 46
48#define __NR_fallocate 47
49#define __NR_faccessat 48
50#define __NR_chdir 49
51#define __NR_fchdir 50
52#define __NR_chroot 51
53#define __NR_fchmod 52
54#define __NR_fchmodat 53
55#define __NR_fchownat 54
56#define __NR_fchown 55
57#define __NR_openat 56
58#define __NR_close 57
59#define __NR_vhangup 58
60#define __NR_pipe2 59
61#define __NR_quotactl 60
62#define __NR_getdents64 61
63#define __NR_lseek 62
64#define __NR_read 63
65#define __NR_write 64
66#define __NR_readv 65
67#define __NR_writev 66
68#define __NR_pread64 67
69#define __NR_pwrite64 68
70#define __NR_preadv 69
71#define __NR_pwritev 70
72#define __NR_sendfile 71
73#define __NR_pselect6 72
74#define __NR_ppoll 73
75#define __NR_signalfd4 74
76#define __NR_vmsplice 75
77#define __NR_splice 76
78#define __NR_tee 77
79#define __NR_readlinkat 78
80#define __NR_newfstatat 79
81#define __NR_fstat 80
82#define __NR_sync 81
83#define __NR_fsync 82
84#define __NR_fdatasync 83
85#define __NR_sync_file_range 84
86#define __NR_timerfd_create 85
87#define __NR_timerfd_settime 86
88#define __NR_timerfd_gettime 87
89#define __NR_utimensat 88
90#define __NR_acct 89
91#define __NR_capget 90
92#define __NR_capset 91
93#define __NR_personality 92
94#define __NR_exit 93
95#define __NR_exit_group 94
96#define __NR_waitid 95
97#define __NR_set_tid_address 96
98#define __NR_unshare 97
99#define __NR_futex 98
100#define __NR_set_robust_list 99
101#define __NR_get_robust_list 100
102#define __NR_nanosleep 101
103#define __NR_getitimer 102
104#define __NR_setitimer 103
105#define __NR_kexec_load 104
106#define __NR_init_module 105
107#define __NR_delete_module 106
108#define __NR_timer_create 107
109#define __NR_timer_gettime 108
110#define __NR_timer_getoverrun 109
111#define __NR_timer_settime 110
112#define __NR_timer_delete 111
113#define __NR_clock_settime 112
114#define __NR_clock_gettime 113
115#define __NR_clock_getres 114
116#define __NR_clock_nanosleep 115
117#define __NR_syslog 116
118#define __NR_ptrace 117
119#define __NR_sched_setparam 118
120#define __NR_sched_setscheduler 119
121#define __NR_sched_getscheduler 120
122#define __NR_sched_getparam 121
123#define __NR_sched_setaffinity 122
124#define __NR_sched_getaffinity 123
125#define __NR_sched_yield 124
126#define __NR_sched_get_priority_max 125
127#define __NR_sched_get_priority_min 126
128#define __NR_sched_rr_get_interval 127
129#define __NR_restart_syscall 128
130#define __NR_kill 129
131#define __NR_tkill 130
132#define __NR_tgkill 131
133#define __NR_sigaltstack 132
134#define __NR_rt_sigsuspend 133
135#define __NR_rt_sigaction 134
136#define __NR_rt_sigprocmask 135
137#define __NR_rt_sigpending 136
138#define __NR_rt_sigtimedwait 137
139#define __NR_rt_sigqueueinfo 138
140#define __NR_rt_sigreturn 139
141#define __NR_setpriority 140
142#define __NR_getpriority 141
143#define __NR_reboot 142
144#define __NR_setregid 143
145#define __NR_setgid 144
146#define __NR_setreuid 145
147#define __NR_setuid 146
148#define __NR_setresuid 147
149#define __NR_getresuid 148
150#define __NR_setresgid 149
151#define __NR_getresgid 150
152#define __NR_setfsuid 151
153#define __NR_setfsgid 152
154#define __NR_times 153
155#define __NR_setpgid 154
156#define __NR_getpgid 155
157#define __NR_getsid 156
158#define __NR_setsid 157
159#define __NR_getgroups 158
160#define __NR_setgroups 159
161#define __NR_uname 160
162#define __NR_sethostname 161
163#define __NR_setdomainname 162
164#define __NR_getrlimit 163
165#define __NR_setrlimit 164
166#define __NR_getrusage 165
167#define __NR_umask 166
168#define __NR_prctl 167
169#define __NR_getcpu 168
170#define __NR_gettimeofday 169
171#define __NR_settimeofday 170
172#define __NR_adjtimex 171
173#define __NR_getpid 172
174#define __NR_getppid 173
175#define __NR_getuid 174
176#define __NR_geteuid 175
177#define __NR_getgid 176
178#define __NR_getegid 177
179#define __NR_gettid 178
180#define __NR_sysinfo 179
181#define __NR_mq_open 180
182#define __NR_mq_unlink 181
183#define __NR_mq_timedsend 182
184#define __NR_mq_timedreceive 183
185#define __NR_mq_notify 184
186#define __NR_mq_getsetattr 185
187#define __NR_msgget 186
188#define __NR_msgctl 187
189#define __NR_msgrcv 188
190#define __NR_msgsnd 189
191#define __NR_semget 190
192#define __NR_semctl 191
193#define __NR_semtimedop 192
194#define __NR_semop 193
195#define __NR_shmget 194
196#define __NR_shmctl 195
197#define __NR_shmat 196
198#define __NR_shmdt 197
199#define __NR_socket 198
200#define __NR_socketpair 199
201#define __NR_bind 200
202#define __NR_listen 201
203#define __NR_accept 202
204#define __NR_connect 203
205#define __NR_getsockname 204
206#define __NR_getpeername 205
207#define __NR_sendto 206
208#define __NR_recvfrom 207
209#define __NR_setsockopt 208
210#define __NR_getsockopt 209
211#define __NR_shutdown 210
212#define __NR_sendmsg 211
213#define __NR_recvmsg 212
214#define __NR_readahead 213
215#define __NR_brk 214
216#define __NR_munmap 215
217#define __NR_mremap 216
218#define __NR_add_key 217
219#define __NR_request_key 218
220#define __NR_keyctl 219
221#define __NR_clone 220
222#define __NR_execve 221
223#define __NR_mmap 222
224#define __NR_fadvise64 223
225#define __NR_swapon 224
226#define __NR_swapoff 225
227#define __NR_mprotect 226
228#define __NR_msync 227
229#define __NR_mlock 228
230#define __NR_munlock 229
231#define __NR_mlockall 230
232#define __NR_munlockall 231
233#define __NR_mincore 232
234#define __NR_madvise 233
235#define __NR_remap_file_pages 234
236#define __NR_mbind 235
237#define __NR_get_mempolicy 236
238#define __NR_set_mempolicy 237
239#define __NR_migrate_pages 238
240#define __NR_move_pages 239
241#define __NR_rt_tgsigqueueinfo 240
242#define __NR_perf_event_open 241
243#define __NR_accept4 242
244#define __NR_recvmmsg 243
245#define __NR_wait4 260
246#define __NR_prlimit64 261
247#define __NR_fanotify_init 262
248#define __NR_fanotify_mark 263
249#define __NR_name_to_handle_at 264
250#define __NR_open_by_handle_at 265
251#define __NR_clock_adjtime 266
252#define __NR_syncfs 267
253#define __NR_setns 268
254#define __NR_sendmmsg 269
255#define __NR_process_vm_readv 270
256#define __NR_process_vm_writev 271
257#define __NR_kcmp 272
258#define __NR_finit_module 273
259#define __NR_sched_setattr 274
260#define __NR_sched_getattr 275
261#define __NR_renameat2 276
262#define __NR_seccomp 277
263#define __NR_getrandom 278
264#define __NR_memfd_create 279
265#define __NR_bpf 280
266#define __NR_execveat 281
267#define __NR_userfaultfd 282
268#define __NR_membarrier 283
269#define __NR_mlock2 284
270#define __NR_copy_file_range 285
271#define __NR_preadv2 286
272#define __NR_pwritev2 287
273#define __NR_pkey_mprotect 288
274#define __NR_pkey_alloc 289
275#define __NR_pkey_free 290
276#define __NR_statx 291
277#define __NR_io_pgetevents 292
278
libc/musl/arch/aarch64/bits/user.h created+16
...@@ -0,0 +1,16 @@
1struct user_regs_struct {
2 unsigned long long regs[31];
3 unsigned long long sp;
4 unsigned long long pc;
5 unsigned long long pstate;
6};
7
8struct user_fpsimd_struct {
9 long double vregs[32];
10 unsigned int fpsr;
11 unsigned int fpcr;
12};
13
14#define ELF_NREG 34
15typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NREG];
16typedef struct user_fpsimd_struct elf_fpregset_t;
libc/musl/arch/aarch64/crt_arch.h created+15
...@@ -0,0 +1,15 @@
1__asm__(
2".text \n"
3".global " START "\n"
4".type " START ",%function\n"
5START ":\n"
6" mov x29, #0\n"
7" mov x30, #0\n"
8" mov x0, sp\n"
9".weak _DYNAMIC\n"
10".hidden _DYNAMIC\n"
11" adrp x1, _DYNAMIC\n"
12" add x1, x1, #:lo12:_DYNAMIC\n"
13" and sp, x0, #-16\n"
14" b " START "_c\n"
15);
libc/musl/arch/aarch64/pthread_arch.h created+12
...@@ -0,0 +1,12 @@
1static inline struct pthread *__pthread_self()
2{
3 char *self;
4 __asm__ ("mrs %0,tpidr_el0" : "=r"(self));
5 return (void*)(self - sizeof(struct pthread));
6}
7
8#define TLS_ABOVE_TP
9#define GAP_ABOVE_TP 16
10#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
11
12#define MC_PC pc
libc/musl/arch/aarch64/reloc.h created+26
...@@ -0,0 +1,26 @@
1#include <endian.h>
2
3#if __BYTE_ORDER == __BIG_ENDIAN
4#define ENDIAN_SUFFIX "_be"
5#else
6#define ENDIAN_SUFFIX ""
7#endif
8
9#define LDSO_ARCH "aarch64" ENDIAN_SUFFIX
10
11#define NO_LEGACY_INITFINI
12
13#define TPOFF_K 0
14
15#define REL_SYMBOLIC R_AARCH64_ABS64
16#define REL_GOT R_AARCH64_GLOB_DAT
17#define REL_PLT R_AARCH64_JUMP_SLOT
18#define REL_RELATIVE R_AARCH64_RELATIVE
19#define REL_COPY R_AARCH64_COPY
20#define REL_DTPMOD R_AARCH64_TLS_DTPMOD64
21#define REL_DTPOFF R_AARCH64_TLS_DTPREL64
22#define REL_TPOFF R_AARCH64_TLS_TPREL64
23#define REL_TLSDESC R_AARCH64_TLSDESC
24
25#define CRTJMP(pc,sp) __asm__ __volatile__( \
26 "mov sp,%1 ; br %0" : : "r"(pc), "r"(sp) : "memory" )
libc/musl/arch/aarch64/syscall_arch.h created+76
...@@ -0,0 +1,76 @@
1#define __SYSCALL_LL_E(x) (x)
2#define __SYSCALL_LL_O(x) (x)
3
4#define __asm_syscall(...) do { \
5 __asm__ __volatile__ ( "svc 0" \
6 : "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \
7 return x0; \
8 } while (0)
9
10static inline long __syscall0(long n)
11{
12 register long x8 __asm__("x8") = n;
13 register long x0 __asm__("x0");
14 __asm_syscall("r"(x8));
15}
16
17static inline long __syscall1(long n, long a)
18{
19 register long x8 __asm__("x8") = n;
20 register long x0 __asm__("x0") = a;
21 __asm_syscall("r"(x8), "0"(x0));
22}
23
24static inline long __syscall2(long n, long a, long b)
25{
26 register long x8 __asm__("x8") = n;
27 register long x0 __asm__("x0") = a;
28 register long x1 __asm__("x1") = b;
29 __asm_syscall("r"(x8), "0"(x0), "r"(x1));
30}
31
32static inline long __syscall3(long n, long a, long b, long c)
33{
34 register long x8 __asm__("x8") = n;
35 register long x0 __asm__("x0") = a;
36 register long x1 __asm__("x1") = b;
37 register long x2 __asm__("x2") = c;
38 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2));
39}
40
41static inline long __syscall4(long n, long a, long b, long c, long d)
42{
43 register long x8 __asm__("x8") = n;
44 register long x0 __asm__("x0") = a;
45 register long x1 __asm__("x1") = b;
46 register long x2 __asm__("x2") = c;
47 register long x3 __asm__("x3") = d;
48 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3));
49}
50
51static inline long __syscall5(long n, long a, long b, long c, long d, long e)
52{
53 register long x8 __asm__("x8") = n;
54 register long x0 __asm__("x0") = a;
55 register long x1 __asm__("x1") = b;
56 register long x2 __asm__("x2") = c;
57 register long x3 __asm__("x3") = d;
58 register long x4 __asm__("x4") = e;
59 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4));
60}
61
62static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
63{
64 register long x8 __asm__("x8") = n;
65 register long x0 __asm__("x0") = a;
66 register long x1 __asm__("x1") = b;
67 register long x2 __asm__("x2") = c;
68 register long x3 __asm__("x3") = d;
69 register long x4 __asm__("x4") = e;
70 register long x5 __asm__("x5") = f;
71 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5));
72}
73
74#define VDSO_USEFUL
75#define VDSO_CGT_SYM "__kernel_clock_gettime"
76#define VDSO_CGT_VER "LINUX_2.6.39"
libc/musl/arch/arm/atomic_arch.h created+107
...@@ -0,0 +1,107 @@
1#include "libc.h"
2
3#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
4#define BLX "mov lr,pc\n\tbx"
5#else
6#define BLX "blx"
7#endif
8
9extern hidden uintptr_t __a_cas_ptr, __a_barrier_ptr;
10
11#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
12 || __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
13
14#define a_ll a_ll
15static inline int a_ll(volatile int *p)
16{
17 int v;
18 __asm__ __volatile__ ("ldrex %0, %1" : "=r"(v) : "Q"(*p));
19 return v;
20}
21
22#define a_sc a_sc
23static inline int a_sc(volatile int *p, int v)
24{
25 int r;
26 __asm__ __volatile__ ("strex %0,%2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
27 return !r;
28}
29
30#if __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
31
32#define a_barrier a_barrier
33static inline void a_barrier()
34{
35 __asm__ __volatile__ ("dmb ish" : : : "memory");
36}
37
38#endif
39
40#define a_pre_llsc a_barrier
41#define a_post_llsc a_barrier
42
43#else
44
45#define a_cas a_cas
46static inline int a_cas(volatile int *p, int t, int s)
47{
48 for (;;) {
49 register int r0 __asm__("r0") = t;
50 register int r1 __asm__("r1") = s;
51 register volatile int *r2 __asm__("r2") = p;
52 register uintptr_t r3 __asm__("r3") = __a_cas_ptr;
53 int old;
54 __asm__ __volatile__ (
55 BLX " r3"
56 : "+r"(r0), "+r"(r3) : "r"(r1), "r"(r2)
57 : "memory", "lr", "ip", "cc" );
58 if (!r0) return t;
59 if ((old=*p)!=t) return old;
60 }
61}
62
63#endif
64
65#ifndef a_barrier
66#define a_barrier a_barrier
67static inline void a_barrier()
68{
69 register uintptr_t ip __asm__("ip") = __a_barrier_ptr;
70 __asm__ __volatile__( BLX " ip" : "+r"(ip) : : "memory", "cc", "lr" );
71}
72#endif
73
74#define a_crash a_crash
75static inline void a_crash()
76{
77 __asm__ __volatile__(
78#ifndef __thumb__
79 ".word 0xe7f000f0"
80#else
81 ".short 0xdeff"
82#endif
83 : : : "memory");
84}
85
86#if __ARM_ARCH >= 5
87
88#define a_clz_32 a_clz_32
89static inline int a_clz_32(uint32_t x)
90{
91 __asm__ ("clz %0, %1" : "=r"(x) : "r"(x));
92 return x;
93}
94
95#if __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
96
97#define a_ctz_32 a_ctz_32
98static inline int a_ctz_32(uint32_t x)
99{
100 uint32_t xr;
101 __asm__ ("rbit %0, %1" : "=r"(xr) : "r"(x));
102 return a_clz_32(xr);
103}
104
105#endif
106
107#endif
libc/musl/arch/arm/bits/alltypes.h.in created+26
...@@ -0,0 +1,26 @@
1#define _Addr int
2#define _Int64 long long
3#define _Reg int
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF unsigned wchar_t;
10#endif
11
12TYPEDEF float float_t;
13TYPEDEF double double_t;
14
15TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
16
17TYPEDEF long time_t;
18TYPEDEF long suseconds_t;
19
20TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
21TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
22TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
23TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
24TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
25TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
26TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
libc/musl/arch/arm/bits/endian.h created+5
...@@ -0,0 +1,5 @@
1#if __ARMEB__
2#define __BYTE_ORDER __BIG_ENDIAN
3#else
4#define __BYTE_ORDER __LITTLE_ENDIAN
5#endif
libc/musl/arch/arm/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0100
2#define O_EXCL 0200
3#define O_NOCTTY 0400
4#define O_TRUNC 01000
5#define O_APPEND 02000
6#define O_NONBLOCK 04000
7#define O_DSYNC 010000
8#define O_SYNC 04010000
9#define O_RSYNC 04010000
10#define O_DIRECTORY 040000
11#define O_NOFOLLOW 0100000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 020000
15#define O_DIRECT 0200000
16#define O_LARGEFILE 0400000
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020040000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_SETOWN 8
29#define F_GETOWN 9
30#define F_SETSIG 10
31#define F_GETSIG 11
32
33#define F_GETLK 12
34#define F_SETLK 13
35#define F_SETLKW 14
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/arm/bits/fenv.h created+23
...@@ -0,0 +1,23 @@
1#ifndef __ARM_PCS_VFP
2#define FE_ALL_EXCEPT 0
3#define FE_TONEAREST 0
4#else
5#define FE_INVALID 1
6#define FE_DIVBYZERO 2
7#define FE_OVERFLOW 4
8#define FE_UNDERFLOW 8
9#define FE_INEXACT 16
10#define FE_ALL_EXCEPT 31
11#define FE_TONEAREST 0
12#define FE_DOWNWARD 0x800000
13#define FE_UPWARD 0x400000
14#define FE_TOWARDZERO 0xc00000
15#endif
16
17typedef unsigned long fexcept_t;
18
19typedef struct {
20 unsigned long __cw;
21} fenv_t;
22
23#define FE_DFL_ENV ((const fenv_t *) -1)
libc/musl/arch/arm/bits/float.h created+16
...@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
4#define LDBL_MIN 2.22507385850720138309e-308L
5#define LDBL_MAX 1.79769313486231570815e+308L
6#define LDBL_EPSILON 2.22044604925031308085e-16L
7
8#define LDBL_MANT_DIG 53
9#define LDBL_MIN_EXP (-1021)
10#define LDBL_MAX_EXP 1024
11
12#define LDBL_DIG 15
13#define LDBL_MIN_10_EXP (-307)
14#define LDBL_MAX_10_EXP 308
15
16#define DECIMAL_DIG 17
libc/musl/arch/arm/bits/hwcap.h created+53
...@@ -0,0 +1,53 @@
1#define HWCAP_SWP (1 << 0)
2#define HWCAP_HALF (1 << 1)
3#define HWCAP_THUMB (1 << 2)
4#define HWCAP_26BIT (1 << 3)
5#define HWCAP_FAST_MULT (1 << 4)
6#define HWCAP_FPA (1 << 5)
7#define HWCAP_VFP (1 << 6)
8#define HWCAP_EDSP (1 << 7)
9#define HWCAP_JAVA (1 << 8)
10#define HWCAP_IWMMXT (1 << 9)
11#define HWCAP_CRUNCH (1 << 10)
12#define HWCAP_THUMBEE (1 << 11)
13#define HWCAP_NEON (1 << 12)
14#define HWCAP_VFPv3 (1 << 13)
15#define HWCAP_VFPv3D16 (1 << 14)
16#define HWCAP_TLS (1 << 15)
17#define HWCAP_VFPv4 (1 << 16)
18#define HWCAP_IDIVA (1 << 17)
19#define HWCAP_IDIVT (1 << 18)
20#define HWCAP_VFPD32 (1 << 19)
21#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
22#define HWCAP_LPAE (1 << 20)
23#define HWCAP_EVTSTRM (1 << 21)
24
25#define HWCAP2_AES (1 << 0)
26#define HWCAP2_PMULL (1 << 1)
27#define HWCAP2_SHA1 (1 << 2)
28#define HWCAP2_SHA2 (1 << 3)
29#define HWCAP2_CRC32 (1 << 4)
30
31#define HWCAP_ARM_SWP (1 << 0)
32#define HWCAP_ARM_HALF (1 << 1)
33#define HWCAP_ARM_THUMB (1 << 2)
34#define HWCAP_ARM_26BIT (1 << 3)
35#define HWCAP_ARM_FAST_MULT (1 << 4)
36#define HWCAP_ARM_FPA (1 << 5)
37#define HWCAP_ARM_VFP (1 << 6)
38#define HWCAP_ARM_EDSP (1 << 7)
39#define HWCAP_ARM_JAVA (1 << 8)
40#define HWCAP_ARM_IWMMXT (1 << 9)
41#define HWCAP_ARM_CRUNCH (1 << 10)
42#define HWCAP_ARM_THUMBEE (1 << 11)
43#define HWCAP_ARM_NEON (1 << 12)
44#define HWCAP_ARM_VFPv3 (1 << 13)
45#define HWCAP_ARM_VFPv3D16 (1 << 14)
46#define HWCAP_ARM_TLS (1 << 15)
47#define HWCAP_ARM_VFPv4 (1 << 16)
48#define HWCAP_ARM_IDIVA (1 << 17)
49#define HWCAP_ARM_IDIVT (1 << 18)
50#define HWCAP_ARM_VFPD32 (1 << 19)
51#define HWCAP_ARM_IDIV (HWCAP_ARM_IDIVA | HWCAP_ARM_IDIVT)
52#define HWCAP_ARM_LPAE (1 << 20)
53#define HWCAP_ARM_EVTSTRM (1 << 21)
libc/musl/arch/arm/bits/ioctl_fix.h created+2
...@@ -0,0 +1,2 @@
1#undef FIOQSIZE
2#define FIOQSIZE 0x545e
libc/musl/arch/arm/bits/limits.h created+7
...@@ -0,0 +1,7 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define LONG_BIT 32
4#endif
5
6#define LONG_MAX 0x7fffffffL
7#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/arm/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_ILP32_OFFBIG 1
2#define _POSIX_V7_ILP32_OFFBIG 1
libc/musl/arch/arm/bits/ptrace.h created+25
...@@ -0,0 +1,25 @@
1#define PTRACE_GETWMMXREGS 18
2#define PTRACE_SETWMMXREGS 19
3#define PTRACE_GET_THREAD_AREA 22
4#define PTRACE_SET_SYSCALL 23
5#define PTRACE_GETCRUNCHREGS 25
6#define PTRACE_SETCRUNCHREGS 26
7#define PTRACE_GETVFPREGS 27
8#define PTRACE_SETVFPREGS 28
9#define PTRACE_GETHBPREGS 29
10#define PTRACE_SETHBPREGS 30
11#define PTRACE_GETFDPIC 31
12#define PTRACE_GETFDPIC_EXEC 0
13#define PTRACE_GETFDPIC_INTERP 1
14
15#define PT_GETWMMXREGS PTRACE_GETWMMXREGS
16#define PT_SETWMMXREGS PTRACE_SETWMMXREGS
17#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
18#define PT_SET_SYSCALL PTRACE_SET_SYSCALL
19#define PT_GETCRUNCHREGS PTRACE_GETCRUNCHREGS
20#define PT_SETCRUNCHREGS PTRACE_SETCRUNCHREGS
21#define PT_GETVFPREGS PTRACE_GETVFPREGS
22#define PT_SETVFPREGS PTRACE_SETVFPREGS
23#define PT_GETHBPREGS PTRACE_GETHBPREGS
24#define PT_SETHBPREGS PTRACE_SETHBPREGS
25#define PT_GETFDPIC PTRACE_GETFDPIC
libc/musl/arch/arm/bits/reg.h created+3
...@@ -0,0 +1,3 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3/* FIXME */
libc/musl/arch/arm/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long long __jmp_buf[32];
libc/musl/arch/arm/bits/signal.h created+86
...@@ -0,0 +1,86 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 2048
6#define SIGSTKSZ 8192
7#endif
8
9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10typedef int greg_t, gregset_t[18];
11typedef struct sigcontext {
12 unsigned long trap_no, error_code, oldmask;
13 unsigned long arm_r0, arm_r1, arm_r2, arm_r3;
14 unsigned long arm_r4, arm_r5, arm_r6, arm_r7;
15 unsigned long arm_r8, arm_r9, arm_r10, arm_fp;
16 unsigned long arm_ip, arm_sp, arm_lr, arm_pc;
17 unsigned long arm_cpsr, fault_address;
18} mcontext_t;
19#else
20typedef struct {
21 unsigned long __regs[21];
22} mcontext_t;
23#endif
24
25struct sigaltstack {
26 void *ss_sp;
27 int ss_flags;
28 size_t ss_size;
29};
30
31typedef struct __ucontext {
32 unsigned long uc_flags;
33 struct __ucontext *uc_link;
34 stack_t uc_stack;
35 mcontext_t uc_mcontext;
36 sigset_t uc_sigmask;
37 unsigned long long uc_regspace[64];
38} ucontext_t;
39
40#define SA_NOCLDSTOP 1
41#define SA_NOCLDWAIT 2
42#define SA_SIGINFO 4
43#define SA_ONSTACK 0x08000000
44#define SA_RESTART 0x10000000
45#define SA_NODEFER 0x40000000
46#define SA_RESETHAND 0x80000000
47#define SA_RESTORER 0x04000000
48
49#endif
50
51#define SIGHUP 1
52#define SIGINT 2
53#define SIGQUIT 3
54#define SIGILL 4
55#define SIGTRAP 5
56#define SIGABRT 6
57#define SIGIOT SIGABRT
58#define SIGBUS 7
59#define SIGFPE 8
60#define SIGKILL 9
61#define SIGUSR1 10
62#define SIGSEGV 11
63#define SIGUSR2 12
64#define SIGPIPE 13
65#define SIGALRM 14
66#define SIGTERM 15
67#define SIGSTKFLT 16
68#define SIGCHLD 17
69#define SIGCONT 18
70#define SIGSTOP 19
71#define SIGTSTP 20
72#define SIGTTIN 21
73#define SIGTTOU 22
74#define SIGURG 23
75#define SIGXCPU 24
76#define SIGXFSZ 25
77#define SIGVTALRM 26
78#define SIGPROF 27
79#define SIGWINCH 28
80#define SIGIO 29
81#define SIGPOLL 29
82#define SIGPWR 30
83#define SIGSYS 31
84#define SIGUNUSED SIGSYS
85
86#define _NSIG 65
libc/musl/arch/arm/bits/stat.h created+21
...@@ -0,0 +1,21 @@
1/* copied from kernel definition, but with padding replaced
2 * by the corresponding correctly-sized userspace types. */
3
4struct stat {
5 dev_t st_dev;
6 int __st_dev_padding;
7 long __st_ino_truncated;
8 mode_t st_mode;
9 nlink_t st_nlink;
10 uid_t st_uid;
11 gid_t st_gid;
12 dev_t st_rdev;
13 int __st_rdev_padding;
14 off_t st_size;
15 blksize_t st_blksize;
16 blkcnt_t st_blocks;
17 struct timespec st_atim;
18 struct timespec st_mtim;
19 struct timespec st_ctim;
20 ino_t st_ino;
21};
libc/musl/arch/arm/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT32_MIN
16#define INTPTR_MAX INT32_MAX
17#define UINTPTR_MAX UINT32_MAX
18#define PTRDIFF_MIN INT32_MIN
19#define PTRDIFF_MAX INT32_MAX
20#define SIZE_MAX UINT32_MAX
libc/musl/arch/arm/bits/syscall.h.in created+364
...@@ -0,0 +1,364 @@
1#define __NR_restart_syscall 0
2#define __NR_exit 1
3#define __NR_fork 2
4#define __NR_read 3
5#define __NR_write 4
6#define __NR_open 5
7#define __NR_close 6
8#define __NR_creat 8
9#define __NR_link 9
10#define __NR_unlink 10
11#define __NR_execve 11
12#define __NR_chdir 12
13#define __NR_mknod 14
14#define __NR_chmod 15
15#define __NR_lchown 16
16#define __NR_lseek 19
17#define __NR_getpid 20
18#define __NR_mount 21
19#define __NR_setuid 23
20#define __NR_getuid 24
21#define __NR_ptrace 26
22#define __NR_pause 29
23#define __NR_access 33
24#define __NR_nice 34
25#define __NR_sync 36
26#define __NR_kill 37
27#define __NR_rename 38
28#define __NR_mkdir 39
29#define __NR_rmdir 40
30#define __NR_dup 41
31#define __NR_pipe 42
32#define __NR_times 43
33#define __NR_brk 45
34#define __NR_setgid 46
35#define __NR_getgid 47
36#define __NR_geteuid 49
37#define __NR_getegid 50
38#define __NR_acct 51
39#define __NR_umount2 52
40#define __NR_ioctl 54
41#define __NR_fcntl 55
42#define __NR_setpgid 57
43#define __NR_umask 60
44#define __NR_chroot 61
45#define __NR_ustat 62
46#define __NR_dup2 63
47#define __NR_getppid 64
48#define __NR_getpgrp 65
49#define __NR_setsid 66
50#define __NR_sigaction 67
51#define __NR_setreuid 70
52#define __NR_setregid 71
53#define __NR_sigsuspend 72
54#define __NR_sigpending 73
55#define __NR_sethostname 74
56#define __NR_setrlimit 75
57#define __NR_getrusage 77
58#define __NR_gettimeofday 78
59#define __NR_settimeofday 79
60#define __NR_getgroups 80
61#define __NR_setgroups 81
62#define __NR_symlink 83
63#define __NR_readlink 85
64#define __NR_uselib 86
65#define __NR_swapon 87
66#define __NR_reboot 88
67#define __NR_munmap 91
68#define __NR_truncate 92
69#define __NR_ftruncate 93
70#define __NR_fchmod 94
71#define __NR_fchown 95
72#define __NR_getpriority 96
73#define __NR_setpriority 97
74#define __NR_statfs 99
75#define __NR_fstatfs 100
76#define __NR_syslog 103
77#define __NR_setitimer 104
78#define __NR_getitimer 105
79#define __NR_stat 106
80#define __NR_lstat 107
81#define __NR_fstat 108
82#define __NR_vhangup 111
83#define __NR_wait4 114
84#define __NR_swapoff 115
85#define __NR_sysinfo 116
86#define __NR_fsync 118
87#define __NR_sigreturn 119
88#define __NR_clone 120
89#define __NR_setdomainname 121
90#define __NR_uname 122
91#define __NR_adjtimex 124
92#define __NR_mprotect 125
93#define __NR_sigprocmask 126
94#define __NR_init_module 128
95#define __NR_delete_module 129
96#define __NR_quotactl 131
97#define __NR_getpgid 132
98#define __NR_fchdir 133
99#define __NR_bdflush 134
100#define __NR_sysfs 135
101#define __NR_personality 136
102#define __NR_setfsuid 138
103#define __NR_setfsgid 139
104#define __NR__llseek 140
105#define __NR_getdents 141
106#define __NR__newselect 142
107#define __NR_flock 143
108#define __NR_msync 144
109#define __NR_readv 145
110#define __NR_writev 146
111#define __NR_getsid 147
112#define __NR_fdatasync 148
113#define __NR__sysctl 149
114#define __NR_mlock 150
115#define __NR_munlock 151
116#define __NR_mlockall 152
117#define __NR_munlockall 153
118#define __NR_sched_setparam 154
119#define __NR_sched_getparam 155
120#define __NR_sched_setscheduler 156
121#define __NR_sched_getscheduler 157
122#define __NR_sched_yield 158
123#define __NR_sched_get_priority_max 159
124#define __NR_sched_get_priority_min 160
125#define __NR_sched_rr_get_interval 161
126#define __NR_nanosleep 162
127#define __NR_mremap 163
128#define __NR_setresuid 164
129#define __NR_getresuid 165
130#define __NR_poll 168
131#define __NR_nfsservctl 169
132#define __NR_setresgid 170
133#define __NR_getresgid 171
134#define __NR_prctl 172
135#define __NR_rt_sigreturn 173
136#define __NR_rt_sigaction 174
137#define __NR_rt_sigprocmask 175
138#define __NR_rt_sigpending 176
139#define __NR_rt_sigtimedwait 177
140#define __NR_rt_sigqueueinfo 178
141#define __NR_rt_sigsuspend 179
142#define __NR_pread64 180
143#define __NR_pwrite64 181
144#define __NR_chown 182
145#define __NR_getcwd 183
146#define __NR_capget 184
147#define __NR_capset 185
148#define __NR_sigaltstack 186
149#define __NR_sendfile 187
150#define __NR_vfork 190
151#define __NR_ugetrlimit 191
152#define __NR_mmap2 192
153#define __NR_truncate64 193
154#define __NR_ftruncate64 194
155#define __NR_stat64 195
156#define __NR_lstat64 196
157#define __NR_fstat64 197
158#define __NR_lchown32 198
159#define __NR_getuid32 199
160#define __NR_getgid32 200
161#define __NR_geteuid32 201
162#define __NR_getegid32 202
163#define __NR_setreuid32 203
164#define __NR_setregid32 204
165#define __NR_getgroups32 205
166#define __NR_setgroups32 206
167#define __NR_fchown32 207
168#define __NR_setresuid32 208
169#define __NR_getresuid32 209
170#define __NR_setresgid32 210
171#define __NR_getresgid32 211
172#define __NR_chown32 212
173#define __NR_setuid32 213
174#define __NR_setgid32 214
175#define __NR_setfsuid32 215
176#define __NR_setfsgid32 216
177#define __NR_getdents64 217
178#define __NR_pivot_root 218
179#define __NR_mincore 219
180#define __NR_madvise 220
181#define __NR_fcntl64 221
182#define __NR_gettid 224
183#define __NR_readahead 225
184#define __NR_setxattr 226
185#define __NR_lsetxattr 227
186#define __NR_fsetxattr 228
187#define __NR_getxattr 229
188#define __NR_lgetxattr 230
189#define __NR_fgetxattr 231
190#define __NR_listxattr 232
191#define __NR_llistxattr 233
192#define __NR_flistxattr 234
193#define __NR_removexattr 235
194#define __NR_lremovexattr 236
195#define __NR_fremovexattr 237
196#define __NR_tkill 238
197#define __NR_sendfile64 239
198#define __NR_futex 240
199#define __NR_sched_setaffinity 241
200#define __NR_sched_getaffinity 242
201#define __NR_io_setup 243
202#define __NR_io_destroy 244
203#define __NR_io_getevents 245
204#define __NR_io_submit 246
205#define __NR_io_cancel 247
206#define __NR_exit_group 248
207#define __NR_lookup_dcookie 249
208#define __NR_epoll_create 250
209#define __NR_epoll_ctl 251
210#define __NR_epoll_wait 252
211#define __NR_remap_file_pages 253
212#define __NR_set_tid_address 256
213#define __NR_timer_create 257
214#define __NR_timer_settime 258
215#define __NR_timer_gettime 259
216#define __NR_timer_getoverrun 260
217#define __NR_timer_delete 261
218#define __NR_clock_settime 262
219#define __NR_clock_gettime 263
220#define __NR_clock_getres 264
221#define __NR_clock_nanosleep 265
222#define __NR_statfs64 266
223#define __NR_fstatfs64 267
224#define __NR_tgkill 268
225#define __NR_utimes 269
226#define __NR_fadvise64_64 270
227#define __NR_arm_fadvise64_64 270
228#define __NR_pciconfig_iobase 271
229#define __NR_pciconfig_read 272
230#define __NR_pciconfig_write 273
231#define __NR_mq_open 274
232#define __NR_mq_unlink 275
233#define __NR_mq_timedsend 276
234#define __NR_mq_timedreceive 277
235#define __NR_mq_notify 278
236#define __NR_mq_getsetattr 279
237#define __NR_waitid 280
238#define __NR_socket 281
239#define __NR_bind 282
240#define __NR_connect 283
241#define __NR_listen 284
242#define __NR_accept 285
243#define __NR_getsockname 286
244#define __NR_getpeername 287
245#define __NR_socketpair 288
246#define __NR_send 289
247#define __NR_sendto 290
248#define __NR_recv 291
249#define __NR_recvfrom 292
250#define __NR_shutdown 293
251#define __NR_setsockopt 294
252#define __NR_getsockopt 295
253#define __NR_sendmsg 296
254#define __NR_recvmsg 297
255#define __NR_semop 298
256#define __NR_semget 299
257#define __NR_semctl 300
258#define __NR_msgsnd 301
259#define __NR_msgrcv 302
260#define __NR_msgget 303
261#define __NR_msgctl 304
262#define __NR_shmat 305
263#define __NR_shmdt 306
264#define __NR_shmget 307
265#define __NR_shmctl 308
266#define __NR_add_key 309
267#define __NR_request_key 310
268#define __NR_keyctl 311
269#define __NR_semtimedop 312
270#define __NR_vserver 313
271#define __NR_ioprio_set 314
272#define __NR_ioprio_get 315
273#define __NR_inotify_init 316
274#define __NR_inotify_add_watch 317
275#define __NR_inotify_rm_watch 318
276#define __NR_mbind 319
277#define __NR_get_mempolicy 320
278#define __NR_set_mempolicy 321
279#define __NR_openat 322
280#define __NR_mkdirat 323
281#define __NR_mknodat 324
282#define __NR_fchownat 325
283#define __NR_futimesat 326
284#define __NR_fstatat64 327
285#define __NR_unlinkat 328
286#define __NR_renameat 329
287#define __NR_linkat 330
288#define __NR_symlinkat 331
289#define __NR_readlinkat 332
290#define __NR_fchmodat 333
291#define __NR_faccessat 334
292#define __NR_pselect6 335
293#define __NR_ppoll 336
294#define __NR_unshare 337
295#define __NR_set_robust_list 338
296#define __NR_get_robust_list 339
297#define __NR_splice 340
298#define __NR_sync_file_range2 341
299#define __NR_arm_sync_file_range 341
300#define __NR_tee 342
301#define __NR_vmsplice 343
302#define __NR_move_pages 344
303#define __NR_getcpu 345
304#define __NR_epoll_pwait 346
305#define __NR_kexec_load 347
306#define __NR_utimensat 348
307#define __NR_signalfd 349
308#define __NR_timerfd_create 350
309#define __NR_eventfd 351
310#define __NR_fallocate 352
311#define __NR_timerfd_settime 353
312#define __NR_timerfd_gettime 354
313#define __NR_signalfd4 355
314#define __NR_eventfd2 356
315#define __NR_epoll_create1 357
316#define __NR_dup3 358
317#define __NR_pipe2 359
318#define __NR_inotify_init1 360
319#define __NR_preadv 361
320#define __NR_pwritev 362
321#define __NR_rt_tgsigqueueinfo 363
322#define __NR_perf_event_open 364
323#define __NR_recvmmsg 365
324#define __NR_accept4 366
325#define __NR_fanotify_init 367
326#define __NR_fanotify_mark 368
327#define __NR_prlimit64 369
328#define __NR_name_to_handle_at 370
329#define __NR_open_by_handle_at 371
330#define __NR_clock_adjtime 372
331#define __NR_syncfs 373
332#define __NR_sendmmsg 374
333#define __NR_setns 375
334#define __NR_process_vm_readv 376
335#define __NR_process_vm_writev 377
336#define __NR_kcmp 378
337#define __NR_finit_module 379
338#define __NR_sched_setattr 380
339#define __NR_sched_getattr 381
340#define __NR_renameat2 382
341#define __NR_seccomp 383
342#define __NR_getrandom 384
343#define __NR_memfd_create 385
344#define __NR_bpf 386
345#define __NR_execveat 387
346#define __NR_userfaultfd 388
347#define __NR_membarrier 389
348#define __NR_mlock2 390
349#define __NR_copy_file_range 391
350#define __NR_preadv2 392
351#define __NR_pwritev2 393
352#define __NR_pkey_mprotect 394
353#define __NR_pkey_alloc 395
354#define __NR_pkey_free 396
355#define __NR_statx 397
356#define __NR_rseq 398
357
358#define __ARM_NR_breakpoint 0x0f0001
359#define __ARM_NR_cacheflush 0x0f0002
360#define __ARM_NR_usr26 0x0f0003
361#define __ARM_NR_usr32 0x0f0004
362#define __ARM_NR_set_tls 0x0f0005
363#define __ARM_NR_get_tls 0x0f0006
364
libc/musl/arch/arm/bits/user.h created+36
...@@ -0,0 +1,36 @@
1typedef struct user_fpregs {
2 struct fp_reg {
3 unsigned sign1:1;
4 unsigned unused:15;
5 unsigned sign2:1;
6 unsigned exponent:14;
7 unsigned j:1;
8 unsigned mantissa1:31;
9 unsigned mantissa0:32;
10 } fpregs[8];
11 unsigned fpsr:32;
12 unsigned fpcr:32;
13 unsigned char ftype[8];
14 unsigned int init_flag;
15} elf_fpregset_t;
16
17struct user_regs {
18 unsigned long uregs[18];
19};
20#define ELF_NGREG 18
21typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
22
23struct user {
24 struct user_regs regs;
25 int u_fpvalid;
26 unsigned long u_tsize, u_dsize, u_ssize;
27 unsigned long start_code, start_stack;
28 long signal;
29 int reserved;
30 struct user_regs *u_ar0;
31 unsigned long magic;
32 char u_comm[32];
33 int u_debugreg[8];
34 struct user_fpregs u_fp;
35 struct user_fpregs *u_fp0;
36};
libc/musl/arch/arm/crt_arch.h created+18
...@@ -0,0 +1,18 @@
1__asm__(
2".text \n"
3".global " START " \n"
4".type " START ",%function \n"
5START ": \n"
6" mov fp, #0 \n"
7" mov lr, #0 \n"
8" ldr a2, 1f \n"
9" add a2, pc, a2 \n"
10" mov a1, sp \n"
11"2: and ip, a1, #-16 \n"
12" mov sp, ip \n"
13" bl " START "_c \n"
14".weak _DYNAMIC \n"
15".hidden _DYNAMIC \n"
16".align 2 \n"
17"1: .word _DYNAMIC-2b \n"
18);
libc/musl/arch/arm/pthread_arch.h created+33
...@@ -0,0 +1,33 @@
1#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
2 || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
3
4static inline pthread_t __pthread_self()
5{
6 char *p;
7 __asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
8 return (void *)(p-sizeof(struct pthread));
9}
10
11#else
12
13#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
14#define BLX "mov lr,pc\n\tbx"
15#else
16#define BLX "blx"
17#endif
18
19static inline pthread_t __pthread_self()
20{
21 extern hidden uintptr_t __a_gettp_ptr;
22 register uintptr_t p __asm__("r0");
23 __asm__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
24 return (void *)(p-sizeof(struct pthread));
25}
26
27#endif
28
29#define TLS_ABOVE_TP
30#define GAP_ABOVE_TP 8
31#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
32
33#define MC_PC arm_pc
libc/musl/arch/arm/reloc.h created+34
...@@ -0,0 +1,34 @@
1#include <endian.h>
2
3#if __BYTE_ORDER == __BIG_ENDIAN
4#define ENDIAN_SUFFIX "eb"
5#else
6#define ENDIAN_SUFFIX ""
7#endif
8
9#if __ARM_PCS_VFP
10#define FP_SUFFIX "hf"
11#else
12#define FP_SUFFIX ""
13#endif
14
15#define LDSO_ARCH "arm" ENDIAN_SUFFIX FP_SUFFIX
16
17#define NO_LEGACY_INITFINI
18
19#define TPOFF_K 0
20
21#define REL_SYMBOLIC R_ARM_ABS32
22#define REL_GOT R_ARM_GLOB_DAT
23#define REL_PLT R_ARM_JUMP_SLOT
24#define REL_RELATIVE R_ARM_RELATIVE
25#define REL_COPY R_ARM_COPY
26#define REL_DTPMOD R_ARM_TLS_DTPMOD32
27#define REL_DTPOFF R_ARM_TLS_DTPOFF32
28#define REL_TPOFF R_ARM_TLS_TPOFF32
29#define REL_TLSDESC R_ARM_TLS_DESC
30
31#define TLSDESC_BACKWARDS
32
33#define CRTJMP(pc,sp) __asm__ __volatile__( \
34 "mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
libc/musl/arch/arm/syscall_arch.h created+107
...@@ -0,0 +1,107 @@
1#define __SYSCALL_LL_E(x) \
2((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
3((union { long long ll; long l[2]; }){ .ll = x }).l[1]
4#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
5
6#ifdef __thumb__
7
8/* Avoid use of r7 in asm constraints when producing thumb code,
9 * since it's reserved as frame pointer and might not be supported. */
10#define __ASM____R7__
11#define __asm_syscall(...) do { \
12 __asm__ __volatile__ ( "mov %1,r7 ; mov r7,%2 ; svc 0 ; mov r7,%1" \
13 : "=r"(r0), "=&r"((int){0}) : __VA_ARGS__ : "memory"); \
14 return r0; \
15 } while (0)
16
17#else
18
19#define __ASM____R7__ __asm__("r7")
20#define __asm_syscall(...) do { \
21 __asm__ __volatile__ ( "svc 0" \
22 : "=r"(r0) : __VA_ARGS__ : "memory"); \
23 return r0; \
24 } while (0)
25#endif
26
27/* For thumb2, we can allow 8-bit immediate syscall numbers, saving a
28 * register in the above dance around r7. Does not work for thumb1 where
29 * only movs, not mov, supports immediates, and we can't use movs because
30 * it doesn't support high regs. */
31#ifdef __thumb2__
32#define R7_OPERAND "rI"(r7)
33#else
34#define R7_OPERAND "r"(r7)
35#endif
36
37static inline long __syscall0(long n)
38{
39 register long r7 __ASM____R7__ = n;
40 register long r0 __asm__("r0");
41 __asm_syscall(R7_OPERAND);
42}
43
44static inline long __syscall1(long n, long a)
45{
46 register long r7 __ASM____R7__ = n;
47 register long r0 __asm__("r0") = a;
48 __asm_syscall(R7_OPERAND, "0"(r0));
49}
50
51static inline long __syscall2(long n, long a, long b)
52{
53 register long r7 __ASM____R7__ = n;
54 register long r0 __asm__("r0") = a;
55 register long r1 __asm__("r1") = b;
56 __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1));
57}
58
59static inline long __syscall3(long n, long a, long b, long c)
60{
61 register long r7 __ASM____R7__ = n;
62 register long r0 __asm__("r0") = a;
63 register long r1 __asm__("r1") = b;
64 register long r2 __asm__("r2") = c;
65 __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2));
66}
67
68static inline long __syscall4(long n, long a, long b, long c, long d)
69{
70 register long r7 __ASM____R7__ = n;
71 register long r0 __asm__("r0") = a;
72 register long r1 __asm__("r1") = b;
73 register long r2 __asm__("r2") = c;
74 register long r3 __asm__("r3") = d;
75 __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3));
76}
77
78static inline long __syscall5(long n, long a, long b, long c, long d, long e)
79{
80 register long r7 __ASM____R7__ = n;
81 register long r0 __asm__("r0") = a;
82 register long r1 __asm__("r1") = b;
83 register long r2 __asm__("r2") = c;
84 register long r3 __asm__("r3") = d;
85 register long r4 __asm__("r4") = e;
86 __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
87}
88
89static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
90{
91 register long r7 __ASM____R7__ = n;
92 register long r0 __asm__("r0") = a;
93 register long r1 __asm__("r1") = b;
94 register long r2 __asm__("r2") = c;
95 register long r3 __asm__("r3") = d;
96 register long r4 __asm__("r4") = e;
97 register long r5 __asm__("r5") = f;
98 __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
99}
100
101#define VDSO_USEFUL
102#define VDSO_CGT_SYM "__vdso_clock_gettime"
103#define VDSO_CGT_VER "LINUX_2.6"
104
105#define SYSCALL_FADVISE_6_ARG
106
107#define SYSCALL_IPC_BROKEN_MODE
libc/musl/arch/generic/bits/errno.h created+134
...@@ -0,0 +1,134 @@
1#define EPERM 1
2#define ENOENT 2
3#define ESRCH 3
4#define EINTR 4
5#define EIO 5
6#define ENXIO 6
7#define E2BIG 7
8#define ENOEXEC 8
9#define EBADF 9
10#define ECHILD 10
11#define EAGAIN 11
12#define ENOMEM 12
13#define EACCES 13
14#define EFAULT 14
15#define ENOTBLK 15
16#define EBUSY 16
17#define EEXIST 17
18#define EXDEV 18
19#define ENODEV 19
20#define ENOTDIR 20
21#define EISDIR 21
22#define EINVAL 22
23#define ENFILE 23
24#define EMFILE 24
25#define ENOTTY 25
26#define ETXTBSY 26
27#define EFBIG 27
28#define ENOSPC 28
29#define ESPIPE 29
30#define EROFS 30
31#define EMLINK 31
32#define EPIPE 32
33#define EDOM 33
34#define ERANGE 34
35#define EDEADLK 35
36#define ENAMETOOLONG 36
37#define ENOLCK 37
38#define ENOSYS 38
39#define ENOTEMPTY 39
40#define ELOOP 40
41#define EWOULDBLOCK EAGAIN
42#define ENOMSG 42
43#define EIDRM 43
44#define ECHRNG 44
45#define EL2NSYNC 45
46#define EL3HLT 46
47#define EL3RST 47
48#define ELNRNG 48
49#define EUNATCH 49
50#define ENOCSI 50
51#define EL2HLT 51
52#define EBADE 52
53#define EBADR 53
54#define EXFULL 54
55#define ENOANO 55
56#define EBADRQC 56
57#define EBADSLT 57
58#define EDEADLOCK EDEADLK
59#define EBFONT 59
60#define ENOSTR 60
61#define ENODATA 61
62#define ETIME 62
63#define ENOSR 63
64#define ENONET 64
65#define ENOPKG 65
66#define EREMOTE 66
67#define ENOLINK 67
68#define EADV 68
69#define ESRMNT 69
70#define ECOMM 70
71#define EPROTO 71
72#define EMULTIHOP 72
73#define EDOTDOT 73
74#define EBADMSG 74
75#define EOVERFLOW 75
76#define ENOTUNIQ 76
77#define EBADFD 77
78#define EREMCHG 78
79#define ELIBACC 79
80#define ELIBBAD 80
81#define ELIBSCN 81
82#define ELIBMAX 82
83#define ELIBEXEC 83
84#define EILSEQ 84
85#define ERESTART 85
86#define ESTRPIPE 86
87#define EUSERS 87
88#define ENOTSOCK 88
89#define EDESTADDRREQ 89
90#define EMSGSIZE 90
91#define EPROTOTYPE 91
92#define ENOPROTOOPT 92
93#define EPROTONOSUPPORT 93
94#define ESOCKTNOSUPPORT 94
95#define EOPNOTSUPP 95
96#define ENOTSUP EOPNOTSUPP
97#define EPFNOSUPPORT 96
98#define EAFNOSUPPORT 97
99#define EADDRINUSE 98
100#define EADDRNOTAVAIL 99
101#define ENETDOWN 100
102#define ENETUNREACH 101
103#define ENETRESET 102
104#define ECONNABORTED 103
105#define ECONNRESET 104
106#define ENOBUFS 105
107#define EISCONN 106
108#define ENOTCONN 107
109#define ESHUTDOWN 108
110#define ETOOMANYREFS 109
111#define ETIMEDOUT 110
112#define ECONNREFUSED 111
113#define EHOSTDOWN 112
114#define EHOSTUNREACH 113
115#define EALREADY 114
116#define EINPROGRESS 115
117#define ESTALE 116
118#define EUCLEAN 117
119#define ENOTNAM 118
120#define ENAVAIL 119
121#define EISNAM 120
122#define EREMOTEIO 121
123#define EDQUOT 122
124#define ENOMEDIUM 123
125#define EMEDIUMTYPE 124
126#define ECANCELED 125
127#define ENOKEY 126
128#define EKEYEXPIRED 127
129#define EKEYREVOKED 128
130#define EKEYREJECTED 129
131#define EOWNERDEAD 130
132#define ENOTRECOVERABLE 131
133#define ERFKILL 132
134#define EHWPOISON 133
libc/musl/arch/generic/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0100
2#define O_EXCL 0200
3#define O_NOCTTY 0400
4#define O_TRUNC 01000
5#define O_APPEND 02000
6#define O_NONBLOCK 04000
7#define O_DSYNC 010000
8#define O_SYNC 04010000
9#define O_RSYNC 04010000
10#define O_DIRECTORY 0200000
11#define O_NOFOLLOW 0400000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 020000
15#define O_DIRECT 040000
16#define O_LARGEFILE 0100000
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020200000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_SETOWN 8
29#define F_GETOWN 9
30#define F_SETSIG 10
31#define F_GETSIG 11
32
33#define F_GETLK 12
34#define F_SETLK 13
35#define F_SETLKW 14
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/generic/bits/fenv.h created+10
...@@ -0,0 +1,10 @@
1#define FE_ALL_EXCEPT 0
2#define FE_TONEAREST 0
3
4typedef unsigned long fexcept_t;
5
6typedef struct {
7 unsigned long __cw;
8} fenv_t;
9
10#define FE_DFL_ENV ((const fenv_t *) -1)
libc/musl/arch/generic/bits/hwcap.h created
libc/musl/arch/generic/bits/io.h created
libc/musl/arch/generic/bits/ioctl.h created+206
...@@ -0,0 +1,206 @@
1#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
2#define _IOC_NONE 0U
3#define _IOC_WRITE 1U
4#define _IOC_READ 2U
5
6#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
7#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
8#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
9#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
10
11#define TCGETS 0x5401
12#define TCSETS 0x5402
13#define TCSETSW 0x5403
14#define TCSETSF 0x5404
15#define TCGETA 0x5405
16#define TCSETA 0x5406
17#define TCSETAW 0x5407
18#define TCSETAF 0x5408
19#define TCSBRK 0x5409
20#define TCXONC 0x540A
21#define TCFLSH 0x540B
22#define TIOCEXCL 0x540C
23#define TIOCNXCL 0x540D
24#define TIOCSCTTY 0x540E
25#define TIOCGPGRP 0x540F
26#define TIOCSPGRP 0x5410
27#define TIOCOUTQ 0x5411
28#define TIOCSTI 0x5412
29#define TIOCGWINSZ 0x5413
30#define TIOCSWINSZ 0x5414
31#define TIOCMGET 0x5415
32#define TIOCMBIS 0x5416
33#define TIOCMBIC 0x5417
34#define TIOCMSET 0x5418
35#define TIOCGSOFTCAR 0x5419
36#define TIOCSSOFTCAR 0x541A
37#define FIONREAD 0x541B
38#define TIOCINQ FIONREAD
39#define TIOCLINUX 0x541C
40#define TIOCCONS 0x541D
41#define TIOCGSERIAL 0x541E
42#define TIOCSSERIAL 0x541F
43#define TIOCPKT 0x5420
44#define FIONBIO 0x5421
45#define TIOCNOTTY 0x5422
46#define TIOCSETD 0x5423
47#define TIOCGETD 0x5424
48#define TCSBRKP 0x5425
49#define TIOCSBRK 0x5427
50#define TIOCCBRK 0x5428
51#define TIOCGSID 0x5429
52#define TIOCGRS485 0x542E
53#define TIOCSRS485 0x542F
54#define TIOCGPTN 0x80045430
55#define TIOCSPTLCK 0x40045431
56#define TIOCGDEV 0x80045432
57#define TCGETX 0x5432
58#define TCSETX 0x5433
59#define TCSETXF 0x5434
60#define TCSETXW 0x5435
61#define TIOCSIG 0x40045436
62#define TIOCVHANGUP 0x5437
63#define TIOCGPKT 0x80045438
64#define TIOCGPTLCK 0x80045439
65#define TIOCGEXCL 0x80045440
66#define TIOCGPTPEER 0x5441
67
68#define FIONCLEX 0x5450
69#define FIOCLEX 0x5451
70#define FIOASYNC 0x5452
71#define TIOCSERCONFIG 0x5453
72#define TIOCSERGWILD 0x5454
73#define TIOCSERSWILD 0x5455
74#define TIOCGLCKTRMIOS 0x5456
75#define TIOCSLCKTRMIOS 0x5457
76#define TIOCSERGSTRUCT 0x5458
77#define TIOCSERGETLSR 0x5459
78#define TIOCSERGETMULTI 0x545A
79#define TIOCSERSETMULTI 0x545B
80
81#define TIOCMIWAIT 0x545C
82#define TIOCGICOUNT 0x545D
83#define FIOQSIZE 0x5460
84
85#define TIOCPKT_DATA 0
86#define TIOCPKT_FLUSHREAD 1
87#define TIOCPKT_FLUSHWRITE 2
88#define TIOCPKT_STOP 4
89#define TIOCPKT_START 8
90#define TIOCPKT_NOSTOP 16
91#define TIOCPKT_DOSTOP 32
92#define TIOCPKT_IOCTL 64
93
94#define TIOCSER_TEMT 0x01
95
96struct winsize {
97 unsigned short ws_row;
98 unsigned short ws_col;
99 unsigned short ws_xpixel;
100 unsigned short ws_ypixel;
101};
102
103#define TIOCM_LE 0x001
104#define TIOCM_DTR 0x002
105#define TIOCM_RTS 0x004
106#define TIOCM_ST 0x008
107#define TIOCM_SR 0x010
108#define TIOCM_CTS 0x020
109#define TIOCM_CAR 0x040
110#define TIOCM_RNG 0x080
111#define TIOCM_DSR 0x100
112#define TIOCM_CD TIOCM_CAR
113#define TIOCM_RI TIOCM_RNG
114#define TIOCM_OUT1 0x2000
115#define TIOCM_OUT2 0x4000
116#define TIOCM_LOOP 0x8000
117
118#define N_TTY 0
119#define N_SLIP 1
120#define N_MOUSE 2
121#define N_PPP 3
122#define N_STRIP 4
123#define N_AX25 5
124#define N_X25 6
125#define N_6PACK 7
126#define N_MASC 8
127#define N_R3964 9
128#define N_PROFIBUS_FDL 10
129#define N_IRDA 11
130#define N_SMSBLOCK 12
131#define N_HDLC 13
132#define N_SYNC_PPP 14
133#define N_HCI 15
134
135#define FIOSETOWN 0x8901
136#define SIOCSPGRP 0x8902
137#define FIOGETOWN 0x8903
138#define SIOCGPGRP 0x8904
139#define SIOCATMARK 0x8905
140#define SIOCGSTAMP 0x8906
141#define SIOCGSTAMPNS 0x8907
142
143#define SIOCADDRT 0x890B
144#define SIOCDELRT 0x890C
145#define SIOCRTMSG 0x890D
146
147#define SIOCGIFNAME 0x8910
148#define SIOCSIFLINK 0x8911
149#define SIOCGIFCONF 0x8912
150#define SIOCGIFFLAGS 0x8913
151#define SIOCSIFFLAGS 0x8914
152#define SIOCGIFADDR 0x8915
153#define SIOCSIFADDR 0x8916
154#define SIOCGIFDSTADDR 0x8917
155#define SIOCSIFDSTADDR 0x8918
156#define SIOCGIFBRDADDR 0x8919
157#define SIOCSIFBRDADDR 0x891a
158#define SIOCGIFNETMASK 0x891b
159#define SIOCSIFNETMASK 0x891c
160#define SIOCGIFMETRIC 0x891d
161#define SIOCSIFMETRIC 0x891e
162#define SIOCGIFMEM 0x891f
163#define SIOCSIFMEM 0x8920
164#define SIOCGIFMTU 0x8921
165#define SIOCSIFMTU 0x8922
166#define SIOCSIFNAME 0x8923
167#define SIOCSIFHWADDR 0x8924
168#define SIOCGIFENCAP 0x8925
169#define SIOCSIFENCAP 0x8926
170#define SIOCGIFHWADDR 0x8927
171#define SIOCGIFSLAVE 0x8929
172#define SIOCSIFSLAVE 0x8930
173#define SIOCADDMULTI 0x8931
174#define SIOCDELMULTI 0x8932
175#define SIOCGIFINDEX 0x8933
176#define SIOGIFINDEX SIOCGIFINDEX
177#define SIOCSIFPFLAGS 0x8934
178#define SIOCGIFPFLAGS 0x8935
179#define SIOCDIFADDR 0x8936
180#define SIOCSIFHWBROADCAST 0x8937
181#define SIOCGIFCOUNT 0x8938
182
183#define SIOCGIFBR 0x8940
184#define SIOCSIFBR 0x8941
185
186#define SIOCGIFTXQLEN 0x8942
187#define SIOCSIFTXQLEN 0x8943
188
189#define SIOCDARP 0x8953
190#define SIOCGARP 0x8954
191#define SIOCSARP 0x8955
192
193#define SIOCDRARP 0x8960
194#define SIOCGRARP 0x8961
195#define SIOCSRARP 0x8962
196
197#define SIOCGIFMAP 0x8970
198#define SIOCSIFMAP 0x8971
199
200#define SIOCADDDLCI 0x8980
201#define SIOCDELDLCI 0x8981
202
203#define SIOCDEVPRIVATE 0x89F0
204#define SIOCPROTOPRIVATE 0x89E0
205
206#include <bits/ioctl_fix.h>
libc/musl/arch/generic/bits/ioctl_fix.h created
libc/musl/arch/generic/bits/ipc.h created+13
...@@ -0,0 +1,13 @@
1struct ipc_perm {
2 key_t __ipc_perm_key;
3 uid_t uid;
4 gid_t gid;
5 uid_t cuid;
6 gid_t cgid;
7 mode_t mode;
8 int __ipc_perm_seq;
9 long __pad1;
10 long __pad2;
11};
12
13#define IPC_64 0x100
libc/musl/arch/generic/bits/kd.h created+1
...@@ -0,0 +1 @@
1#include <linux/kd.h>
libc/musl/arch/generic/bits/link.h created+1
...@@ -0,0 +1 @@
1typedef uint32_t Elf_Symndx;
libc/musl/arch/generic/bits/mman.h created
libc/musl/arch/generic/bits/msg.h created+15
...@@ -0,0 +1,15 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 time_t msg_stime;
4 int __unused1;
5 time_t msg_rtime;
6 int __unused2;
7 time_t msg_ctime;
8 int __unused3;
9 unsigned long msg_cbytes;
10 msgqnum_t msg_qnum;
11 msglen_t msg_qbytes;
12 pid_t msg_lspid;
13 pid_t msg_lrpid;
14 unsigned long __unused[2];
15};
libc/musl/arch/generic/bits/poll.h created
libc/musl/arch/generic/bits/ptrace.h created
libc/musl/arch/generic/bits/resource.h created
libc/musl/arch/generic/bits/sem.h created+16
...@@ -0,0 +1,16 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 time_t sem_otime;
4 time_t __unused1;
5 time_t sem_ctime;
6 time_t __unused2;
7#if __BYTE_ORDER == __LITTLE_ENDIAN
8 unsigned short sem_nsems;
9 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
10#else
11 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
12 unsigned short sem_nsems;
13#endif
14 time_t __unused3;
15 time_t __unused4;
16};
libc/musl/arch/generic/bits/shm.h created+28
...@@ -0,0 +1,28 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 time_t shm_atime;
7 int __unused1;
8 time_t shm_dtime;
9 int __unused2;
10 time_t shm_ctime;
11 int __unused3;
12 pid_t shm_cpid;
13 pid_t shm_lpid;
14 unsigned long shm_nattch;
15 unsigned long __pad1;
16 unsigned long __pad2;
17};
18
19struct shminfo {
20 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
21};
22
23struct shm_info {
24 int __used_ids;
25 unsigned long shm_tot, shm_rss, shm_swp;
26 unsigned long __swap_attempts, __swap_successes;
27};
28
libc/musl/arch/generic/bits/socket.h created+15
...@@ -0,0 +1,15 @@
1struct msghdr {
2 void *msg_name;
3 socklen_t msg_namelen;
4 struct iovec *msg_iov;
5 int msg_iovlen;
6 void *msg_control;
7 socklen_t msg_controllen;
8 int msg_flags;
9};
10
11struct cmsghdr {
12 socklen_t cmsg_len;
13 int cmsg_level;
14 int cmsg_type;
15};
libc/musl/arch/generic/bits/soundcard.h created+1
...@@ -0,0 +1 @@
1#include <linux/soundcard.h>
libc/musl/arch/generic/bits/statfs.h created+7
...@@ -0,0 +1,7 @@
1struct statfs {
2 unsigned long f_type, f_bsize;
3 fsblkcnt_t f_blocks, f_bfree, f_bavail;
4 fsfilcnt_t f_files, f_ffree;
5 fsid_t f_fsid;
6 unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
7};
libc/musl/arch/generic/bits/termios.h created+166
...@@ -0,0 +1,166 @@
1struct termios {
2 tcflag_t c_iflag;
3 tcflag_t c_oflag;
4 tcflag_t c_cflag;
5 tcflag_t c_lflag;
6 cc_t c_line;
7 cc_t c_cc[NCCS];
8 speed_t __c_ispeed;
9 speed_t __c_ospeed;
10};
11
12#define VINTR 0
13#define VQUIT 1
14#define VERASE 2
15#define VKILL 3
16#define VEOF 4
17#define VTIME 5
18#define VMIN 6
19#define VSWTC 7
20#define VSTART 8
21#define VSTOP 9
22#define VSUSP 10
23#define VEOL 11
24#define VREPRINT 12
25#define VDISCARD 13
26#define VWERASE 14
27#define VLNEXT 15
28#define VEOL2 16
29
30#define IGNBRK 0000001
31#define BRKINT 0000002
32#define IGNPAR 0000004
33#define PARMRK 0000010
34#define INPCK 0000020
35#define ISTRIP 0000040
36#define INLCR 0000100
37#define IGNCR 0000200
38#define ICRNL 0000400
39#define IUCLC 0001000
40#define IXON 0002000
41#define IXANY 0004000
42#define IXOFF 0010000
43#define IMAXBEL 0020000
44#define IUTF8 0040000
45
46#define OPOST 0000001
47#define OLCUC 0000002
48#define ONLCR 0000004
49#define OCRNL 0000010
50#define ONOCR 0000020
51#define ONLRET 0000040
52#define OFILL 0000100
53#define OFDEL 0000200
54#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
55#define NLDLY 0000400
56#define NL0 0000000
57#define NL1 0000400
58#define CRDLY 0003000
59#define CR0 0000000
60#define CR1 0001000
61#define CR2 0002000
62#define CR3 0003000
63#define TABDLY 0014000
64#define TAB0 0000000
65#define TAB1 0004000
66#define TAB2 0010000
67#define TAB3 0014000
68#define BSDLY 0020000
69#define BS0 0000000
70#define BS1 0020000
71#define FFDLY 0100000
72#define FF0 0000000
73#define FF1 0100000
74#endif
75
76#define VTDLY 0040000
77#define VT0 0000000
78#define VT1 0040000
79
80#define B0 0000000
81#define B50 0000001
82#define B75 0000002
83#define B110 0000003
84#define B134 0000004
85#define B150 0000005
86#define B200 0000006
87#define B300 0000007
88#define B600 0000010
89#define B1200 0000011
90#define B1800 0000012
91#define B2400 0000013
92#define B4800 0000014
93#define B9600 0000015
94#define B19200 0000016
95#define B38400 0000017
96
97#define B57600 0010001
98#define B115200 0010002
99#define B230400 0010003
100#define B460800 0010004
101#define B500000 0010005
102#define B576000 0010006
103#define B921600 0010007
104#define B1000000 0010010
105#define B1152000 0010011
106#define B1500000 0010012
107#define B2000000 0010013
108#define B2500000 0010014
109#define B3000000 0010015
110#define B3500000 0010016
111#define B4000000 0010017
112
113#define CSIZE 0000060
114#define CS5 0000000
115#define CS6 0000020
116#define CS7 0000040
117#define CS8 0000060
118#define CSTOPB 0000100
119#define CREAD 0000200
120#define PARENB 0000400
121#define PARODD 0001000
122#define HUPCL 0002000
123#define CLOCAL 0004000
124
125#define ISIG 0000001
126#define ICANON 0000002
127#define ECHO 0000010
128#define ECHOE 0000020
129#define ECHOK 0000040
130#define ECHONL 0000100
131#define NOFLSH 0000200
132#define TOSTOP 0000400
133#define IEXTEN 0100000
134
135#define TCOOFF 0
136#define TCOON 1
137#define TCIOFF 2
138#define TCION 3
139
140#define TCIFLUSH 0
141#define TCOFLUSH 1
142#define TCIOFLUSH 2
143
144#define TCSANOW 0
145#define TCSADRAIN 1
146#define TCSAFLUSH 2
147
148#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
149#define EXTA 0000016
150#define EXTB 0000017
151#define CBAUD 0010017
152#define CBAUDEX 0010000
153#define CIBAUD 002003600000
154#define CMSPAR 010000000000
155#define CRTSCTS 020000000000
156
157#define XCASE 0000004
158#define ECHOCTL 0001000
159#define ECHOPRT 0002000
160#define ECHOKE 0004000
161#define FLUSHO 0010000
162#define PENDIN 0040000
163#define EXTPROC 0200000
164
165#define XTABS 0014000
166#endif
libc/musl/arch/generic/bits/vt.h created+1
...@@ -0,0 +1 @@
1#include <linux/vt.h>
libc/musl/arch/i386/atomic_arch.h created+108
...@@ -0,0 +1,108 @@
1#define a_cas a_cas
2static inline int a_cas(volatile int *p, int t, int s)
3{
4 __asm__ __volatile__ (
5 "lock ; cmpxchg %3, %1"
6 : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
7 return t;
8}
9
10#define a_swap a_swap
11static inline int a_swap(volatile int *p, int v)
12{
13 __asm__ __volatile__(
14 "xchg %0, %1"
15 : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
16 return v;
17}
18
19#define a_fetch_add a_fetch_add
20static inline int a_fetch_add(volatile int *p, int v)
21{
22 __asm__ __volatile__(
23 "lock ; xadd %0, %1"
24 : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
25 return v;
26}
27
28#define a_and a_and
29static inline void a_and(volatile int *p, int v)
30{
31 __asm__ __volatile__(
32 "lock ; and %1, %0"
33 : "=m"(*p) : "r"(v) : "memory" );
34}
35
36#define a_or a_or
37static inline void a_or(volatile int *p, int v)
38{
39 __asm__ __volatile__(
40 "lock ; or %1, %0"
41 : "=m"(*p) : "r"(v) : "memory" );
42}
43
44#define a_inc a_inc
45static inline void a_inc(volatile int *p)
46{
47 __asm__ __volatile__(
48 "lock ; incl %0"
49 : "=m"(*p) : "m"(*p) : "memory" );
50}
51
52#define a_dec a_dec
53static inline void a_dec(volatile int *p)
54{
55 __asm__ __volatile__(
56 "lock ; decl %0"
57 : "=m"(*p) : "m"(*p) : "memory" );
58}
59
60#define a_store a_store
61static inline void a_store(volatile int *p, int x)
62{
63 __asm__ __volatile__(
64 "mov %1, %0 ; lock ; orl $0,(%%esp)"
65 : "=m"(*p) : "r"(x) : "memory" );
66}
67
68#define a_barrier a_barrier
69static inline void a_barrier()
70{
71 __asm__ __volatile__( "" : : : "memory" );
72}
73
74#define a_spin a_spin
75static inline void a_spin()
76{
77 __asm__ __volatile__( "pause" : : : "memory" );
78}
79
80#define a_crash a_crash
81static inline void a_crash()
82{
83 __asm__ __volatile__( "hlt" : : : "memory" );
84}
85
86#define a_ctz_64 a_ctz_64
87static inline int a_ctz_64(uint64_t x)
88{
89 int r;
90 __asm__( "bsf %1,%0 ; jnz 1f ; bsf %2,%0 ; add $32,%0\n1:"
91 : "=&r"(r) : "r"((unsigned)x), "r"((unsigned)(x>>32)) );
92 return r;
93}
94
95#define a_ctz_32 a_ctz_32
96static inline int a_ctz_32(uint32_t x)
97{
98 int r;
99 __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
100 return r;
101}
102
103#define a_clz_32 a_clz_32
104static inline int a_clz_32(uint32_t x)
105{
106 __asm__( "bsr %1,%0 ; xor $31,%0" : "=r"(x) : "r"(x) );
107 return x;
108}
libc/musl/arch/i386/bits/alltypes.h.in created+46
...@@ -0,0 +1,46 @@
1#define _Addr int
2#define _Int64 long long
3#define _Reg int
4
5#if __GNUC__ >= 3
6TYPEDEF __builtin_va_list va_list;
7TYPEDEF __builtin_va_list __isoc_va_list;
8#else
9TYPEDEF struct __va_list * va_list;
10TYPEDEF struct __va_list * __isoc_va_list;
11#endif
12
13#ifndef __cplusplus
14#ifdef __WCHAR_TYPE__
15TYPEDEF __WCHAR_TYPE__ wchar_t;
16#else
17TYPEDEF long wchar_t;
18#endif
19#endif
20
21#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 0
22TYPEDEF float float_t;
23TYPEDEF double double_t;
24#else
25TYPEDEF long double float_t;
26TYPEDEF long double double_t;
27#endif
28
29#if !defined(__cplusplus)
30TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
31#elif defined(__GNUC__)
32TYPEDEF struct { __attribute__((__aligned__(8))) long long __ll; long double __ld; } max_align_t;
33#else
34TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t;
35#endif
36
37TYPEDEF long time_t;
38TYPEDEF long suseconds_t;
39
40TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
41TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
42TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
43TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
44TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
45TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
46TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
libc/musl/arch/i386/bits/endian.h created+1
...@@ -0,0 +1 @@
1#define __BYTE_ORDER __LITTLE_ENDIAN
libc/musl/arch/i386/bits/fenv.h created+33
...@@ -0,0 +1,33 @@
1#define FE_INVALID 1
2#define __FE_DENORM 2
3#define FE_DIVBYZERO 4
4#define FE_OVERFLOW 8
5#define FE_UNDERFLOW 16
6#define FE_INEXACT 32
7
8#define FE_ALL_EXCEPT 63
9
10#define FE_TONEAREST 0
11#define FE_DOWNWARD 0x400
12#define FE_UPWARD 0x800
13#define FE_TOWARDZERO 0xc00
14
15typedef unsigned short fexcept_t;
16
17typedef struct {
18 unsigned short __control_word;
19 unsigned short __unused1;
20 unsigned short __status_word;
21 unsigned short __unused2;
22 unsigned short __tags;
23 unsigned short __unused3;
24 unsigned int __eip;
25 unsigned short __cs_selector;
26 unsigned int __opcode:11;
27 unsigned int __unused4:5;
28 unsigned int __data_offset;
29 unsigned short __data_selector;
30 unsigned short __unused5;
31} fenv_t;
32
33#define FE_DFL_ENV ((const fenv_t *) -1)
libc/musl/arch/i386/bits/float.h created+20
...@@ -0,0 +1,20 @@
1#ifdef __FLT_EVAL_METHOD__
2#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
3#else
4#define FLT_EVAL_METHOD 2
5#endif
6
7#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
8#define LDBL_MIN 3.3621031431120935063e-4932L
9#define LDBL_MAX 1.1897314953572317650e+4932L
10#define LDBL_EPSILON 1.0842021724855044340e-19L
11
12#define LDBL_MANT_DIG 64
13#define LDBL_MIN_EXP (-16381)
14#define LDBL_MAX_EXP 16384
15
16#define LDBL_DIG 18
17#define LDBL_MIN_10_EXP (-4931)
18#define LDBL_MAX_10_EXP 4932
19
20#define DECIMAL_DIG 21
libc/musl/arch/i386/bits/io.h created+77
...@@ -0,0 +1,77 @@
1static __inline void outb(unsigned char __val, unsigned short __port)
2{
3 __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
4}
5
6static __inline void outw(unsigned short __val, unsigned short __port)
7{
8 __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
9}
10
11static __inline void outl(unsigned int __val, unsigned short __port)
12{
13 __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
14}
15
16static __inline unsigned char inb(unsigned short __port)
17{
18 unsigned char __val;
19 __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
20 return __val;
21}
22
23static __inline unsigned short inw(unsigned short __port)
24{
25 unsigned short __val;
26 __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
27 return __val;
28}
29
30static __inline unsigned int inl(unsigned short __port)
31{
32 unsigned int __val;
33 __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
34 return __val;
35}
36
37static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
38{
39 __asm__ volatile ("cld; rep; outsb"
40 : "+S" (__buf), "+c" (__n)
41 : "d" (__port));
42}
43
44static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
45{
46 __asm__ volatile ("cld; rep; outsw"
47 : "+S" (__buf), "+c" (__n)
48 : "d" (__port));
49}
50
51static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
52{
53 __asm__ volatile ("cld; rep; outsl"
54 : "+S" (__buf), "+c"(__n)
55 : "d" (__port));
56}
57
58static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
59{
60 __asm__ volatile ("cld; rep; insb"
61 : "+D" (__buf), "+c" (__n)
62 : "d" (__port));
63}
64
65static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
66{
67 __asm__ volatile ("cld; rep; insw"
68 : "+D" (__buf), "+c" (__n)
69 : "d" (__port));
70}
71
72static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
73{
74 __asm__ volatile ("cld; rep; insl"
75 : "+D" (__buf), "+c" (__n)
76 : "d" (__port));
77}
libc/musl/arch/i386/bits/limits.h created+8
...@@ -0,0 +1,8 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define PAGESIZE 4096
4#define LONG_BIT 32
5#endif
6
7#define LONG_MAX 0x7fffffffL
8#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/i386/bits/mman.h created+1
...@@ -0,0 +1 @@
1#define MAP_32BIT 0x40
libc/musl/arch/i386/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_ILP32_OFFBIG 1
2#define _POSIX_V7_ILP32_OFFBIG 1
libc/musl/arch/i386/bits/ptrace.h created+11
...@@ -0,0 +1,11 @@
1#define PTRACE_GET_THREAD_AREA 25
2#define PTRACE_SET_THREAD_AREA 26
3#define PTRACE_SYSEMU 31
4#define PTRACE_SYSEMU_SINGLESTEP 32
5#define PTRACE_SINGLEBLOCK 33
6
7#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
8#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
9#define PT_SYSEMU PTRACE_SYSEMU
10#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
11#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
libc/musl/arch/i386/bits/reg.h created+19
...@@ -0,0 +1,19 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3#define EBX 0
4#define ECX 1
5#define EDX 2
6#define ESI 3
7#define EDI 4
8#define EBP 5
9#define EAX 6
10#define DS 7
11#define ES 8
12#define FS 9
13#define GS 10
14#define ORIG_EAX 11
15#define EIP 12
16#define CS 13
17#define EFL 14
18#define UESP 15
19#define SS 16
libc/musl/arch/i386/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[6];
libc/musl/arch/i386/bits/signal.h created+142
...@@ -0,0 +1,142 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 2048
6#define SIGSTKSZ 8192
7#endif
8
9#ifdef _GNU_SOURCE
10enum { REG_GS = 0 };
11#define REG_GS REG_GS
12enum { REG_FS = 1 };
13#define REG_FS REG_FS
14enum { REG_ES = 2 };
15#define REG_ES REG_ES
16enum { REG_DS = 3 };
17#define REG_DS REG_DS
18enum { REG_EDI = 4 };
19#define REG_EDI REG_EDI
20enum { REG_ESI = 5 };
21#define REG_ESI REG_ESI
22enum { REG_EBP = 6 };
23#define REG_EBP REG_EBP
24enum { REG_ESP = 7 };
25#define REG_ESP REG_ESP
26enum { REG_EBX = 8 };
27#define REG_EBX REG_EBX
28enum { REG_EDX = 9 };
29#define REG_EDX REG_EDX
30enum { REG_ECX = 10 };
31#define REG_ECX REG_ECX
32enum { REG_EAX = 11 };
33#define REG_EAX REG_EAX
34enum { REG_TRAPNO = 12 };
35#define REG_TRAPNO REG_TRAPNO
36enum { REG_ERR = 13 };
37#define REG_ERR REG_ERR
38enum { REG_EIP = 14 };
39#define REG_EIP REG_EIP
40enum { REG_CS = 15 };
41#define REG_CS REG_CS
42enum { REG_EFL = 16 };
43#define REG_EFL REG_EFL
44enum { REG_UESP = 17 };
45#define REG_UESP REG_UESP
46enum { REG_SS = 18 };
47#define REG_SS REG_SS
48#endif
49
50#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
51typedef int greg_t, gregset_t[19];
52typedef struct _fpstate {
53 unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel;
54 struct {
55 unsigned short significand[4], exponent;
56 } _st[8];
57 unsigned long status;
58} *fpregset_t;
59struct sigcontext {
60 unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
61 unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
62 unsigned long trapno, err, eip;
63 unsigned short cs, __csh;
64 unsigned long eflags, esp_at_signal;
65 unsigned short ss, __ssh;
66 struct _fpstate *fpstate;
67 unsigned long oldmask, cr2;
68};
69typedef struct {
70 gregset_t gregs;
71 fpregset_t fpregs;
72 unsigned long oldmask, cr2;
73} mcontext_t;
74#else
75typedef struct {
76 unsigned __space[22];
77} mcontext_t;
78#endif
79
80struct sigaltstack {
81 void *ss_sp;
82 int ss_flags;
83 size_t ss_size;
84};
85
86typedef struct __ucontext {
87 unsigned long uc_flags;
88 struct __ucontext *uc_link;
89 stack_t uc_stack;
90 mcontext_t uc_mcontext;
91 sigset_t uc_sigmask;
92 unsigned long __fpregs_mem[28];
93} ucontext_t;
94
95#define SA_NOCLDSTOP 1
96#define SA_NOCLDWAIT 2
97#define SA_SIGINFO 4
98#define SA_ONSTACK 0x08000000
99#define SA_RESTART 0x10000000
100#define SA_NODEFER 0x40000000
101#define SA_RESETHAND 0x80000000
102#define SA_RESTORER 0x04000000
103
104#endif
105
106#define SIGHUP 1
107#define SIGINT 2
108#define SIGQUIT 3
109#define SIGILL 4
110#define SIGTRAP 5
111#define SIGABRT 6
112#define SIGIOT SIGABRT
113#define SIGBUS 7
114#define SIGFPE 8
115#define SIGKILL 9
116#define SIGUSR1 10
117#define SIGSEGV 11
118#define SIGUSR2 12
119#define SIGPIPE 13
120#define SIGALRM 14
121#define SIGTERM 15
122#define SIGSTKFLT 16
123#define SIGCHLD 17
124#define SIGCONT 18
125#define SIGSTOP 19
126#define SIGTSTP 20
127#define SIGTTIN 21
128#define SIGTTOU 22
129#define SIGURG 23
130#define SIGXCPU 24
131#define SIGXFSZ 25
132#define SIGVTALRM 26
133#define SIGPROF 27
134#define SIGWINCH 28
135#define SIGIO 29
136#define SIGPOLL 29
137#define SIGPWR 30
138#define SIGSYS 31
139#define SIGUNUSED SIGSYS
140
141#define _NSIG 65
142
libc/musl/arch/i386/bits/stat.h created+21
...@@ -0,0 +1,21 @@
1/* copied from kernel definition, but with padding replaced
2 * by the corresponding correctly-sized userspace types. */
3
4struct stat {
5 dev_t st_dev;
6 int __st_dev_padding;
7 long __st_ino_truncated;
8 mode_t st_mode;
9 nlink_t st_nlink;
10 uid_t st_uid;
11 gid_t st_gid;
12 dev_t st_rdev;
13 int __st_rdev_padding;
14 off_t st_size;
15 blksize_t st_blksize;
16 blkcnt_t st_blocks;
17 struct timespec st_atim;
18 struct timespec st_mtim;
19 struct timespec st_ctim;
20 ino_t st_ino;
21};
libc/musl/arch/i386/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT32_MIN
16#define INTPTR_MAX INT32_MAX
17#define UINTPTR_MAX UINT32_MAX
18#define PTRDIFF_MIN INT32_MIN
19#define PTRDIFF_MAX INT32_MAX
20#define SIZE_MAX UINT32_MAX
libc/musl/arch/i386/bits/syscall.h.in created+387
...@@ -0,0 +1,387 @@
1#define __NR_restart_syscall 0
2#define __NR_exit 1
3#define __NR_fork 2
4#define __NR_read 3
5#define __NR_write 4
6#define __NR_open 5
7#define __NR_close 6
8#define __NR_waitpid 7
9#define __NR_creat 8
10#define __NR_link 9
11#define __NR_unlink 10
12#define __NR_execve 11
13#define __NR_chdir 12
14#define __NR_time 13
15#define __NR_mknod 14
16#define __NR_chmod 15
17#define __NR_lchown 16
18#define __NR_break 17
19#define __NR_oldstat 18
20#define __NR_lseek 19
21#define __NR_getpid 20
22#define __NR_mount 21
23#define __NR_umount 22
24#define __NR_setuid 23
25#define __NR_getuid 24
26#define __NR_stime 25
27#define __NR_ptrace 26
28#define __NR_alarm 27
29#define __NR_oldfstat 28
30#define __NR_pause 29
31#define __NR_utime 30
32#define __NR_stty 31
33#define __NR_gtty 32
34#define __NR_access 33
35#define __NR_nice 34
36#define __NR_ftime 35
37#define __NR_sync 36
38#define __NR_kill 37
39#define __NR_rename 38
40#define __NR_mkdir 39
41#define __NR_rmdir 40
42#define __NR_dup 41
43#define __NR_pipe 42
44#define __NR_times 43
45#define __NR_prof 44
46#define __NR_brk 45
47#define __NR_setgid 46
48#define __NR_getgid 47
49#define __NR_signal 48
50#define __NR_geteuid 49
51#define __NR_getegid 50
52#define __NR_acct 51
53#define __NR_umount2 52
54#define __NR_lock 53
55#define __NR_ioctl 54
56#define __NR_fcntl 55
57#define __NR_mpx 56
58#define __NR_setpgid 57
59#define __NR_ulimit 58
60#define __NR_oldolduname 59
61#define __NR_umask 60
62#define __NR_chroot 61
63#define __NR_ustat 62
64#define __NR_dup2 63
65#define __NR_getppid 64
66#define __NR_getpgrp 65
67#define __NR_setsid 66
68#define __NR_sigaction 67
69#define __NR_sgetmask 68
70#define __NR_ssetmask 69
71#define __NR_setreuid 70
72#define __NR_setregid 71
73#define __NR_sigsuspend 72
74#define __NR_sigpending 73
75#define __NR_sethostname 74
76#define __NR_setrlimit 75
77#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
78#define __NR_getrusage 77
79#define __NR_gettimeofday 78
80#define __NR_settimeofday 79
81#define __NR_getgroups 80
82#define __NR_setgroups 81
83#define __NR_select 82
84#define __NR_symlink 83
85#define __NR_oldlstat 84
86#define __NR_readlink 85
87#define __NR_uselib 86
88#define __NR_swapon 87
89#define __NR_reboot 88
90#define __NR_readdir 89
91#define __NR_mmap 90
92#define __NR_munmap 91
93#define __NR_truncate 92
94#define __NR_ftruncate 93
95#define __NR_fchmod 94
96#define __NR_fchown 95
97#define __NR_getpriority 96
98#define __NR_setpriority 97
99#define __NR_profil 98
100#define __NR_statfs 99
101#define __NR_fstatfs 100
102#define __NR_ioperm 101
103#define __NR_socketcall 102
104#define __NR_syslog 103
105#define __NR_setitimer 104
106#define __NR_getitimer 105
107#define __NR_stat 106
108#define __NR_lstat 107
109#define __NR_fstat 108
110#define __NR_olduname 109
111#define __NR_iopl 110
112#define __NR_vhangup 111
113#define __NR_idle 112
114#define __NR_vm86old 113
115#define __NR_wait4 114
116#define __NR_swapoff 115
117#define __NR_sysinfo 116
118#define __NR_ipc 117
119#define __NR_fsync 118
120#define __NR_sigreturn 119
121#define __NR_clone 120
122#define __NR_setdomainname 121
123#define __NR_uname 122
124#define __NR_modify_ldt 123
125#define __NR_adjtimex 124
126#define __NR_mprotect 125
127#define __NR_sigprocmask 126
128#define __NR_create_module 127
129#define __NR_init_module 128
130#define __NR_delete_module 129
131#define __NR_get_kernel_syms 130
132#define __NR_quotactl 131
133#define __NR_getpgid 132
134#define __NR_fchdir 133
135#define __NR_bdflush 134
136#define __NR_sysfs 135
137#define __NR_personality 136
138#define __NR_afs_syscall 137
139#define __NR_setfsuid 138
140#define __NR_setfsgid 139
141#define __NR__llseek 140
142#define __NR_getdents 141
143#define __NR__newselect 142
144#define __NR_flock 143
145#define __NR_msync 144
146#define __NR_readv 145
147#define __NR_writev 146
148#define __NR_getsid 147
149#define __NR_fdatasync 148
150#define __NR__sysctl 149
151#define __NR_mlock 150
152#define __NR_munlock 151
153#define __NR_mlockall 152
154#define __NR_munlockall 153
155#define __NR_sched_setparam 154
156#define __NR_sched_getparam 155
157#define __NR_sched_setscheduler 156
158#define __NR_sched_getscheduler 157
159#define __NR_sched_yield 158
160#define __NR_sched_get_priority_max 159
161#define __NR_sched_get_priority_min 160
162#define __NR_sched_rr_get_interval 161
163#define __NR_nanosleep 162
164#define __NR_mremap 163
165#define __NR_setresuid 164
166#define __NR_getresuid 165
167#define __NR_vm86 166
168#define __NR_query_module 167
169#define __NR_poll 168
170#define __NR_nfsservctl 169
171#define __NR_setresgid 170
172#define __NR_getresgid 171
173#define __NR_prctl 172
174#define __NR_rt_sigreturn 173
175#define __NR_rt_sigaction 174
176#define __NR_rt_sigprocmask 175
177#define __NR_rt_sigpending 176
178#define __NR_rt_sigtimedwait 177
179#define __NR_rt_sigqueueinfo 178
180#define __NR_rt_sigsuspend 179
181#define __NR_pread64 180
182#define __NR_pwrite64 181
183#define __NR_chown 182
184#define __NR_getcwd 183
185#define __NR_capget 184
186#define __NR_capset 185
187#define __NR_sigaltstack 186
188#define __NR_sendfile 187
189#define __NR_getpmsg 188
190#define __NR_putpmsg 189
191#define __NR_vfork 190
192#define __NR_ugetrlimit 191
193#define __NR_mmap2 192
194#define __NR_truncate64 193
195#define __NR_ftruncate64 194
196#define __NR_stat64 195
197#define __NR_lstat64 196
198#define __NR_fstat64 197
199#define __NR_lchown32 198
200#define __NR_getuid32 199
201#define __NR_getgid32 200
202#define __NR_geteuid32 201
203#define __NR_getegid32 202
204#define __NR_setreuid32 203
205#define __NR_setregid32 204
206#define __NR_getgroups32 205
207#define __NR_setgroups32 206
208#define __NR_fchown32 207
209#define __NR_setresuid32 208
210#define __NR_getresuid32 209
211#define __NR_setresgid32 210
212#define __NR_getresgid32 211
213#define __NR_chown32 212
214#define __NR_setuid32 213
215#define __NR_setgid32 214
216#define __NR_setfsuid32 215
217#define __NR_setfsgid32 216
218#define __NR_pivot_root 217
219#define __NR_mincore 218
220#define __NR_madvise 219
221#define __NR_getdents64 220
222#define __NR_fcntl64 221
223/* 223 is unused */
224#define __NR_gettid 224
225#define __NR_readahead 225
226#define __NR_setxattr 226
227#define __NR_lsetxattr 227
228#define __NR_fsetxattr 228
229#define __NR_getxattr 229
230#define __NR_lgetxattr 230
231#define __NR_fgetxattr 231
232#define __NR_listxattr 232
233#define __NR_llistxattr 233
234#define __NR_flistxattr 234
235#define __NR_removexattr 235
236#define __NR_lremovexattr 236
237#define __NR_fremovexattr 237
238#define __NR_tkill 238
239#define __NR_sendfile64 239
240#define __NR_futex 240
241#define __NR_sched_setaffinity 241
242#define __NR_sched_getaffinity 242
243#define __NR_set_thread_area 243
244#define __NR_get_thread_area 244
245#define __NR_io_setup 245
246#define __NR_io_destroy 246
247#define __NR_io_getevents 247
248#define __NR_io_submit 248
249#define __NR_io_cancel 249
250#define __NR_fadvise64 250
251/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
252#define __NR_exit_group 252
253#define __NR_lookup_dcookie 253
254#define __NR_epoll_create 254
255#define __NR_epoll_ctl 255
256#define __NR_epoll_wait 256
257#define __NR_remap_file_pages 257
258#define __NR_set_tid_address 258
259#define __NR_timer_create 259
260#define __NR_timer_settime (__NR_timer_create+1)
261#define __NR_timer_gettime (__NR_timer_create+2)
262#define __NR_timer_getoverrun (__NR_timer_create+3)
263#define __NR_timer_delete (__NR_timer_create+4)
264#define __NR_clock_settime (__NR_timer_create+5)
265#define __NR_clock_gettime (__NR_timer_create+6)
266#define __NR_clock_getres (__NR_timer_create+7)
267#define __NR_clock_nanosleep (__NR_timer_create+8)
268#define __NR_statfs64 268
269#define __NR_fstatfs64 269
270#define __NR_tgkill 270
271#define __NR_utimes 271
272#define __NR_fadvise64_64 272
273#define __NR_vserver 273
274#define __NR_mbind 274
275#define __NR_get_mempolicy 275
276#define __NR_set_mempolicy 276
277#define __NR_mq_open 277
278#define __NR_mq_unlink (__NR_mq_open+1)
279#define __NR_mq_timedsend (__NR_mq_open+2)
280#define __NR_mq_timedreceive (__NR_mq_open+3)
281#define __NR_mq_notify (__NR_mq_open+4)
282#define __NR_mq_getsetattr (__NR_mq_open+5)
283#define __NR_kexec_load 283
284#define __NR_waitid 284
285/* #define __NR_sys_setaltroot 285 */
286#define __NR_add_key 286
287#define __NR_request_key 287
288#define __NR_keyctl 288
289#define __NR_ioprio_set 289
290#define __NR_ioprio_get 290
291#define __NR_inotify_init 291
292#define __NR_inotify_add_watch 292
293#define __NR_inotify_rm_watch 293
294#define __NR_migrate_pages 294
295#define __NR_openat 295
296#define __NR_mkdirat 296
297#define __NR_mknodat 297
298#define __NR_fchownat 298
299#define __NR_futimesat 299
300#define __NR_fstatat64 300
301#define __NR_unlinkat 301
302#define __NR_renameat 302
303#define __NR_linkat 303
304#define __NR_symlinkat 304
305#define __NR_readlinkat 305
306#define __NR_fchmodat 306
307#define __NR_faccessat 307
308#define __NR_pselect6 308
309#define __NR_ppoll 309
310#define __NR_unshare 310
311#define __NR_set_robust_list 311
312#define __NR_get_robust_list 312
313#define __NR_splice 313
314#define __NR_sync_file_range 314
315#define __NR_tee 315
316#define __NR_vmsplice 316
317#define __NR_move_pages 317
318#define __NR_getcpu 318
319#define __NR_epoll_pwait 319
320#define __NR_utimensat 320
321#define __NR_signalfd 321
322#define __NR_timerfd_create 322
323#define __NR_eventfd 323
324#define __NR_fallocate 324
325#define __NR_timerfd_settime 325
326#define __NR_timerfd_gettime 326
327#define __NR_signalfd4 327
328#define __NR_eventfd2 328
329#define __NR_epoll_create1 329
330#define __NR_dup3 330
331#define __NR_pipe2 331
332#define __NR_inotify_init1 332
333#define __NR_preadv 333
334#define __NR_pwritev 334
335#define __NR_rt_tgsigqueueinfo 335
336#define __NR_perf_event_open 336
337#define __NR_recvmmsg 337
338#define __NR_fanotify_init 338
339#define __NR_fanotify_mark 339
340#define __NR_prlimit64 340
341#define __NR_name_to_handle_at 341
342#define __NR_open_by_handle_at 342
343#define __NR_clock_adjtime 343
344#define __NR_syncfs 344
345#define __NR_sendmmsg 345
346#define __NR_setns 346
347#define __NR_process_vm_readv 347
348#define __NR_process_vm_writev 348
349#define __NR_kcmp 349
350#define __NR_finit_module 350
351#define __NR_sched_setattr 351
352#define __NR_sched_getattr 352
353#define __NR_renameat2 353
354#define __NR_seccomp 354
355#define __NR_getrandom 355
356#define __NR_memfd_create 356
357#define __NR_bpf 357
358#define __NR_execveat 358
359#define __NR_socket 359
360#define __NR_socketpair 360
361#define __NR_bind 361
362#define __NR_connect 362
363#define __NR_listen 363
364#define __NR_accept4 364
365#define __NR_getsockopt 365
366#define __NR_setsockopt 366
367#define __NR_getsockname 367
368#define __NR_getpeername 368
369#define __NR_sendto 369
370#define __NR_sendmsg 370
371#define __NR_recvfrom 371
372#define __NR_recvmsg 372
373#define __NR_shutdown 373
374#define __NR_userfaultfd 374
375#define __NR_membarrier 375
376#define __NR_mlock2 376
377#define __NR_copy_file_range 377
378#define __NR_preadv2 378
379#define __NR_pwritev2 379
380#define __NR_pkey_mprotect 380
381#define __NR_pkey_alloc 381
382#define __NR_pkey_free 382
383#define __NR_statx 383
384#define __NR_arch_prctl 384
385#define __NR_io_pgetevents 385
386#define __NR_rseq 386
387
libc/musl/arch/i386/bits/user.h created+44
...@@ -0,0 +1,44 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3
4typedef struct user_fpregs_struct {
5 long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
6} elf_fpregset_t;
7
8typedef struct user_fpxregs_struct {
9 unsigned short cwd, swd, twd, fop;
10 long fip, fcs, foo, fos, mxcsr, reserved;
11 long st_space[32], xmm_space[32], padding[56];
12} elf_fpxregset_t;
13
14struct user_regs_struct {
15 long ebx, ecx, edx, esi, edi, ebp, eax, xds, xes, xfs, xgs;
16 long orig_eax, eip, xcs, eflags, esp, xss;
17};
18
19#define ELF_NGREG 17
20typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
21
22struct user {
23 struct user_regs_struct regs;
24 int u_fpvalid;
25 struct user_fpregs_struct i387;
26 unsigned long u_tsize;
27 unsigned long u_dsize;
28 unsigned long u_ssize;
29 unsigned long start_code;
30 unsigned long start_stack;
31 long signal;
32 int reserved;
33 struct user_regs_struct *u_ar0;
34 struct user_fpregs_struct *u_fpstate;
35 unsigned long magic;
36 char u_comm[32];
37 int u_debugreg[8];
38};
39
40#define PAGE_MASK (~(PAGESIZE-1))
41#define NBPG PAGESIZE
42#define UPAGES 1
43#define HOST_TEXT_START_ADDR (u.start_code)
44#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
libc/musl/arch/i386/crt_arch.h created+16
...@@ -0,0 +1,16 @@
1__asm__(
2".text\n"
3".weak _DYNAMIC \n"
4".hidden _DYNAMIC \n"
5".global " START "\n"
6START ":\n"
7" xor %ebp,%ebp \n"
8" mov %esp,%eax \n"
9" and $-16,%esp \n"
10" push %eax \n"
11" push %eax \n"
12" call 1f \n"
13"1: addl $_DYNAMIC-1b,(%esp) \n"
14" push %eax \n"
15" call " START "_c \n"
16);
libc/musl/arch/i386/pthread_arch.h created+10
...@@ -0,0 +1,10 @@
1static inline struct pthread *__pthread_self()
2{
3 struct pthread *self;
4 __asm__ ("movl %%gs:0,%0" : "=r" (self) );
5 return self;
6}
7
8#define TP_ADJ(p) (p)
9
10#define MC_PC gregs[REG_EIP]
libc/musl/arch/i386/reloc.h created+23
...@@ -0,0 +1,23 @@
1#define LDSO_ARCH "i386"
2
3#define REL_SYMBOLIC R_386_32
4#define REL_OFFSET R_386_PC32
5#define REL_GOT R_386_GLOB_DAT
6#define REL_PLT R_386_JMP_SLOT
7#define REL_RELATIVE R_386_RELATIVE
8#define REL_COPY R_386_COPY
9#define REL_DTPMOD R_386_TLS_DTPMOD32
10#define REL_DTPOFF R_386_TLS_DTPOFF32
11#define REL_TPOFF R_386_TLS_TPOFF
12#define REL_TPOFF_NEG R_386_TLS_TPOFF32
13#define REL_TLSDESC R_386_TLS_DESC
14
15#define CRTJMP(pc,sp) __asm__ __volatile__( \
16 "mov %1,%%esp ; jmp *%0" : : "r"(pc), "r"(sp) : "memory" )
17
18#define GETFUNCSYM(fp, sym, got) __asm__ ( \
19 ".hidden " #sym "\n" \
20 " call 1f\n" \
21 "1: addl $" #sym "-.,(%%esp)\n" \
22 " pop %0" \
23 : "=r"(*fp) : : "memory" )
libc/musl/arch/i386/syscall_arch.h created+59
...@@ -0,0 +1,59 @@
1#define __SYSCALL_LL_E(x) \
2((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
3((union { long long ll; long l[2]; }){ .ll = x }).l[1]
4#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
5
6static inline long __syscall0(long n)
7{
8 unsigned long __ret;
9 __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n) : "memory");
10 return __ret;
11}
12
13static inline long __syscall1(long n, long a1)
14{
15 unsigned long __ret;
16 __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1) : "memory");
17 return __ret;
18}
19
20static inline long __syscall2(long n, long a1, long a2)
21{
22 unsigned long __ret;
23 __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2) : "memory");
24 return __ret;
25}
26
27static inline long __syscall3(long n, long a1, long a2, long a3)
28{
29 unsigned long __ret;
30 __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3) : "memory");
31 return __ret;
32}
33
34static inline long __syscall4(long n, long a1, long a2, long a3, long a4)
35{
36 unsigned long __ret;
37 __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4) : "memory");
38 return __ret;
39}
40
41static inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
42{
43 unsigned long __ret;
44 __asm__ __volatile__ ("push %6 ; .hidden __vsyscall ; call __vsyscall ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(a5) : "memory");
45 return __ret;
46}
47
48static inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
49{
50 unsigned long __ret;
51 __asm__ __volatile__ ("push %6 ; .hidden __vsyscall6 ; call __vsyscall6 ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(0+(long[]){a5, a6}) : "memory");
52 return __ret;
53}
54
55#define VDSO_USEFUL
56#define VDSO_CGT_SYM "__vdso_clock_gettime"
57#define VDSO_CGT_VER "LINUX_2.6"
58
59#define SYSCALL_USE_SOCKETCALL
libc/musl/arch/mips/atomic_arch.h created+58
...@@ -0,0 +1,58 @@
1#if __mips_isa_rev < 6
2#define LLSC_M "m"
3#else
4#define LLSC_M "ZC"
5#endif
6
7#define a_ll a_ll
8static inline int a_ll(volatile int *p)
9{
10 int v;
11#if __mips < 2
12 __asm__ __volatile__ (
13 ".set push ; .set mips2\n\t"
14 "ll %0, %1"
15 "\n\t.set pop"
16 : "=r"(v) : "m"(*p));
17#else
18 __asm__ __volatile__ (
19 "ll %0, %1"
20 : "=r"(v) : LLSC_M(*p));
21#endif
22 return v;
23}
24
25#define a_sc a_sc
26static inline int a_sc(volatile int *p, int v)
27{
28 int r;
29#if __mips < 2
30 __asm__ __volatile__ (
31 ".set push ; .set mips2\n\t"
32 "sc %0, %1"
33 "\n\t.set pop"
34 : "=r"(r), "=m"(*p) : "0"(v) : "memory");
35#else
36 __asm__ __volatile__ (
37 "sc %0, %1"
38 : "=r"(r), "="LLSC_M(*p) : "0"(v) : "memory");
39#endif
40 return r;
41}
42
43#define a_barrier a_barrier
44static inline void a_barrier()
45{
46#if __mips < 2
47 /* mips2 sync, but using too many directives causes
48 * gcc not to inline it, so encode with .long instead. */
49 __asm__ __volatile__ (".long 0xf" : : : "memory");
50#else
51 __asm__ __volatile__ ("sync" : : : "memory");
52#endif
53}
54
55#define a_pre_llsc a_barrier
56#define a_post_llsc a_barrier
57
58#undef LLSC_M
libc/musl/arch/mips/bits/alltypes.h.in created+26
...@@ -0,0 +1,26 @@
1#define _Addr int
2#define _Int64 long long
3#define _Reg int
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF int wchar_t;
10#endif
11
12TYPEDEF float float_t;
13TYPEDEF double double_t;
14
15TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
16
17TYPEDEF long time_t;
18TYPEDEF long suseconds_t;
19
20TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
21TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
22TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
23TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
24TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
25TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
26TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
libc/musl/arch/mips/bits/endian.h created+5
...@@ -0,0 +1,5 @@
1#if _MIPSEL || __MIPSEL || __MIPSEL__
2#define __BYTE_ORDER __LITTLE_ENDIAN
3#else
4#define __BYTE_ORDER __BIG_ENDIAN
5#endif
libc/musl/arch/mips/bits/errno.h created+134
...@@ -0,0 +1,134 @@
1#define EPERM 1
2#define ENOENT 2
3#define ESRCH 3
4#define EINTR 4
5#define EIO 5
6#define ENXIO 6
7#define E2BIG 7
8#define ENOEXEC 8
9#define EBADF 9
10#define ECHILD 10
11#define EAGAIN 11
12#define ENOMEM 12
13#define EACCES 13
14#define EFAULT 14
15#define ENOTBLK 15
16#define EBUSY 16
17#define EEXIST 17
18#define EXDEV 18
19#define ENODEV 19
20#define ENOTDIR 20
21#define EISDIR 21
22#define EINVAL 22
23#define ENFILE 23
24#define EMFILE 24
25#define ENOTTY 25
26#define ETXTBSY 26
27#define EFBIG 27
28#define ENOSPC 28
29#define ESPIPE 29
30#define EROFS 30
31#define EMLINK 31
32#define EPIPE 32
33#define EDOM 33
34#define ERANGE 34
35#define ENOMSG 35
36#define EIDRM 36
37#define ECHRNG 37
38#define EL2NSYNC 38
39#define EL3HLT 39
40#define EL3RST 40
41#define ELNRNG 41
42#define EUNATCH 42
43#define ENOCSI 43
44#define EL2HLT 44
45#define EDEADLK 45
46#define ENOLCK 46
47#define EBADE 50
48#define EBADR 51
49#define EXFULL 52
50#define ENOANO 53
51#define EBADRQC 54
52#define EBADSLT 55
53#define EDEADLOCK 56
54#define EBFONT 59
55#define ENOSTR 60
56#define ENODATA 61
57#define ETIME 62
58#define ENOSR 63
59#define ENONET 64
60#define ENOPKG 65
61#define EREMOTE 66
62#define ENOLINK 67
63#define EADV 68
64#define ESRMNT 69
65#define ECOMM 70
66#define EPROTO 71
67#define EDOTDOT 73
68#define EMULTIHOP 74
69#define EBADMSG 77
70#define ENAMETOOLONG 78
71#define EOVERFLOW 79
72#define ENOTUNIQ 80
73#define EBADFD 81
74#define EREMCHG 82
75#define ELIBACC 83
76#define ELIBBAD 84
77#define ELIBSCN 85
78#define ELIBMAX 86
79#define ELIBEXEC 87
80#define EILSEQ 88
81#define ENOSYS 89
82#define ELOOP 90
83#define ERESTART 91
84#define ESTRPIPE 92
85#define ENOTEMPTY 93
86#define EUSERS 94
87#define ENOTSOCK 95
88#define EDESTADDRREQ 96
89#define EMSGSIZE 97
90#define EPROTOTYPE 98
91#define ENOPROTOOPT 99
92#define EPROTONOSUPPORT 120
93#define ESOCKTNOSUPPORT 121
94#define EOPNOTSUPP 122
95#define ENOTSUP EOPNOTSUPP
96#define EPFNOSUPPORT 123
97#define EAFNOSUPPORT 124
98#define EADDRINUSE 125
99#define EADDRNOTAVAIL 126
100#define ENETDOWN 127
101#define ENETUNREACH 128
102#define ENETRESET 129
103#define ECONNABORTED 130
104#define ECONNRESET 131
105#define ENOBUFS 132
106#define EISCONN 133
107#define ENOTCONN 134
108#define EUCLEAN 135
109#define ENOTNAM 137
110#define ENAVAIL 138
111#define EISNAM 139
112#define EREMOTEIO 140
113#define ESHUTDOWN 143
114#define ETOOMANYREFS 144
115#define ETIMEDOUT 145
116#define ECONNREFUSED 146
117#define EHOSTDOWN 147
118#define EHOSTUNREACH 148
119#define EWOULDBLOCK EAGAIN
120#define EALREADY 149
121#define EINPROGRESS 150
122#define ESTALE 151
123#define ECANCELED 158
124#define ENOMEDIUM 159
125#define EMEDIUMTYPE 160
126#define ENOKEY 161
127#define EKEYEXPIRED 162
128#define EKEYREVOKED 163
129#define EKEYREJECTED 164
130#define EOWNERDEAD 165
131#define ENOTRECOVERABLE 166
132#define ERFKILL 167
133#define EHWPOISON 168
134#define EDQUOT 1133
libc/musl/arch/mips/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0400
2#define O_EXCL 02000
3#define O_NOCTTY 04000
4#define O_TRUNC 01000
5#define O_APPEND 0010
6#define O_NONBLOCK 0200
7#define O_DSYNC 0020
8#define O_SYNC 040020
9#define O_RSYNC 040020
10#define O_DIRECTORY 0200000
11#define O_NOFOLLOW 0400000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 010000
15#define O_DIRECT 0100000
16#define O_LARGEFILE 020000
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020200000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_SETOWN 24
29#define F_GETOWN 23
30#define F_SETSIG 10
31#define F_GETSIG 11
32
33#define F_GETLK 33
34#define F_SETLK 34
35#define F_SETLKW 35
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/mips/bits/fenv.h created+25
...@@ -0,0 +1,25 @@
1#ifdef __mips_soft_float
2#define FE_ALL_EXCEPT 0
3#define FE_TONEAREST 0
4#else
5#define FE_INEXACT 4
6#define FE_UNDERFLOW 8
7#define FE_OVERFLOW 16
8#define FE_DIVBYZERO 32
9#define FE_INVALID 64
10
11#define FE_ALL_EXCEPT 124
12
13#define FE_TONEAREST 0
14#define FE_TOWARDZERO 1
15#define FE_UPWARD 2
16#define FE_DOWNWARD 3
17#endif
18
19typedef unsigned short fexcept_t;
20
21typedef struct {
22 unsigned __cw;
23} fenv_t;
24
25#define FE_DFL_ENV ((const fenv_t *) -1)
libc/musl/arch/mips/bits/float.h created+16
...@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
4#define LDBL_MIN 2.22507385850720138309e-308L
5#define LDBL_MAX 1.79769313486231570815e+308L
6#define LDBL_EPSILON 2.22044604925031308085e-16L
7
8#define LDBL_MANT_DIG 53
9#define LDBL_MIN_EXP (-1021)
10#define LDBL_MAX_EXP 1024
11
12#define LDBL_DIG 15
13#define LDBL_MIN_10_EXP (-307)
14#define LDBL_MAX_10_EXP 308
15
16#define DECIMAL_DIG 17
libc/musl/arch/mips/bits/hwcap.h created+3
...@@ -0,0 +1,3 @@
1#define HWCAP_MIPS_R6 (1 << 0)
2#define HWCAP_MIPS_MSA (1 << 1)
3#define HWCAP_MIPS_CRC32 (1 << 2)
libc/musl/arch/mips/bits/ioctl.h created+212
...@@ -0,0 +1,212 @@
1#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
2#define _IOC_NONE 1U
3#define _IOC_READ 2U
4#define _IOC_WRITE 4U
5
6#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
7#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
8#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
9#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
10
11#define TCGETA 0x5401
12#define TCSETA 0x5402
13#define TCSETAW 0x5403
14#define TCSETAF 0x5404
15#define TCSBRK 0x5405
16#define TCXONC 0x5406
17#define TCFLSH 0x5407
18#define TCGETS 0x540D
19#define TCSETS 0x540E
20#define TCSETSW 0x540F
21#define TCSETSF 0x5410
22
23#define TIOCEXCL 0x740D
24#define TIOCNXCL 0x740E
25#define TIOCOUTQ 0x7472
26#define TIOCSTI 0x5472
27#define TIOCMGET 0x741D
28#define TIOCMBIS 0x741B
29#define TIOCMBIC 0x741C
30#define TIOCMSET 0x741A
31
32#define TIOCPKT 0x5470
33#define TIOCSWINSZ _IOW('t', 103, struct winsize)
34#define TIOCGWINSZ _IOR('t', 104, struct winsize)
35#define TIOCNOTTY 0x5471
36#define TIOCSETD 0x7401
37#define TIOCGETD 0x7400
38
39#define FIOCLEX 0x6601
40#define FIONCLEX 0x6602
41#define FIOASYNC 0x667D
42#define FIONBIO 0x667E
43#define FIOQSIZE 0x667F
44
45#define TIOCGLTC 0x7474
46#define TIOCSLTC 0x7475
47#define TIOCSPGRP _IOW('t', 118, int)
48#define TIOCGPGRP _IOR('t', 119, int)
49#define TIOCCONS _IOW('t', 120, int)
50
51#define FIONREAD 0x467F
52#define TIOCINQ FIONREAD
53
54#define TIOCGETP 0x7408
55#define TIOCSETP 0x7409
56#define TIOCSETN 0x740A
57
58#define TIOCSBRK 0x5427
59#define TIOCCBRK 0x5428
60#define TIOCGSID 0x7416
61#define TIOCGRS485 _IOR('T', 0x2E, char[32])
62#define TIOCSRS485 _IOWR('T', 0x2F, char[32])
63#define TIOCGPTN _IOR('T', 0x30, unsigned int)
64#define TIOCSPTLCK _IOW('T', 0x31, int)
65#define TIOCGDEV _IOR('T', 0x32, unsigned int)
66#define TIOCSIG _IOW('T', 0x36, int)
67#define TIOCVHANGUP 0x5437
68#define TIOCGPKT _IOR('T', 0x38, int)
69#define TIOCGPTLCK _IOR('T', 0x39, int)
70#define TIOCGEXCL _IOR('T', 0x40, int)
71#define TIOCGPTPEER _IO('T', 0x41)
72
73#define TIOCSCTTY 0x5480
74#define TIOCGSOFTCAR 0x5481
75#define TIOCSSOFTCAR 0x5482
76#define TIOCLINUX 0x5483
77#define TIOCGSERIAL 0x5484
78#define TIOCSSERIAL 0x5485
79#define TCSBRKP 0x5486
80
81#define TIOCSERCONFIG 0x5488
82#define TIOCSERGWILD 0x5489
83#define TIOCSERSWILD 0x548A
84#define TIOCGLCKTRMIOS 0x548B
85#define TIOCSLCKTRMIOS 0x548C
86#define TIOCSERGSTRUCT 0x548D
87#define TIOCSERGETLSR 0x548E
88#define TIOCSERGETMULTI 0x548F
89#define TIOCSERSETMULTI 0x5490
90#define TIOCMIWAIT 0x5491
91#define TIOCGICOUNT 0x5492
92
93#define TIOCPKT_DATA 0
94#define TIOCPKT_FLUSHREAD 1
95#define TIOCPKT_FLUSHWRITE 2
96#define TIOCPKT_STOP 4
97#define TIOCPKT_START 8
98#define TIOCPKT_NOSTOP 16
99#define TIOCPKT_DOSTOP 32
100#define TIOCPKT_IOCTL 64
101
102#define TIOCSER_TEMT 0x01
103
104struct winsize {
105 unsigned short ws_row;
106 unsigned short ws_col;
107 unsigned short ws_xpixel;
108 unsigned short ws_ypixel;
109};
110
111#define TIOCM_LE 0x001
112#define TIOCM_DTR 0x002
113#define TIOCM_RTS 0x004
114#define TIOCM_ST 0x010
115#define TIOCM_SR 0x020
116#define TIOCM_CTS 0x040
117#define TIOCM_CAR 0x100
118#define TIOCM_CD TIOCM_CAR
119#define TIOCM_RNG 0x200
120#define TIOCM_RI TIOCM_RNG
121#define TIOCM_DSR 0x400
122#define TIOCM_OUT1 0x2000
123#define TIOCM_OUT2 0x4000
124#define TIOCM_LOOP 0x8000
125
126#define N_TTY 0
127#define N_SLIP 1
128#define N_MOUSE 2
129#define N_PPP 3
130#define N_STRIP 4
131#define N_AX25 5
132#define N_X25 6
133#define N_6PACK 7
134#define N_MASC 8
135#define N_R3964 9
136#define N_PROFIBUS_FDL 10
137#define N_IRDA 11
138#define N_SMSBLOCK 12
139#define N_HDLC 13
140#define N_SYNC_PPP 14
141#define N_HCI 15
142
143#define FIOGETOWN _IOR('f', 123, int)
144#define FIOSETOWN _IOW('f', 124, int)
145#define SIOCATMARK _IOR('s', 7, int)
146#define SIOCSPGRP _IOW('s', 8, pid_t)
147#define SIOCGPGRP _IOR('s', 9, pid_t)
148#define SIOCGSTAMP 0x8906
149#define SIOCGSTAMPNS 0x8907
150
151#define SIOCADDRT 0x890B
152#define SIOCDELRT 0x890C
153#define SIOCRTMSG 0x890D
154
155#define SIOCGIFNAME 0x8910
156#define SIOCSIFLINK 0x8911
157#define SIOCGIFCONF 0x8912
158#define SIOCGIFFLAGS 0x8913
159#define SIOCSIFFLAGS 0x8914
160#define SIOCGIFADDR 0x8915
161#define SIOCSIFADDR 0x8916
162#define SIOCGIFDSTADDR 0x8917
163#define SIOCSIFDSTADDR 0x8918
164#define SIOCGIFBRDADDR 0x8919
165#define SIOCSIFBRDADDR 0x891a
166#define SIOCGIFNETMASK 0x891b
167#define SIOCSIFNETMASK 0x891c
168#define SIOCGIFMETRIC 0x891d
169#define SIOCSIFMETRIC 0x891e
170#define SIOCGIFMEM 0x891f
171#define SIOCSIFMEM 0x8920
172#define SIOCGIFMTU 0x8921
173#define SIOCSIFMTU 0x8922
174#define SIOCSIFNAME 0x8923
175#define SIOCSIFHWADDR 0x8924
176#define SIOCGIFENCAP 0x8925
177#define SIOCSIFENCAP 0x8926
178#define SIOCGIFHWADDR 0x8927
179#define SIOCGIFSLAVE 0x8929
180#define SIOCSIFSLAVE 0x8930
181#define SIOCADDMULTI 0x8931
182#define SIOCDELMULTI 0x8932
183#define SIOCGIFINDEX 0x8933
184#define SIOGIFINDEX SIOCGIFINDEX
185#define SIOCSIFPFLAGS 0x8934
186#define SIOCGIFPFLAGS 0x8935
187#define SIOCDIFADDR 0x8936
188#define SIOCSIFHWBROADCAST 0x8937
189#define SIOCGIFCOUNT 0x8938
190
191#define SIOCGIFBR 0x8940
192#define SIOCSIFBR 0x8941
193
194#define SIOCGIFTXQLEN 0x8942
195#define SIOCSIFTXQLEN 0x8943
196
197#define SIOCDARP 0x8953
198#define SIOCGARP 0x8954
199#define SIOCSARP 0x8955
200
201#define SIOCDRARP 0x8960
202#define SIOCGRARP 0x8961
203#define SIOCSRARP 0x8962
204
205#define SIOCGIFMAP 0x8970
206#define SIOCSIFMAP 0x8971
207
208#define SIOCADDDLCI 0x8980
209#define SIOCDELDLCI 0x8981
210
211#define SIOCDEVPRIVATE 0x89F0
212#define SIOCPROTOPRIVATE 0x89E0
libc/musl/arch/mips/bits/limits.h created+7
...@@ -0,0 +1,7 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define LONG_BIT 32
4#endif
5
6#define LONG_MAX 0x7fffffffL
7#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/mips/bits/mman.h created+25
...@@ -0,0 +1,25 @@
1#undef MAP_ANON
2#define MAP_ANON 0x800
3#undef MAP_NORESERVE
4#define MAP_NORESERVE 0x0400
5#undef MAP_GROWSDOWN
6#define MAP_GROWSDOWN 0x1000
7#undef MAP_DENYWRITE
8#define MAP_DENYWRITE 0x2000
9#undef MAP_EXECUTABLE
10#define MAP_EXECUTABLE 0x4000
11#undef MAP_LOCKED
12#define MAP_LOCKED 0x8000
13#undef MAP_POPULATE
14#define MAP_POPULATE 0x10000
15#undef MAP_NONBLOCK
16#define MAP_NONBLOCK 0x20000
17#undef MAP_STACK
18#define MAP_STACK 0x40000
19#undef MAP_HUGETLB
20#define MAP_HUGETLB 0x80000
21#undef MAP_SYNC
22
23#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
24#undef MADV_SOFT_OFFLINE
25#endif
libc/musl/arch/mips/bits/msg.h created+24
...@@ -0,0 +1,24 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3#if _MIPSEL || __MIPSEL || __MIPSEL__
4 time_t msg_stime;
5 int __unused1;
6 time_t msg_rtime;
7 int __unused2;
8 time_t msg_ctime;
9 int __unused3;
10#else
11 int __unused1;
12 time_t msg_stime;
13 int __unused2;
14 time_t msg_rtime;
15 int __unused3;
16 time_t msg_ctime;
17#endif
18 unsigned long msg_cbytes;
19 msgqnum_t msg_qnum;
20 msglen_t msg_qbytes;
21 pid_t msg_lspid;
22 pid_t msg_lrpid;
23 unsigned long __unused[2];
24};
libc/musl/arch/mips/bits/poll.h created+2
...@@ -0,0 +1,2 @@
1#define POLLWRNORM POLLOUT
2#define POLLWRBAND 0x100
libc/musl/arch/mips/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_ILP32_OFFBIG 1
2#define _POSIX_V7_ILP32_OFFBIG 1
libc/musl/arch/mips/bits/ptrace.h created+9
...@@ -0,0 +1,9 @@
1#define PTRACE_GET_THREAD_AREA 25
2#define PTRACE_SET_THREAD_AREA 26
3#define PTRACE_PEEKTEXT_3264 0xc0
4#define PTRACE_PEEKDATA_3264 0xc1
5#define PTRACE_POKETEXT_3264 0xc2
6#define PTRACE_POKEDATA_3264 0xc3
7#define PTRACE_GET_THREAD_AREA_3264 0xc4
8#define PTRACE_GET_WATCH_REGS 0xd0
9#define PTRACE_SET_WATCH_REGS 0xd1
libc/musl/arch/mips/bits/reg.h created+47
...@@ -0,0 +1,47 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3
4#define EF_R0 6
5#define EF_R1 7
6#define EF_R2 8
7#define EF_R3 9
8#define EF_R4 10
9#define EF_R5 11
10#define EF_R6 12
11#define EF_R7 13
12#define EF_R8 14
13#define EF_R9 15
14#define EF_R10 16
15#define EF_R11 17
16#define EF_R12 18
17#define EF_R13 19
18#define EF_R14 20
19#define EF_R15 21
20#define EF_R16 22
21#define EF_R17 23
22#define EF_R18 24
23#define EF_R19 25
24#define EF_R20 26
25#define EF_R21 27
26#define EF_R22 28
27#define EF_R23 29
28#define EF_R24 30
29#define EF_R25 31
30
31#define EF_R26 32
32#define EF_R27 33
33#define EF_R28 34
34#define EF_R29 35
35#define EF_R30 36
36#define EF_R31 37
37
38#define EF_LO 38
39#define EF_HI 39
40
41#define EF_CP0_EPC 40
42#define EF_CP0_BADVADDR 41
43#define EF_CP0_STATUS 42
44#define EF_CP0_CAUSE 43
45#define EF_UNUSED0 44
46
47#define EF_SIZE 180
libc/musl/arch/mips/bits/resource.h created+5
...@@ -0,0 +1,5 @@
1#define RLIMIT_NOFILE 5
2#define RLIMIT_AS 6
3#define RLIMIT_RSS 7
4#define RLIMIT_NPROC 8
5#define RLIMIT_MEMLOCK 9
libc/musl/arch/mips/bits/sem.h created+14
...@@ -0,0 +1,14 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 time_t sem_otime;
4 time_t sem_ctime;
5#if __BYTE_ORDER == __LITTLE_ENDIAN
6 unsigned short sem_nsems;
7 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
8#else
9 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
10 unsigned short sem_nsems;
11#endif
12 time_t __unused3;
13 time_t __unused4;
14};
libc/musl/arch/mips/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long long __jmp_buf[13];
libc/musl/arch/mips/bits/shm.h created+25
...@@ -0,0 +1,25 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 time_t shm_atime;
7 time_t shm_dtime;
8 time_t shm_ctime;
9 pid_t shm_cpid;
10 pid_t shm_lpid;
11 unsigned long shm_nattch;
12 unsigned long __pad1;
13 unsigned long __pad2;
14};
15
16struct shminfo {
17 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
18};
19
20struct shm_info {
21 int __used_ids;
22 unsigned long shm_tot, shm_rss, shm_swp;
23 unsigned long __swap_attempts, __swap_successes;
24};
25
libc/musl/arch/mips/bits/signal.h created+120
...@@ -0,0 +1,120 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 2048
6#define SIGSTKSZ 8192
7#endif
8
9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10typedef unsigned long long greg_t, gregset_t[32];
11typedef struct {
12 union {
13 double fp_dregs[32];
14 struct {
15 float _fp_fregs;
16 unsigned _fp_pad;
17 } fp_fregs[32];
18 } fp_r;
19} fpregset_t;
20struct sigcontext {
21 unsigned sc_regmask, sc_status;
22 unsigned long long sc_pc, sc_regs[32], sc_fpregs[32];
23 unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp;
24 unsigned long long sc_mdhi, sc_mdlo;
25 unsigned long sc_hi1, sc_lo1, sc_hi2, sc_lo2, sc_hi3, sc_lo3;
26};
27typedef struct {
28 unsigned regmask, status;
29 unsigned long long pc, gregs[32], fpregs[32];
30 unsigned ownedfp, fpc_csr, fpc_eir, used_math, dsp;
31 unsigned long long mdhi, mdlo;
32 unsigned long hi1, lo1, hi2, lo2, hi3, lo3;
33} mcontext_t;
34#else
35typedef struct {
36 unsigned __mc1[2];
37 unsigned long long __mc2[65];
38 unsigned __mc3[5];
39 unsigned long long __mc4[2];
40 unsigned __mc5[6];
41} mcontext_t;
42#endif
43
44struct sigaltstack {
45 void *ss_sp;
46 size_t ss_size;
47 int ss_flags;
48};
49
50typedef struct __ucontext {
51 unsigned long uc_flags;
52 struct __ucontext *uc_link;
53 stack_t uc_stack;
54 mcontext_t uc_mcontext;
55 sigset_t uc_sigmask;
56} ucontext_t;
57
58#define SA_NOCLDSTOP 1
59#define SA_NOCLDWAIT 0x10000
60#define SA_SIGINFO 8
61#define SA_ONSTACK 0x08000000
62#define SA_RESTART 0x10000000
63#define SA_NODEFER 0x40000000
64#define SA_RESETHAND 0x80000000
65#define SA_RESTORER 0x04000000
66
67#undef SIG_BLOCK
68#undef SIG_UNBLOCK
69#undef SIG_SETMASK
70#define SIG_BLOCK 1
71#define SIG_UNBLOCK 2
72#define SIG_SETMASK 3
73
74#undef SI_ASYNCIO
75#undef SI_MESGQ
76#undef SI_TIMER
77#define SI_ASYNCIO (-2)
78#define SI_MESGQ (-4)
79#define SI_TIMER (-3)
80
81#define __SI_SWAP_ERRNO_CODE
82
83#endif
84
85#define SIGHUP 1
86#define SIGINT 2
87#define SIGQUIT 3
88#define SIGILL 4
89#define SIGTRAP 5
90#define SIGABRT 6
91#define SIGIOT SIGABRT
92#define SIGSTKFLT 7
93#define SIGFPE 8
94#define SIGKILL 9
95#define SIGBUS 10
96#define SIGSEGV 11
97#define SIGSYS 12
98#define SIGPIPE 13
99#define SIGALRM 14
100#define SIGTERM 15
101#define SIGUSR1 16
102#define SIGUSR2 17
103#define SIGCHLD 18
104#define SIGPWR 19
105#define SIGWINCH 20
106#define SIGURG 21
107#define SIGIO 22
108#define SIGPOLL SIGIO
109#define SIGSTOP 23
110#define SIGTSTP 24
111#define SIGCONT 25
112#define SIGTTIN 26
113#define SIGTTOU 27
114#define SIGVTALRM 28
115#define SIGPROF 29
116#define SIGXCPU 30
117#define SIGXFSZ 31
118#define SIGUNUSED SIGSYS
119
120#define _NSIG 128
libc/musl/arch/mips/bits/socket.h created+53
...@@ -0,0 +1,53 @@
1struct msghdr {
2 void *msg_name;
3 socklen_t msg_namelen;
4 struct iovec *msg_iov;
5 int msg_iovlen;
6 void *msg_control;
7 socklen_t msg_controllen;
8 int msg_flags;
9};
10
11struct cmsghdr {
12 socklen_t cmsg_len;
13 int cmsg_level;
14 int cmsg_type;
15};
16
17#define SOCK_STREAM 2
18#define SOCK_DGRAM 1
19
20#define SOL_SOCKET 65535
21
22#define SO_DEBUG 1
23
24#define SO_REUSEADDR 0x0004
25#define SO_KEEPALIVE 0x0008
26#define SO_DONTROUTE 0x0010
27#define SO_BROADCAST 0x0020
28#define SO_LINGER 0x0080
29#define SO_OOBINLINE 0x0100
30#define SO_REUSEPORT 0x0200
31#define SO_SNDBUF 0x1001
32#define SO_RCVBUF 0x1002
33#define SO_SNDLOWAT 0x1003
34#define SO_RCVLOWAT 0x1004
35#define SO_RCVTIMEO 0x1006
36#define SO_SNDTIMEO 0x1005
37#define SO_ERROR 0x1007
38#define SO_TYPE 0x1008
39#define SO_ACCEPTCONN 0x1009
40#define SO_PROTOCOL 0x1028
41#define SO_DOMAIN 0x1029
42
43#define SO_NO_CHECK 11
44#define SO_PRIORITY 12
45#define SO_BSDCOMPAT 14
46#define SO_PASSCRED 17
47#define SO_PEERCRED 18
48#define SO_PEERSEC 30
49#define SO_SNDBUFFORCE 31
50#define SO_RCVBUFFORCE 33
51
52#define SOCK_NONBLOCK 0200
53#define SOCK_CLOEXEC 02000000
libc/musl/arch/mips/bits/stat.h created+22
...@@ -0,0 +1,22 @@
1/* copied from kernel definition, but with padding replaced
2 * by the corresponding correctly-sized userspace types. */
3
4struct stat {
5 dev_t st_dev;
6 long __st_padding1[2];
7 ino_t st_ino;
8 mode_t st_mode;
9 nlink_t st_nlink;
10 uid_t st_uid;
11 gid_t st_gid;
12 dev_t st_rdev;
13 long __st_padding2[2];
14 off_t st_size;
15 struct timespec st_atim;
16 struct timespec st_mtim;
17 struct timespec st_ctim;
18 blksize_t st_blksize;
19 long __st_padding3;
20 blkcnt_t st_blocks;
21 long __st_padding4[14];
22};
libc/musl/arch/mips/bits/statfs.h created+8
...@@ -0,0 +1,8 @@
1struct statfs {
2 unsigned long f_type, f_bsize, f_frsize;
3 fsblkcnt_t f_blocks, f_bfree;
4 fsfilcnt_t f_files, f_ffree;
5 fsblkcnt_t f_bavail;
6 fsid_t f_fsid;
7 unsigned long f_namelen, f_flags, f_spare[5];
8};
libc/musl/arch/mips/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT32_MIN
16#define INTPTR_MAX INT32_MAX
17#define UINTPTR_MAX UINT32_MAX
18#define PTRDIFF_MIN INT32_MIN
19#define PTRDIFF_MAX INT32_MAX
20#define SIZE_MAX UINT32_MAX
libc/musl/arch/mips/bits/syscall.h.in created+369
...@@ -0,0 +1,369 @@
1#define __NR_syscall 4000
2#define __NR_exit 4001
3#define __NR_fork 4002
4#define __NR_read 4003
5#define __NR_write 4004
6#define __NR_open 4005
7#define __NR_close 4006
8#define __NR_waitpid 4007
9#define __NR_creat 4008
10#define __NR_link 4009
11#define __NR_unlink 4010
12#define __NR_execve 4011
13#define __NR_chdir 4012
14#define __NR_time 4013
15#define __NR_mknod 4014
16#define __NR_chmod 4015
17#define __NR_lchown 4016
18#define __NR_break 4017
19#define __NR_unused18 4018
20#define __NR_lseek 4019
21#define __NR_getpid 4020
22#define __NR_mount 4021
23#define __NR_umount 4022
24#define __NR_setuid 4023
25#define __NR_getuid 4024
26#define __NR_stime 4025
27#define __NR_ptrace 4026
28#define __NR_alarm 4027
29#define __NR_unused28 4028
30#define __NR_pause 4029
31#define __NR_utime 4030
32#define __NR_stty 4031
33#define __NR_gtty 4032
34#define __NR_access 4033
35#define __NR_nice 4034
36#define __NR_ftime 4035
37#define __NR_sync 4036
38#define __NR_kill 4037
39#define __NR_rename 4038
40#define __NR_mkdir 4039
41#define __NR_rmdir 4040
42#define __NR_dup 4041
43#define __NR_pipe 4042
44#define __NR_times 4043
45#define __NR_prof 4044
46#define __NR_brk 4045
47#define __NR_setgid 4046
48#define __NR_getgid 4047
49#define __NR_signal 4048
50#define __NR_geteuid 4049
51#define __NR_getegid 4050
52#define __NR_acct 4051
53#define __NR_umount2 4052
54#define __NR_lock 4053
55#define __NR_ioctl 4054
56#define __NR_fcntl 4055
57#define __NR_mpx 4056
58#define __NR_setpgid 4057
59#define __NR_ulimit 4058
60#define __NR_unused59 4059
61#define __NR_umask 4060
62#define __NR_chroot 4061
63#define __NR_ustat 4062
64#define __NR_dup2 4063
65#define __NR_getppid 4064
66#define __NR_getpgrp 4065
67#define __NR_setsid 4066
68#define __NR_sigaction 4067
69#define __NR_sgetmask 4068
70#define __NR_ssetmask 4069
71#define __NR_setreuid 4070
72#define __NR_setregid 4071
73#define __NR_sigsuspend 4072
74#define __NR_sigpending 4073
75#define __NR_sethostname 4074
76#define __NR_setrlimit 4075
77#define __NR_getrlimit 4076
78#define __NR_getrusage 4077
79#define __NR_gettimeofday 4078
80#define __NR_settimeofday 4079
81#define __NR_getgroups 4080
82#define __NR_setgroups 4081
83#define __NR_reserved82 4082
84#define __NR_symlink 4083
85#define __NR_unused84 4084
86#define __NR_readlink 4085
87#define __NR_uselib 4086
88#define __NR_swapon 4087
89#define __NR_reboot 4088
90#define __NR_readdir 4089
91#define __NR_mmap 4090
92#define __NR_munmap 4091
93#define __NR_truncate 4092
94#define __NR_ftruncate 4093
95#define __NR_fchmod 4094
96#define __NR_fchown 4095
97#define __NR_getpriority 4096
98#define __NR_setpriority 4097
99#define __NR_profil 4098
100#define __NR_statfs 4099
101#define __NR_fstatfs 4100
102#define __NR_ioperm 4101
103#define __NR_socketcall 4102
104#define __NR_syslog 4103
105#define __NR_setitimer 4104
106#define __NR_getitimer 4105
107#define __NR_stat 4106
108#define __NR_lstat 4107
109#define __NR_fstat 4108
110#define __NR_unused109 4109
111#define __NR_iopl 4110
112#define __NR_vhangup 4111
113#define __NR_idle 4112
114#define __NR_vm86 4113
115#define __NR_wait4 4114
116#define __NR_swapoff 4115
117#define __NR_sysinfo 4116
118#define __NR_ipc 4117
119#define __NR_fsync 4118
120#define __NR_sigreturn 4119
121#define __NR_clone 4120
122#define __NR_setdomainname 4121
123#define __NR_uname 4122
124#define __NR_modify_ldt 4123
125#define __NR_adjtimex 4124
126#define __NR_mprotect 4125
127#define __NR_sigprocmask 4126
128#define __NR_create_module 4127
129#define __NR_init_module 4128
130#define __NR_delete_module 4129
131#define __NR_get_kernel_syms 4130
132#define __NR_quotactl 4131
133#define __NR_getpgid 4132
134#define __NR_fchdir 4133
135#define __NR_bdflush 4134
136#define __NR_sysfs 4135
137#define __NR_personality 4136
138#define __NR_afs_syscall 4137
139#define __NR_setfsuid 4138
140#define __NR_setfsgid 4139
141#define __NR__llseek 4140
142#define __NR_getdents 4141
143#define __NR__newselect 4142
144#define __NR_flock 4143
145#define __NR_msync 4144
146#define __NR_readv 4145
147#define __NR_writev 4146
148#define __NR_cacheflush 4147
149#define __NR_cachectl 4148
150#define __NR_sysmips 4149
151#define __NR_unused150 4150
152#define __NR_getsid 4151
153#define __NR_fdatasync 4152
154#define __NR__sysctl 4153
155#define __NR_mlock 4154
156#define __NR_munlock 4155
157#define __NR_mlockall 4156
158#define __NR_munlockall 4157
159#define __NR_sched_setparam 4158
160#define __NR_sched_getparam 4159
161#define __NR_sched_setscheduler 4160
162#define __NR_sched_getscheduler 4161
163#define __NR_sched_yield 4162
164#define __NR_sched_get_priority_max 4163
165#define __NR_sched_get_priority_min 4164
166#define __NR_sched_rr_get_interval 4165
167#define __NR_nanosleep 4166
168#define __NR_mremap 4167
169#define __NR_accept 4168
170#define __NR_bind 4169
171#define __NR_connect 4170
172#define __NR_getpeername 4171
173#define __NR_getsockname 4172
174#define __NR_getsockopt 4173
175#define __NR_listen 4174
176#define __NR_recv 4175
177#define __NR_recvfrom 4176
178#define __NR_recvmsg 4177
179#define __NR_send 4178
180#define __NR_sendmsg 4179
181#define __NR_sendto 4180
182#define __NR_setsockopt 4181
183#define __NR_shutdown 4182
184#define __NR_socket 4183
185#define __NR_socketpair 4184
186#define __NR_setresuid 4185
187#define __NR_getresuid 4186
188#define __NR_query_module 4187
189#define __NR_poll 4188
190#define __NR_nfsservctl 4189
191#define __NR_setresgid 4190
192#define __NR_getresgid 4191
193#define __NR_prctl 4192
194#define __NR_rt_sigreturn 4193
195#define __NR_rt_sigaction 4194
196#define __NR_rt_sigprocmask 4195
197#define __NR_rt_sigpending 4196
198#define __NR_rt_sigtimedwait 4197
199#define __NR_rt_sigqueueinfo 4198
200#define __NR_rt_sigsuspend 4199
201#define __NR_pread64 4200
202#define __NR_pwrite64 4201
203#define __NR_chown 4202
204#define __NR_getcwd 4203
205#define __NR_capget 4204
206#define __NR_capset 4205
207#define __NR_sigaltstack 4206
208#define __NR_sendfile 4207
209#define __NR_getpmsg 4208
210#define __NR_putpmsg 4209
211#define __NR_mmap2 4210
212#define __NR_truncate64 4211
213#define __NR_ftruncate64 4212
214#define __NR_stat64 4213
215#define __NR_lstat64 4214
216#define __NR_fstat64 4215
217#define __NR_pivot_root 4216
218#define __NR_mincore 4217
219#define __NR_madvise 4218
220#define __NR_getdents64 4219
221#define __NR_fcntl64 4220
222#define __NR_reserved221 4221
223#define __NR_gettid 4222
224#define __NR_readahead 4223
225#define __NR_setxattr 4224
226#define __NR_lsetxattr 4225
227#define __NR_fsetxattr 4226
228#define __NR_getxattr 4227
229#define __NR_lgetxattr 4228
230#define __NR_fgetxattr 4229
231#define __NR_listxattr 4230
232#define __NR_llistxattr 4231
233#define __NR_flistxattr 4232
234#define __NR_removexattr 4233
235#define __NR_lremovexattr 4234
236#define __NR_fremovexattr 4235
237#define __NR_tkill 4236
238#define __NR_sendfile64 4237
239#define __NR_futex 4238
240#define __NR_sched_setaffinity 4239
241#define __NR_sched_getaffinity 4240
242#define __NR_io_setup 4241
243#define __NR_io_destroy 4242
244#define __NR_io_getevents 4243
245#define __NR_io_submit 4244
246#define __NR_io_cancel 4245
247#define __NR_exit_group 4246
248#define __NR_lookup_dcookie 4247
249#define __NR_epoll_create 4248
250#define __NR_epoll_ctl 4249
251#define __NR_epoll_wait 4250
252#define __NR_remap_file_pages 4251
253#define __NR_set_tid_address 4252
254#define __NR_restart_syscall 4253
255#define __NR_fadvise64 4254
256#define __NR_statfs64 4255
257#define __NR_fstatfs64 4256
258#define __NR_timer_create 4257
259#define __NR_timer_settime 4258
260#define __NR_timer_gettime 4259
261#define __NR_timer_getoverrun 4260
262#define __NR_timer_delete 4261
263#define __NR_clock_settime 4262
264#define __NR_clock_gettime 4263
265#define __NR_clock_getres 4264
266#define __NR_clock_nanosleep 4265
267#define __NR_tgkill 4266
268#define __NR_utimes 4267
269#define __NR_mbind 4268
270#define __NR_get_mempolicy 4269
271#define __NR_set_mempolicy 4270
272#define __NR_mq_open 4271
273#define __NR_mq_unlink 4272
274#define __NR_mq_timedsend 4273
275#define __NR_mq_timedreceive 4274
276#define __NR_mq_notify 4275
277#define __NR_mq_getsetattr 4276
278#define __NR_vserver 4277
279#define __NR_waitid 4278
280#define __NR_add_key 4280
281#define __NR_request_key 4281
282#define __NR_keyctl 4282
283#define __NR_set_thread_area 4283
284#define __NR_inotify_init 4284
285#define __NR_inotify_add_watch 4285
286#define __NR_inotify_rm_watch 4286
287#define __NR_migrate_pages 4287
288#define __NR_openat 4288
289#define __NR_mkdirat 4289
290#define __NR_mknodat 4290
291#define __NR_fchownat 4291
292#define __NR_futimesat 4292
293#define __NR_fstatat64 4293
294#define __NR_unlinkat 4294
295#define __NR_renameat 4295
296#define __NR_linkat 4296
297#define __NR_symlinkat 4297
298#define __NR_readlinkat 4298
299#define __NR_fchmodat 4299
300#define __NR_faccessat 4300
301#define __NR_pselect6 4301
302#define __NR_ppoll 4302
303#define __NR_unshare 4303
304#define __NR_splice 4304
305#define __NR_sync_file_range 4305
306#define __NR_tee 4306
307#define __NR_vmsplice 4307
308#define __NR_move_pages 4308
309#define __NR_set_robust_list 4309
310#define __NR_get_robust_list 4310
311#define __NR_kexec_load 4311
312#define __NR_getcpu 4312
313#define __NR_epoll_pwait 4313
314#define __NR_ioprio_set 4314
315#define __NR_ioprio_get 4315
316#define __NR_utimensat 4316
317#define __NR_signalfd 4317
318#define __NR_timerfd 4318
319#define __NR_eventfd 4319
320#define __NR_fallocate 4320
321#define __NR_timerfd_create 4321
322#define __NR_timerfd_gettime 4322
323#define __NR_timerfd_settime 4323
324#define __NR_signalfd4 4324
325#define __NR_eventfd2 4325
326#define __NR_epoll_create1 4326
327#define __NR_dup3 4327
328#define __NR_pipe2 4328
329#define __NR_inotify_init1 4329
330#define __NR_preadv 4330
331#define __NR_pwritev 4331
332#define __NR_rt_tgsigqueueinfo 4332
333#define __NR_perf_event_open 4333
334#define __NR_accept4 4334
335#define __NR_recvmmsg 4335
336#define __NR_fanotify_init 4336
337#define __NR_fanotify_mark 4337
338#define __NR_prlimit64 4338
339#define __NR_name_to_handle_at 4339
340#define __NR_open_by_handle_at 4340
341#define __NR_clock_adjtime 4341
342#define __NR_syncfs 4342
343#define __NR_sendmmsg 4343
344#define __NR_setns 4344
345#define __NR_process_vm_readv 4345
346#define __NR_process_vm_writev 4346
347#define __NR_kcmp 4347
348#define __NR_finit_module 4348
349#define __NR_sched_setattr 4349
350#define __NR_sched_getattr 4350
351#define __NR_renameat2 4351
352#define __NR_seccomp 4352
353#define __NR_getrandom 4353
354#define __NR_memfd_create 4354
355#define __NR_bpf 4355
356#define __NR_execveat 4356
357#define __NR_userfaultfd 4357
358#define __NR_membarrier 4358
359#define __NR_mlock2 4359
360#define __NR_copy_file_range 4360
361#define __NR_preadv2 4361
362#define __NR_pwritev2 4362
363#define __NR_pkey_mprotect 4363
364#define __NR_pkey_alloc 4364
365#define __NR_pkey_free 4365
366#define __NR_statx 4366
367#define __NR_rseq 4367
368#define __NR_io_pgetevents 4368
369
libc/musl/arch/mips/bits/termios.h created+169
...@@ -0,0 +1,169 @@
1struct termios {
2 tcflag_t c_iflag;
3 tcflag_t c_oflag;
4 tcflag_t c_cflag;
5 tcflag_t c_lflag;
6 cc_t c_line;
7 cc_t c_cc[NCCS];
8 speed_t __c_ispeed;
9 speed_t __c_ospeed;
10};
11
12#define VINTR 0
13#define VQUIT 1
14#define VERASE 2
15#define VKILL 3
16#define VMIN 4
17#define VTIME 5
18#define VEOL2 6
19#define VSWTC 7
20#define VSWTCH 7
21#define VSTART 8
22#define VSTOP 9
23#define VSUSP 10
24#define VREPRINT 12
25#define VDISCARD 13
26#define VWERASE 14
27#define VLNEXT 15
28#define VEOF 16
29#define VEOL 17
30
31#define IGNBRK 0000001
32#define BRKINT 0000002
33#define IGNPAR 0000004
34#define PARMRK 0000010
35#define INPCK 0000020
36#define ISTRIP 0000040
37#define INLCR 0000100
38#define IGNCR 0000200
39#define ICRNL 0000400
40#define IUCLC 0001000
41#define IXON 0002000
42#define IXANY 0004000
43#define IXOFF 0010000
44#define IMAXBEL 0020000
45#define IUTF8 0040000
46
47#define OPOST 0000001
48#define OLCUC 0000002
49#define ONLCR 0000004
50#define OCRNL 0000010
51#define ONOCR 0000020
52#define ONLRET 0000040
53#define OFILL 0000100
54#define OFDEL 0000200
55#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
56#define NLDLY 0000400
57#define NL0 0000000
58#define NL1 0000400
59#define CRDLY 0003000
60#define CR0 0000000
61#define CR1 0001000
62#define CR2 0002000
63#define CR3 0003000
64#define TABDLY 0014000
65#define TAB0 0000000
66#define TAB1 0004000
67#define TAB2 0010000
68#define TAB3 0014000
69#define BSDLY 0020000
70#define BS0 0000000
71#define BS1 0020000
72#define FFDLY 0100000
73#define FF0 0000000
74#define FF1 0100000
75#endif
76
77#define VTDLY 0040000
78#define VT0 0000000
79#define VT1 0040000
80
81#define B0 0000000
82#define B50 0000001
83#define B75 0000002
84#define B110 0000003
85#define B134 0000004
86#define B150 0000005
87#define B200 0000006
88#define B300 0000007
89#define B600 0000010
90#define B1200 0000011
91#define B1800 0000012
92#define B2400 0000013
93#define B4800 0000014
94#define B9600 0000015
95#define B19200 0000016
96#define B38400 0000017
97
98#define B57600 0010001
99#define B115200 0010002
100#define B230400 0010003
101#define B460800 0010004
102#define B500000 0010005
103#define B576000 0010006
104#define B921600 0010007
105#define B1000000 0010010
106#define B1152000 0010011
107#define B1500000 0010012
108#define B2000000 0010013
109#define B2500000 0010014
110#define B3000000 0010015
111#define B3500000 0010016
112#define B4000000 0010017
113
114#define CSIZE 0000060
115#define CS5 0000000
116#define CS6 0000020
117#define CS7 0000040
118#define CS8 0000060
119#define CSTOPB 0000100
120#define CREAD 0000200
121#define PARENB 0000400
122#define PARODD 0001000
123#define HUPCL 0002000
124#define CLOCAL 0004000
125
126#define ISIG 0000001
127#define ICANON 0000002
128#define ECHO 0000010
129#define ECHOE 0000020
130#define ECHOK 0000040
131#define ECHONL 0000100
132#define NOFLSH 0000200
133#define IEXTEN 0000400
134#define TOSTOP 0100000
135#define ITOSTOP 0100000
136
137#define TCOOFF 0
138#define TCOON 1
139#define TCIOFF 2
140#define TCION 3
141
142#define TCIFLUSH 0
143#define TCOFLUSH 1
144#define TCIOFLUSH 2
145
146#define TCSANOW 0
147#define TCSADRAIN 1
148#define TCSAFLUSH 2
149
150#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
151#define EXTA 0000016
152#define EXTB 0000017
153#define CBAUD 0010017
154#define CBAUDEX 0010000
155#define CIBAUD 002003600000
156#define CMSPAR 010000000000
157#define CRTSCTS 020000000000
158
159#define XCASE 0000004
160#define ECHOCTL 0001000
161#define ECHOPRT 0002000
162#define ECHOKE 0004000
163#define FLUSHO 0020000
164#define PENDIN 0040000
165#define EXTPROC 0200000
166
167#define XTABS 0014000
168#define TIOCSER_TEMT 0x01
169#endif
libc/musl/arch/mips/bits/user.h created+13
...@@ -0,0 +1,13 @@
1struct user {
2 unsigned long regs[45+64];
3 unsigned long u_tsize, u_dsize, u_ssize;
4 unsigned long start_code, start_data, start_stack;
5 long signal;
6 void *u_ar0;
7 unsigned long magic;
8 char u_comm[32];
9};
10#define ELF_NGREG 45
11#define ELF_NFPREG 33
12typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
13typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
libc/musl/arch/mips/crt_arch.h created+29
...@@ -0,0 +1,29 @@
1__asm__(
2".set push\n"
3".set noreorder\n"
4".text \n"
5".global _" START "\n"
6".global " START "\n"
7".type _" START ", @function\n"
8".type " START ", @function\n"
9"_" START ":\n"
10"" START ":\n"
11" bal 1f \n"
12" move $fp, $0 \n"
13" .gpword . \n"
14" .gpword " START "_c \n"
15".weak _DYNAMIC \n"
16".hidden _DYNAMIC \n"
17" .gpword _DYNAMIC \n"
18"1: lw $gp, 0($ra) \n"
19" subu $gp, $ra, $gp \n"
20" move $4, $sp \n"
21" lw $5, 8($ra) \n"
22" addu $5, $5, $gp \n"
23" lw $25, 4($ra) \n"
24" addu $25, $25, $gp \n"
25" and $sp, $sp, -8 \n"
26" jalr $25 \n"
27" subu $sp, $sp, 16 \n"
28".set pop \n"
29);
libc/musl/arch/mips/ksigaction.h created+13
...@@ -0,0 +1,13 @@
1#include <features.h>
2
3struct k_sigaction {
4 unsigned flags;
5 void (*handler)(int);
6 unsigned long mask[4];
7 /* The following field is past the end of the structure the
8 * kernel will read or write, and exists only to avoid having
9 * mips-specific preprocessor conditionals in sigaction.c. */
10 void (*restorer)();
11};
12
13hidden void __restore(), __restore_rt();
libc/musl/arch/mips/pthread_arch.h created+19
...@@ -0,0 +1,19 @@
1static inline struct pthread *__pthread_self()
2{
3#if __mips_isa_rev < 2
4 register char *tp __asm__("$3");
5 __asm__ (".word 0x7c03e83b" : "=r" (tp) );
6#else
7 char *tp;
8 __asm__ ("rdhwr %0, $29" : "=r" (tp) );
9#endif
10 return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
11}
12
13#define TLS_ABOVE_TP
14#define GAP_ABOVE_TP 0
15#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
16
17#define DTP_OFFSET 0x8000
18
19#define MC_PC pc
libc/musl/arch/mips/reloc.h created+52
...@@ -0,0 +1,52 @@
1#include <endian.h>
2
3#if __mips_isa_rev >= 6
4#define ISA_SUFFIX "r6"
5#else
6#define ISA_SUFFIX ""
7#endif
8
9#if __BYTE_ORDER == __LITTLE_ENDIAN
10#define ENDIAN_SUFFIX "el"
11#else
12#define ENDIAN_SUFFIX ""
13#endif
14
15#ifdef __mips_soft_float
16#define FP_SUFFIX "-sf"
17#else
18#define FP_SUFFIX ""
19#endif
20
21#define LDSO_ARCH "mips" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX
22
23#define TPOFF_K (-0x7000)
24
25#define REL_SYM_OR_REL R_MIPS_REL32
26#define REL_PLT R_MIPS_JUMP_SLOT
27#define REL_COPY R_MIPS_COPY
28#define REL_DTPMOD R_MIPS_TLS_DTPMOD32
29#define REL_DTPOFF R_MIPS_TLS_DTPREL32
30#define REL_TPOFF R_MIPS_TLS_TPREL32
31
32#define NEED_MIPS_GOT_RELOCS 1
33#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
34#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
35
36#define CRTJMP(pc,sp) __asm__ __volatile__( \
37 "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
38
39#define GETFUNCSYM(fp, sym, got) __asm__ ( \
40 ".hidden " #sym "\n" \
41 ".set push \n" \
42 ".set noreorder \n" \
43 " bal 1f \n" \
44 " nop \n" \
45 " .gpword . \n" \
46 " .gpword " #sym " \n" \
47 "1: lw %0, ($ra) \n" \
48 " subu %0, $ra, %0 \n" \
49 " lw $ra, 4($ra) \n" \
50 " addu %0, %0, $ra \n" \
51 ".set pop \n" \
52 : "=r"(*(fp)) : : "memory", "ra" )
libc/musl/arch/mips/syscall_arch.h created+125
...@@ -0,0 +1,125 @@
1#define __SYSCALL_LL_E(x) \
2((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
3((union { long long ll; long l[2]; }){ .ll = x }).l[1]
4#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
5
6hidden long (__syscall)(long, ...);
7
8#define SYSCALL_RLIM_INFINITY (-1UL/2)
9
10#if _MIPSEL || __MIPSEL || __MIPSEL__
11#define __stat_fix(st) ((st),(void)0)
12#else
13#include <sys/stat.h>
14static inline void __stat_fix(long p)
15{
16 struct stat *st = (struct stat *)p;
17 st->st_dev >>= 32;
18 st->st_rdev >>= 32;
19}
20#endif
21
22static inline long __syscall0(long n)
23{
24 register long r7 __asm__("$7");
25 register long r2 __asm__("$2");
26 __asm__ __volatile__ (
27 "addu $2,$0,%2 ; syscall"
28 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
29 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
30 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
31 return r7 ? -r2 : r2;
32}
33
34static inline long __syscall1(long n, long a)
35{
36 register long r4 __asm__("$4") = a;
37 register long r7 __asm__("$7");
38 register long r2 __asm__("$2");
39 __asm__ __volatile__ (
40 "addu $2,$0,%2 ; syscall"
41 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
42 "r"(r4)
43 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
44 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
45 return r7 ? -r2 : r2;
46}
47
48static inline long __syscall2(long n, long a, long b)
49{
50 register long r4 __asm__("$4") = a;
51 register long r5 __asm__("$5") = b;
52 register long r7 __asm__("$7");
53 register long r2 __asm__("$2");
54 __asm__ __volatile__ (
55 "addu $2,$0,%2 ; syscall"
56 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
57 "r"(r4), "r"(r5)
58 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
59 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
60 if (r7) return -r2;
61 long ret = r2;
62 if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
63 return ret;
64}
65
66static inline long __syscall3(long n, long a, long b, long c)
67{
68 register long r4 __asm__("$4") = a;
69 register long r5 __asm__("$5") = b;
70 register long r6 __asm__("$6") = c;
71 register long r7 __asm__("$7");
72 register long r2 __asm__("$2");
73 __asm__ __volatile__ (
74 "addu $2,$0,%2 ; syscall"
75 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
76 "r"(r4), "r"(r5), "r"(r6)
77 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
78 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
79 if (r7) return -r2;
80 long ret = r2;
81 if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
82 return ret;
83}
84
85static inline long __syscall4(long n, long a, long b, long c, long d)
86{
87 register long r4 __asm__("$4") = a;
88 register long r5 __asm__("$5") = b;
89 register long r6 __asm__("$6") = c;
90 register long r7 __asm__("$7") = d;
91 register long r2 __asm__("$2");
92 __asm__ __volatile__ (
93 "addu $2,$0,%2 ; syscall"
94 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
95 "r"(r4), "r"(r5), "r"(r6)
96 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
97 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
98 if (r7) return -r2;
99 long ret = r2;
100 if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
101 if (n == SYS_fstatat64) __stat_fix(c);
102 return ret;
103}
104
105static inline long __syscall5(long n, long a, long b, long c, long d, long e)
106{
107 long r2 = (__syscall)(n, a, b, c, d, e);
108 if (r2 > -4096UL) return r2;
109 if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
110 if (n == SYS_fstatat64) __stat_fix(c);
111 return r2;
112}
113
114static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
115{
116 long r2 = (__syscall)(n, a, b, c, d, e, f);
117 if (r2 > -4096UL) return r2;
118 if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
119 if (n == SYS_fstatat64) __stat_fix(c);
120 return r2;
121}
122
123#define VDSO_USEFUL
124#define VDSO_CGT_SYM "__vdso_clock_gettime"
125#define VDSO_CGT_VER "LINUX_2.6"
libc/musl/arch/mips64/atomic_arch.h created+56
...@@ -0,0 +1,56 @@
1#if __mips_isa_rev < 6
2#define LLSC_M "m"
3#else
4#define LLSC_M "ZC"
5#endif
6
7#define a_ll a_ll
8static inline int a_ll(volatile int *p)
9{
10 int v;
11 __asm__ __volatile__ (
12 "ll %0, %1"
13 : "=r"(v) : LLSC_M(*p));
14 return v;
15}
16
17#define a_sc a_sc
18static inline int a_sc(volatile int *p, int v)
19{
20 int r;
21 __asm__ __volatile__ (
22 "sc %0, %1"
23 : "=r"(r), "="LLSC_M(*p) : "0"(v) : "memory");
24 return r;
25}
26
27#define a_ll_p a_ll_p
28static inline void *a_ll_p(volatile void *p)
29{
30 void *v;
31 __asm__ __volatile__ (
32 "lld %0, %1"
33 : "=r"(v) : LLSC_M(*(void *volatile *)p));
34 return v;
35}
36
37#define a_sc_p a_sc_p
38static inline int a_sc_p(volatile void *p, void *v)
39{
40 long r;
41 __asm__ __volatile__ (
42 "scd %0, %1"
43 : "=r"(r), "="LLSC_M(*(void *volatile *)p) : "0"(v) : "memory");
44 return r;
45}
46
47#define a_barrier a_barrier
48static inline void a_barrier()
49{
50 __asm__ __volatile__ ("sync" : : : "memory");
51}
52
53#define a_pre_llsc a_barrier
54#define a_post_llsc a_barrier
55
56#undef LLSC_M
libc/musl/arch/mips64/bits/alltypes.h.in created+28
...@@ -0,0 +1,28 @@
1#define _Addr long
2#define _Int64 long
3#define _Reg long
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF int wchar_t;
10#endif
11
12TYPEDEF float float_t;
13TYPEDEF double double_t;
14
15TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
16
17TYPEDEF long time_t;
18TYPEDEF long suseconds_t;
19
20TYPEDEF unsigned nlink_t;
21
22TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
23TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
24TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
25TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
26TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
27TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
28TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
libc/musl/arch/mips64/bits/endian.h created+5
...@@ -0,0 +1,5 @@
1#if _MIPSEL || __MIPSEL || __MIPSEL__
2#define __BYTE_ORDER __LITTLE_ENDIAN
3#else
4#define __BYTE_ORDER __BIG_ENDIAN
5#endif
libc/musl/arch/mips64/bits/errno.h created+134
...@@ -0,0 +1,134 @@
1#define EPERM 1
2#define ENOENT 2
3#define ESRCH 3
4#define EINTR 4
5#define EIO 5
6#define ENXIO 6
7#define E2BIG 7
8#define ENOEXEC 8
9#define EBADF 9
10#define ECHILD 10
11#define EAGAIN 11
12#define ENOMEM 12
13#define EACCES 13
14#define EFAULT 14
15#define ENOTBLK 15
16#define EBUSY 16
17#define EEXIST 17
18#define EXDEV 18
19#define ENODEV 19
20#define ENOTDIR 20
21#define EISDIR 21
22#define EINVAL 22
23#define ENFILE 23
24#define EMFILE 24
25#define ENOTTY 25
26#define ETXTBSY 26
27#define EFBIG 27
28#define ENOSPC 28
29#define ESPIPE 29
30#define EROFS 30
31#define EMLINK 31
32#define EPIPE 32
33#define EDOM 33
34#define ERANGE 34
35#define ENOMSG 35
36#define EIDRM 36
37#define ECHRNG 37
38#define EL2NSYNC 38
39#define EL3HLT 39
40#define EL3RST 40
41#define ELNRNG 41
42#define EUNATCH 42
43#define ENOCSI 43
44#define EL2HLT 44
45#define EDEADLK 45
46#define ENOLCK 46
47#define EBADE 50
48#define EBADR 51
49#define EXFULL 52
50#define ENOANO 53
51#define EBADRQC 54
52#define EBADSLT 55
53#define EDEADLOCK 56
54#define EBFONT 59
55#define ENOSTR 60
56#define ENODATA 61
57#define ETIME 62
58#define ENOSR 63
59#define ENONET 64
60#define ENOPKG 65
61#define EREMOTE 66
62#define ENOLINK 67
63#define EADV 68
64#define ESRMNT 69
65#define ECOMM 70
66#define EPROTO 71
67#define EDOTDOT 73
68#define EMULTIHOP 74
69#define EBADMSG 77
70#define ENAMETOOLONG 78
71#define EOVERFLOW 79
72#define ENOTUNIQ 80
73#define EBADFD 81
74#define EREMCHG 82
75#define ELIBACC 83
76#define ELIBBAD 84
77#define ELIBSCN 85
78#define ELIBMAX 86
79#define ELIBEXEC 87
80#define EILSEQ 88
81#define ENOSYS 89
82#define ELOOP 90
83#define ERESTART 91
84#define ESTRPIPE 92
85#define ENOTEMPTY 93
86#define EUSERS 94
87#define ENOTSOCK 95
88#define EDESTADDRREQ 96
89#define EMSGSIZE 97
90#define EPROTOTYPE 98
91#define ENOPROTOOPT 99
92#define EPROTONOSUPPORT 120
93#define ESOCKTNOSUPPORT 121
94#define EOPNOTSUPP 122
95#define ENOTSUP EOPNOTSUPP
96#define EPFNOSUPPORT 123
97#define EAFNOSUPPORT 124
98#define EADDRINUSE 125
99#define EADDRNOTAVAIL 126
100#define ENETDOWN 127
101#define ENETUNREACH 128
102#define ENETRESET 129
103#define ECONNABORTED 130
104#define ECONNRESET 131
105#define ENOBUFS 132
106#define EISCONN 133
107#define ENOTCONN 134
108#define EUCLEAN 135
109#define ENOTNAM 137
110#define ENAVAIL 138
111#define EISNAM 139
112#define EREMOTEIO 140
113#define ESHUTDOWN 143
114#define ETOOMANYREFS 144
115#define ETIMEDOUT 145
116#define ECONNREFUSED 146
117#define EHOSTDOWN 147
118#define EHOSTUNREACH 148
119#define EWOULDBLOCK EAGAIN
120#define EALREADY 149
121#define EINPROGRESS 150
122#define ESTALE 151
123#define ECANCELED 158
124#define ENOMEDIUM 159
125#define EMEDIUMTYPE 160
126#define ENOKEY 161
127#define EKEYEXPIRED 162
128#define EKEYREVOKED 163
129#define EKEYREJECTED 164
130#define EOWNERDEAD 165
131#define ENOTRECOVERABLE 166
132#define ERFKILL 167
133#define EHWPOISON 168
134#define EDQUOT 1133
libc/musl/arch/mips64/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0400
2#define O_EXCL 02000
3#define O_NOCTTY 04000
4#define O_TRUNC 01000
5#define O_APPEND 0010
6#define O_NONBLOCK 0200
7#define O_DSYNC 0020
8#define O_SYNC 040020
9#define O_RSYNC 040020
10#define O_DIRECTORY 0200000
11#define O_NOFOLLOW 0400000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 010000
15#define O_DIRECT 0100000
16#define O_LARGEFILE 0
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020200000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_SETOWN 24
29#define F_GETOWN 23
30#define F_SETSIG 10
31#define F_GETSIG 11
32
33#define F_GETLK 14
34#define F_SETLK 6
35#define F_SETLKW 7
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/mips64/bits/fenv.h created+25
...@@ -0,0 +1,25 @@
1#ifdef __mips_soft_float
2#define FE_ALL_EXCEPT 0
3#define FE_TONEAREST 0
4#else
5#define FE_INEXACT 4
6#define FE_UNDERFLOW 8
7#define FE_OVERFLOW 16
8#define FE_DIVBYZERO 32
9#define FE_INVALID 64
10
11#define FE_ALL_EXCEPT 124
12
13#define FE_TONEAREST 0
14#define FE_TOWARDZERO 1
15#define FE_UPWARD 2
16#define FE_DOWNWARD 3
17#endif
18
19typedef unsigned short fexcept_t;
20
21typedef struct {
22 unsigned __cw;
23} fenv_t;
24
25#define FE_DFL_ENV ((const fenv_t *) -1)
libc/musl/arch/mips64/bits/float.h created+16
...@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
4#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
5#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
6#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
7
8#define LDBL_MANT_DIG 113
9#define LDBL_MIN_EXP (-16381)
10#define LDBL_MAX_EXP 16384
11
12#define LDBL_DIG 33
13#define LDBL_MIN_10_EXP (-4931)
14#define LDBL_MAX_10_EXP 4932
15
16#define DECIMAL_DIG 36
libc/musl/arch/mips64/bits/hwcap.h created+3
...@@ -0,0 +1,3 @@
1#define HWCAP_MIPS_R6 (1 << 0)
2#define HWCAP_MIPS_MSA (1 << 1)
3#define HWCAP_MIPS_CRC32 (1 << 2)
libc/musl/arch/mips64/bits/ioctl.h created+212
...@@ -0,0 +1,212 @@
1#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
2#define _IOC_NONE 1U
3#define _IOC_READ 2U
4#define _IOC_WRITE 4U
5
6#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
7#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
8#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
9#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
10
11#define TCGETA 0x5401
12#define TCSETA 0x5402
13#define TCSETAW 0x5403
14#define TCSETAF 0x5404
15#define TCSBRK 0x5405
16#define TCXONC 0x5406
17#define TCFLSH 0x5407
18#define TCGETS 0x540D
19#define TCSETS 0x540E
20#define TCSETSW 0x540F
21#define TCSETSF 0x5410
22
23#define TIOCEXCL 0x740D
24#define TIOCNXCL 0x740E
25#define TIOCOUTQ 0x7472
26#define TIOCSTI 0x5472
27#define TIOCMGET 0x741D
28#define TIOCMBIS 0x741B
29#define TIOCMBIC 0x741C
30#define TIOCMSET 0x741A
31
32#define TIOCPKT 0x5470
33#define TIOCSWINSZ _IOW('t', 103, struct winsize)
34#define TIOCGWINSZ _IOR('t', 104, struct winsize)
35#define TIOCNOTTY 0x5471
36#define TIOCSETD 0x7401
37#define TIOCGETD 0x7400
38
39#define FIOCLEX 0x6601
40#define FIONCLEX 0x6602
41#define FIOASYNC 0x667D
42#define FIONBIO 0x667E
43#define FIOQSIZE 0x667F
44
45#define TIOCGLTC 0x7474
46#define TIOCSLTC 0x7475
47#define TIOCSPGRP _IOW('t', 118, int)
48#define TIOCGPGRP _IOR('t', 119, int)
49#define TIOCCONS _IOW('t', 120, int)
50
51#define FIONREAD 0x467F
52#define TIOCINQ FIONREAD
53
54#define TIOCGETP 0x7408
55#define TIOCSETP 0x7409
56#define TIOCSETN 0x740A
57
58#define TIOCSBRK 0x5427
59#define TIOCCBRK 0x5428
60#define TIOCGSID 0x7416
61#define TIOCGRS485 _IOR('T', 0x2E, char[32])
62#define TIOCSRS485 _IOWR('T', 0x2F, char[32])
63#define TIOCGPTN _IOR('T', 0x30, unsigned int)
64#define TIOCSPTLCK _IOW('T', 0x31, int)
65#define TIOCGDEV _IOR('T', 0x32, unsigned int)
66#define TIOCSIG _IOW('T', 0x36, int)
67#define TIOCVHANGUP 0x5437
68#define TIOCGPKT _IOR('T', 0x38, int)
69#define TIOCGPTLCK _IOR('T', 0x39, int)
70#define TIOCGEXCL _IOR('T', 0x40, int)
71#define TIOCGPTPEER _IO('T', 0x41)
72
73#define TIOCSCTTY 0x5480
74#define TIOCGSOFTCAR 0x5481
75#define TIOCSSOFTCAR 0x5482
76#define TIOCLINUX 0x5483
77#define TIOCGSERIAL 0x5484
78#define TIOCSSERIAL 0x5485
79#define TCSBRKP 0x5486
80
81#define TIOCSERCONFIG 0x5488
82#define TIOCSERGWILD 0x5489
83#define TIOCSERSWILD 0x548A
84#define TIOCGLCKTRMIOS 0x548B
85#define TIOCSLCKTRMIOS 0x548C
86#define TIOCSERGSTRUCT 0x548D
87#define TIOCSERGETLSR 0x548E
88#define TIOCSERGETMULTI 0x548F
89#define TIOCSERSETMULTI 0x5490
90#define TIOCMIWAIT 0x5491
91#define TIOCGICOUNT 0x5492
92
93#define TIOCPKT_DATA 0
94#define TIOCPKT_FLUSHREAD 1
95#define TIOCPKT_FLUSHWRITE 2
96#define TIOCPKT_STOP 4
97#define TIOCPKT_START 8
98#define TIOCPKT_NOSTOP 16
99#define TIOCPKT_DOSTOP 32
100#define TIOCPKT_IOCTL 64
101
102#define TIOCSER_TEMT 0x01
103
104struct winsize {
105 unsigned short ws_row;
106 unsigned short ws_col;
107 unsigned short ws_xpixel;
108 unsigned short ws_ypixel;
109};
110
111#define TIOCM_LE 0x001
112#define TIOCM_DTR 0x002
113#define TIOCM_RTS 0x004
114#define TIOCM_ST 0x010
115#define TIOCM_SR 0x020
116#define TIOCM_CTS 0x040
117#define TIOCM_CAR 0x100
118#define TIOCM_CD TIOCM_CAR
119#define TIOCM_RNG 0x200
120#define TIOCM_RI TIOCM_RNG
121#define TIOCM_DSR 0x400
122#define TIOCM_OUT1 0x2000
123#define TIOCM_OUT2 0x4000
124#define TIOCM_LOOP 0x8000
125
126#define N_TTY 0
127#define N_SLIP 1
128#define N_MOUSE 2
129#define N_PPP 3
130#define N_STRIP 4
131#define N_AX25 5
132#define N_X25 6
133#define N_6PACK 7
134#define N_MASC 8
135#define N_R3964 9
136#define N_PROFIBUS_FDL 10
137#define N_IRDA 11
138#define N_SMSBLOCK 12
139#define N_HDLC 13
140#define N_SYNC_PPP 14
141#define N_HCI 15
142
143#define FIOGETOWN _IOR('f', 123, int)
144#define FIOSETOWN _IOW('f', 124, int)
145#define SIOCATMARK _IOR('s', 7, int)
146#define SIOCSPGRP _IOW('s', 8, pid_t)
147#define SIOCGPGRP _IOR('s', 9, pid_t)
148#define SIOCGSTAMP 0x8906
149#define SIOCGSTAMPNS 0x8907
150
151#define SIOCADDRT 0x890B
152#define SIOCDELRT 0x890C
153#define SIOCRTMSG 0x890D
154
155#define SIOCGIFNAME 0x8910
156#define SIOCSIFLINK 0x8911
157#define SIOCGIFCONF 0x8912
158#define SIOCGIFFLAGS 0x8913
159#define SIOCSIFFLAGS 0x8914
160#define SIOCGIFADDR 0x8915
161#define SIOCSIFADDR 0x8916
162#define SIOCGIFDSTADDR 0x8917
163#define SIOCSIFDSTADDR 0x8918
164#define SIOCGIFBRDADDR 0x8919
165#define SIOCSIFBRDADDR 0x891a
166#define SIOCGIFNETMASK 0x891b
167#define SIOCSIFNETMASK 0x891c
168#define SIOCGIFMETRIC 0x891d
169#define SIOCSIFMETRIC 0x891e
170#define SIOCGIFMEM 0x891f
171#define SIOCSIFMEM 0x8920
172#define SIOCGIFMTU 0x8921
173#define SIOCSIFMTU 0x8922
174#define SIOCSIFNAME 0x8923
175#define SIOCSIFHWADDR 0x8924
176#define SIOCGIFENCAP 0x8925
177#define SIOCSIFENCAP 0x8926
178#define SIOCGIFHWADDR 0x8927
179#define SIOCGIFSLAVE 0x8929
180#define SIOCSIFSLAVE 0x8930
181#define SIOCADDMULTI 0x8931
182#define SIOCDELMULTI 0x8932
183#define SIOCGIFINDEX 0x8933
184#define SIOGIFINDEX SIOCGIFINDEX
185#define SIOCSIFPFLAGS 0x8934
186#define SIOCGIFPFLAGS 0x8935
187#define SIOCDIFADDR 0x8936
188#define SIOCSIFHWBROADCAST 0x8937
189#define SIOCGIFCOUNT 0x8938
190
191#define SIOCGIFBR 0x8940
192#define SIOCSIFBR 0x8941
193
194#define SIOCGIFTXQLEN 0x8942
195#define SIOCSIFTXQLEN 0x8943
196
197#define SIOCDARP 0x8953
198#define SIOCGARP 0x8954
199#define SIOCSARP 0x8955
200
201#define SIOCDRARP 0x8960
202#define SIOCGRARP 0x8961
203#define SIOCSRARP 0x8962
204
205#define SIOCGIFMAP 0x8970
206#define SIOCSIFMAP 0x8971
207
208#define SIOCADDDLCI 0x8980
209#define SIOCDELDLCI 0x8981
210
211#define SIOCDEVPRIVATE 0x89F0
212#define SIOCPROTOPRIVATE 0x89E0
libc/musl/arch/mips64/bits/ipc.h created+14
...@@ -0,0 +1,14 @@
1struct ipc_perm {
2 key_t __ipc_perm_key;
3 uid_t uid;
4 gid_t gid;
5 uid_t cuid;
6 gid_t cgid;
7 mode_t mode;
8 int __ipc_perm_seq;
9 int __pad1;
10 unsigned long __unused1;
11 unsigned long __unused2;
12};
13
14#define IPC_64 0x100
libc/musl/arch/mips64/bits/limits.h created+7
...@@ -0,0 +1,7 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define LONG_BIT 64
4#endif
5
6#define LONG_MAX 0x7fffffffffffffffL
7#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/mips64/bits/mman.h created+25
...@@ -0,0 +1,25 @@
1#undef MAP_ANON
2#define MAP_ANON 0x800
3#undef MAP_NORESERVE
4#define MAP_NORESERVE 0x0400
5#undef MAP_GROWSDOWN
6#define MAP_GROWSDOWN 0x1000
7#undef MAP_DENYWRITE
8#define MAP_DENYWRITE 0x2000
9#undef MAP_EXECUTABLE
10#define MAP_EXECUTABLE 0x4000
11#undef MAP_LOCKED
12#define MAP_LOCKED 0x8000
13#undef MAP_POPULATE
14#define MAP_POPULATE 0x10000
15#undef MAP_NONBLOCK
16#define MAP_NONBLOCK 0x20000
17#undef MAP_STACK
18#define MAP_STACK 0x40000
19#undef MAP_HUGETLB
20#define MAP_HUGETLB 0x80000
21#undef MAP_SYNC
22
23#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
24#undef MADV_SOFT_OFFLINE
25#endif
libc/musl/arch/mips64/bits/msg.h created+13
...@@ -0,0 +1,13 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 time_t msg_stime;
4 time_t msg_rtime;
5 time_t msg_ctime;
6 unsigned long msg_cbytes;
7 msgqnum_t msg_qnum;
8 msglen_t msg_qbytes;
9 pid_t msg_lspid;
10 pid_t msg_lrpid;
11 unsigned long __pad1;
12 unsigned long __pad2;
13};
libc/musl/arch/mips64/bits/poll.h created+2
...@@ -0,0 +1,2 @@
1#define POLLWRNORM POLLOUT
2#define POLLWRBAND 0x100
libc/musl/arch/mips64/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_LP64_OFFBIG 1
2#define _POSIX_V7_LP64_OFFBIG 1
libc/musl/arch/mips64/bits/ptrace.h created+9
...@@ -0,0 +1,9 @@
1#define PTRACE_GET_THREAD_AREA 25
2#define PTRACE_SET_THREAD_AREA 26
3#define PTRACE_PEEKTEXT_3264 0xc0
4#define PTRACE_PEEKDATA_3264 0xc1
5#define PTRACE_POKETEXT_3264 0xc2
6#define PTRACE_POKEDATA_3264 0xc3
7#define PTRACE_GET_THREAD_AREA_3264 0xc4
8#define PTRACE_GET_WATCH_REGS 0xd0
9#define PTRACE_SET_WATCH_REGS 0xd1
libc/musl/arch/mips64/bits/reg.h created+47
...@@ -0,0 +1,47 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
3
4#define EF_R0 0
5#define EF_R1 1
6#define EF_R2 2
7#define EF_R3 3
8#define EF_R4 4
9#define EF_R5 5
10#define EF_R6 6
11#define EF_R7 7
12#define EF_R8 8
13#define EF_R9 9
14#define EF_R10 10
15#define EF_R11 11
16#define EF_R12 12
17#define EF_R13 13
18#define EF_R14 14
19#define EF_R15 15
20#define EF_R16 16
21#define EF_R17 17
22#define EF_R18 18
23#define EF_R19 19
24#define EF_R20 20
25#define EF_R21 21
26#define EF_R22 22
27#define EF_R23 23
28#define EF_R24 24
29#define EF_R25 25
30
31#define EF_R26 26
32#define EF_R27 27
33#define EF_R28 28
34#define EF_R29 29
35#define EF_R30 30
36#define EF_R31 31
37
38#define EF_LO 32
39#define EF_HI 33
40
41#define EF_CP0_EPC 34
42#define EF_CP0_BADVADDR 35
43#define EF_CP0_STATUS 36
44#define EF_CP0_CAUSE 37
45#define EF_UNUSED0 38
46
47#define EF_SIZE 304
libc/musl/arch/mips64/bits/resource.h created+5
...@@ -0,0 +1,5 @@
1#define RLIMIT_NOFILE 5
2#define RLIMIT_AS 6
3#define RLIMIT_RSS 7
4#define RLIMIT_NPROC 8
5#define RLIMIT_MEMLOCK 9
libc/musl/arch/mips64/bits/sem.h created+14
...@@ -0,0 +1,14 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 time_t sem_otime;
4 time_t sem_ctime;
5#if __BYTE_ORDER == __LITTLE_ENDIAN
6 unsigned short sem_nsems;
7 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
8#else
9 char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
10 unsigned short sem_nsems;
11#endif
12 time_t __unused3;
13 time_t __unused4;
14};
libc/musl/arch/mips64/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long long __jmp_buf[23];
libc/musl/arch/mips64/bits/shm.h created+24
...@@ -0,0 +1,24 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 time_t shm_atime;
7 time_t shm_dtime;
8 time_t shm_ctime;
9 pid_t shm_cpid;
10 pid_t shm_lpid;
11 unsigned long shm_nattch;
12 unsigned long __pad1;
13 unsigned long __pad2;
14};
15
16struct shminfo {
17 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
18};
19
20struct shm_info {
21 int __used_ids;
22 unsigned long shm_tot, shm_rss, shm_swp;
23 unsigned long __swap_attempts, __swap_successes;
24};
libc/musl/arch/mips64/bits/signal.h created+143
...@@ -0,0 +1,143 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 2048
6#define SIGSTKSZ 8192
7#endif
8
9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10typedef unsigned long long greg_t, gregset_t[32];
11
12typedef struct {
13 union {
14 double fp_dregs[32];
15 struct {
16 float _fp_fregs;
17 unsigned _fp_pad;
18 } fp_fregs[32];
19 } fp_r;
20} fpregset_t;
21
22struct sigcontext {
23 unsigned long long sc_regs[32];
24 unsigned long long sc_fpregs[32];
25 unsigned long long sc_mdhi;
26 unsigned long long sc_hi1;
27 unsigned long long sc_hi2;
28 unsigned long long sc_hi3;
29 unsigned long long sc_mdlo;
30 unsigned long long sc_lo1;
31 unsigned long long sc_lo2;
32 unsigned long long sc_lo3;
33 unsigned long long sc_pc;
34 unsigned int sc_fpc_csr;
35 unsigned int sc_used_math;
36 unsigned int sc_dsp;
37 unsigned int sc_reserved;
38};
39
40typedef struct {
41 gregset_t gregs;
42 fpregset_t fpregs;
43 greg_t mdhi;
44 greg_t hi1;
45 greg_t hi2;
46 greg_t hi3;
47 greg_t mdlo;
48 greg_t lo1;
49 greg_t lo2;
50 greg_t lo3;
51 greg_t pc;
52 unsigned int fpc_csr;
53 unsigned int used_math;
54 unsigned int dsp;
55 unsigned int reserved;
56} mcontext_t;
57
58#else
59typedef struct {
60 unsigned long long __mc1[32];
61 double __mc2[32];
62 unsigned long long __mc3[9];
63 unsigned __mc4[4];
64} mcontext_t;
65#endif
66
67struct sigaltstack {
68 void *ss_sp;
69 size_t ss_size;
70 int ss_flags;
71};
72
73typedef struct __ucontext {
74 unsigned long uc_flags;
75 struct __ucontext *uc_link;
76 stack_t uc_stack;
77 mcontext_t uc_mcontext;
78 sigset_t uc_sigmask;
79} ucontext_t;
80
81#define SA_NOCLDSTOP 1
82#define SA_NOCLDWAIT 0x10000
83#define SA_SIGINFO 8
84#define SA_ONSTACK 0x08000000
85#define SA_RESTART 0x10000000
86#define SA_NODEFER 0x40000000
87#define SA_RESETHAND 0x80000000
88#define SA_RESTORER 0x04000000
89
90#undef SIG_BLOCK
91#undef SIG_UNBLOCK
92#undef SIG_SETMASK
93#define SIG_BLOCK 1
94#define SIG_UNBLOCK 2
95#define SIG_SETMASK 3
96
97#undef SI_ASYNCIO
98#undef SI_MESGQ
99#undef SI_TIMER
100#define SI_ASYNCIO (-2)
101#define SI_MESGQ (-4)
102#define SI_TIMER (-3)
103
104#define __SI_SWAP_ERRNO_CODE
105
106#endif
107
108#define SIGHUP 1
109#define SIGINT 2
110#define SIGQUIT 3
111#define SIGILL 4
112#define SIGTRAP 5
113#define SIGABRT 6
114#define SIGIOT SIGABRT
115#define SIGSTKFLT 7
116#define SIGFPE 8
117#define SIGKILL 9
118#define SIGBUS 10
119#define SIGSEGV 11
120#define SIGSYS 12
121#define SIGPIPE 13
122#define SIGALRM 14
123#define SIGTERM 15
124#define SIGUSR1 16
125#define SIGUSR2 17
126#define SIGCHLD 18
127#define SIGPWR 19
128#define SIGWINCH 20
129#define SIGURG 21
130#define SIGIO 22
131#define SIGPOLL SIGIO
132#define SIGSTOP 23
133#define SIGTSTP 24
134#define SIGCONT 25
135#define SIGTTIN 26
136#define SIGTTOU 27
137#define SIGVTALRM 28
138#define SIGPROF 29
139#define SIGXCPU 30
140#define SIGXFSZ 31
141#define SIGUNUSED SIGSYS
142
143#define _NSIG 128
libc/musl/arch/mips64/bits/socket.h created+69
...@@ -0,0 +1,69 @@
1#include <endian.h>
2
3struct msghdr {
4 void *msg_name;
5 socklen_t msg_namelen;
6 struct iovec *msg_iov;
7#if __BYTE_ORDER == __BIG_ENDIAN
8 int __pad1, msg_iovlen;
9#else
10 int msg_iovlen, __pad1;
11#endif
12 void *msg_control;
13#if __BYTE_ORDER == __BIG_ENDIAN
14 int __pad2;
15 socklen_t msg_controllen;
16#else
17 socklen_t msg_controllen;
18 int __pad2;
19#endif
20 int msg_flags;
21};
22
23struct cmsghdr {
24#if __BYTE_ORDER == __BIG_ENDIAN
25 int __pad1;
26 socklen_t cmsg_len;
27#else
28 socklen_t cmsg_len;
29 int __pad1;
30#endif
31 int cmsg_level;
32 int cmsg_type;
33};
34
35#define SOCK_STREAM 2
36#define SOCK_DGRAM 1
37#define SOL_SOCKET 65535
38#define SO_DEBUG 1
39
40#define SO_REUSEADDR 0x0004
41#define SO_KEEPALIVE 0x0008
42#define SO_DONTROUTE 0x0010
43#define SO_BROADCAST 0x0020
44#define SO_LINGER 0x0080
45#define SO_OOBINLINE 0x0100
46#define SO_REUSEPORT 0x0200
47#define SO_SNDBUF 0x1001
48#define SO_RCVBUF 0x1002
49#define SO_SNDLOWAT 0x1003
50#define SO_RCVLOWAT 0x1004
51#define SO_RCVTIMEO 0x1006
52#define SO_SNDTIMEO 0x1005
53#define SO_ERROR 0x1007
54#define SO_TYPE 0x1008
55#define SO_ACCEPTCONN 0x1009
56#define SO_PROTOCOL 0x1028
57#define SO_DOMAIN 0x1029
58
59#define SO_NO_CHECK 11
60#define SO_PRIORITY 12
61#define SO_BSDCOMPAT 14
62#define SO_PASSCRED 17
63#define SO_PEERCRED 18
64#define SO_PEERSEC 30
65#define SO_SNDBUFFORCE 31
66#define SO_RCVBUFFORCE 33
67
68#define SOCK_NONBLOCK 0200
69#define SOCK_CLOEXEC 02000000
libc/musl/arch/mips64/bits/stat.h created+23
...@@ -0,0 +1,23 @@
1#include <string.h>
2#include <bits/alltypes.h>
3
4struct stat {
5 dev_t st_dev;
6 int __pad1[3];
7 ino_t st_ino;
8 mode_t st_mode;
9 nlink_t st_nlink;
10 uid_t st_uid;
11 gid_t st_gid;
12 dev_t st_rdev;
13 unsigned int __pad2[2];
14 off_t st_size;
15 int __pad3;
16 struct timespec st_atim;
17 struct timespec st_mtim;
18 struct timespec st_ctim;
19 blksize_t st_blksize;
20 unsigned int __pad4;
21 blkcnt_t st_blocks;
22 int __pad5[14];
23};
libc/musl/arch/mips64/bits/statfs.h created+8
...@@ -0,0 +1,8 @@
1struct statfs {
2 unsigned long f_type, f_bsize, f_frsize;
3 fsblkcnt_t f_blocks, f_bfree;
4 fsfilcnt_t f_files, f_ffree;
5 fsblkcnt_t f_bavail;
6 fsid_t f_fsid;
7 unsigned long f_namelen, f_flags, f_spare[5];
8};
libc/musl/arch/mips64/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT64_MIN
16#define INTPTR_MAX INT64_MAX
17#define UINTPTR_MAX UINT64_MAX
18#define PTRDIFF_MIN INT64_MIN
19#define PTRDIFF_MAX INT64_MAX
20#define SIZE_MAX UINT64_MAX
libc/musl/arch/mips64/bits/syscall.h.in created+329
...@@ -0,0 +1,329 @@
1#define __NR_read 5000
2#define __NR_write 5001
3#define __NR_open 5002
4#define __NR_close 5003
5#define __NR_stat 5004
6#define __NR_fstat 5005
7#define __NR_lstat 5006
8#define __NR_poll 5007
9#define __NR_lseek 5008
10#define __NR_mmap 5009
11#define __NR_mprotect 5010
12#define __NR_munmap 5011
13#define __NR_brk 5012
14#define __NR_rt_sigaction 5013
15#define __NR_rt_sigprocmask 5014
16#define __NR_ioctl 5015
17#define __NR_pread64 5016
18#define __NR_pwrite64 5017
19#define __NR_readv 5018
20#define __NR_writev 5019
21#define __NR_access 5020
22#define __NR_pipe 5021
23#define __NR__newselect 5022
24#define __NR_sched_yield 5023
25#define __NR_mremap 5024
26#define __NR_msync 5025
27#define __NR_mincore 5026
28#define __NR_madvise 5027
29#define __NR_shmget 5028
30#define __NR_shmat 5029
31#define __NR_shmctl 5030
32#define __NR_dup 5031
33#define __NR_dup2 5032
34#define __NR_pause 5033
35#define __NR_nanosleep 5034
36#define __NR_getitimer 5035
37#define __NR_setitimer 5036
38#define __NR_alarm 5037
39#define __NR_getpid 5038
40#define __NR_sendfile 5039
41#define __NR_socket 5040
42#define __NR_connect 5041
43#define __NR_accept 5042
44#define __NR_sendto 5043
45#define __NR_recvfrom 5044
46#define __NR_sendmsg 5045
47#define __NR_recvmsg 5046
48#define __NR_shutdown 5047
49#define __NR_bind 5048
50#define __NR_listen 5049
51#define __NR_getsockname 5050
52#define __NR_getpeername 5051
53#define __NR_socketpair 5052
54#define __NR_setsockopt 5053
55#define __NR_getsockopt 5054
56#define __NR_clone 5055
57#define __NR_fork 5056
58#define __NR_execve 5057
59#define __NR_exit 5058
60#define __NR_wait4 5059
61#define __NR_kill 5060
62#define __NR_uname 5061
63#define __NR_semget 5062
64#define __NR_semop 5063
65#define __NR_semctl 5064
66#define __NR_shmdt 5065
67#define __NR_msgget 5066
68#define __NR_msgsnd 5067
69#define __NR_msgrcv 5068
70#define __NR_msgctl 5069
71#define __NR_fcntl 5070
72#define __NR_flock 5071
73#define __NR_fsync 5072
74#define __NR_fdatasync 5073
75#define __NR_truncate 5074
76#define __NR_ftruncate 5075
77#define __NR_getdents 5076
78#define __NR_getcwd 5077
79#define __NR_chdir 5078
80#define __NR_fchdir 5079
81#define __NR_rename 5080
82#define __NR_mkdir 5081
83#define __NR_rmdir 5082
84#define __NR_creat 5083
85#define __NR_link 5084
86#define __NR_unlink 5085
87#define __NR_symlink 5086
88#define __NR_readlink 5087
89#define __NR_chmod 5088
90#define __NR_fchmod 5089
91#define __NR_chown 5090
92#define __NR_fchown 5091
93#define __NR_lchown 5092
94#define __NR_umask 5093
95#define __NR_gettimeofday 5094
96#define __NR_getrlimit 5095
97#define __NR_getrusage 5096
98#define __NR_sysinfo 5097
99#define __NR_times 5098
100#define __NR_ptrace 5099
101#define __NR_getuid 5100
102#define __NR_syslog 5101
103#define __NR_getgid 5102
104#define __NR_setuid 5103
105#define __NR_setgid 5104
106#define __NR_geteuid 5105
107#define __NR_getegid 5106
108#define __NR_setpgid 5107
109#define __NR_getppid 5108
110#define __NR_getpgrp 5109
111#define __NR_setsid 5110
112#define __NR_setreuid 5111
113#define __NR_setregid 5112
114#define __NR_getgroups 5113
115#define __NR_setgroups 5114
116#define __NR_setresuid 5115
117#define __NR_getresuid 5116
118#define __NR_setresgid 5117
119#define __NR_getresgid 5118
120#define __NR_getpgid 5119
121#define __NR_setfsuid 5120
122#define __NR_setfsgid 5121
123#define __NR_getsid 5122
124#define __NR_capget 5123
125#define __NR_capset 5124
126#define __NR_rt_sigpending 5125
127#define __NR_rt_sigtimedwait 5126
128#define __NR_rt_sigqueueinfo 5127
129#define __NR_rt_sigsuspend 5128
130#define __NR_sigaltstack 5129
131#define __NR_utime 5130
132#define __NR_mknod 5131
133#define __NR_personality 5132
134#define __NR_ustat 5133
135#define __NR_statfs 5134
136#define __NR_fstatfs 5135
137#define __NR_sysfs 5136
138#define __NR_getpriority 5137
139#define __NR_setpriority 5138
140#define __NR_sched_setparam 5139
141#define __NR_sched_getparam 5140
142#define __NR_sched_setscheduler 5141
143#define __NR_sched_getscheduler 5142
144#define __NR_sched_get_priority_max 5143
145#define __NR_sched_get_priority_min 5144
146#define __NR_sched_rr_get_interval 5145
147#define __NR_mlock 5146
148#define __NR_munlock 5147
149#define __NR_mlockall 5148
150#define __NR_munlockall 5149
151#define __NR_vhangup 5150
152#define __NR_pivot_root 5151
153#define __NR__sysctl 5152
154#define __NR_prctl 5153
155#define __NR_adjtimex 5154
156#define __NR_setrlimit 5155
157#define __NR_chroot 5156
158#define __NR_sync 5157
159#define __NR_acct 5158
160#define __NR_settimeofday 5159
161#define __NR_mount 5160
162#define __NR_umount2 5161
163#define __NR_swapon 5162
164#define __NR_swapoff 5163
165#define __NR_reboot 5164
166#define __NR_sethostname 5165
167#define __NR_setdomainname 5166
168#define __NR_create_module 5167
169#define __NR_init_module 5168
170#define __NR_delete_module 5169
171#define __NR_get_kernel_syms 5170
172#define __NR_query_module 5171
173#define __NR_quotactl 5172
174#define __NR_nfsservctl 5173
175#define __NR_getpmsg 5174
176#define __NR_putpmsg 5175
177#define __NR_afs_syscall 5176
178#define __NR_reserved177 5177
179#define __NR_gettid 5178
180#define __NR_readahead 5179
181#define __NR_setxattr 5180
182#define __NR_lsetxattr 5181
183#define __NR_fsetxattr 5182
184#define __NR_getxattr 5183
185#define __NR_lgetxattr 5184
186#define __NR_fgetxattr 5185
187#define __NR_listxattr 5186
188#define __NR_llistxattr 5187
189#define __NR_flistxattr 5188
190#define __NR_removexattr 5189
191#define __NR_lremovexattr 5190
192#define __NR_fremovexattr 5191
193#define __NR_tkill 5192
194#define __NR_reserved193 5193
195#define __NR_futex 5194
196#define __NR_sched_setaffinity 5195
197#define __NR_sched_getaffinity 5196
198#define __NR_cacheflush 5197
199#define __NR_cachectl 5198
200#define __NR_sysmips 5199
201#define __NR_io_setup 5200
202#define __NR_io_destroy 5201
203#define __NR_io_getevents 5202
204#define __NR_io_submit 5203
205#define __NR_io_cancel 5204
206#define __NR_exit_group 5205
207#define __NR_lookup_dcookie 5206
208#define __NR_epoll_create 5207
209#define __NR_epoll_ctl 5208
210#define __NR_epoll_wait 5209
211#define __NR_remap_file_pages 5210
212#define __NR_rt_sigreturn 5211
213#define __NR_set_tid_address 5212
214#define __NR_restart_syscall 5213
215#define __NR_semtimedop 5214
216#define __NR_fadvise64 5215
217#define __NR_timer_create 5216
218#define __NR_timer_settime 5217
219#define __NR_timer_gettime 5218
220#define __NR_timer_getoverrun 5219
221#define __NR_timer_delete 5220
222#define __NR_clock_settime 5221
223#define __NR_clock_gettime 5222
224#define __NR_clock_getres 5223
225#define __NR_clock_nanosleep 5224
226#define __NR_tgkill 5225
227#define __NR_utimes 5226
228#define __NR_mbind 5227
229#define __NR_get_mempolicy 5228
230#define __NR_set_mempolicy 5229
231#define __NR_mq_open 5230
232#define __NR_mq_unlink 5231
233#define __NR_mq_timedsend 5232
234#define __NR_mq_timedreceive 5233
235#define __NR_mq_notify 5234
236#define __NR_mq_getsetattr 5235
237#define __NR_vserver 5236
238#define __NR_waitid 5237
239#define __NR_add_key 5239
240#define __NR_request_key 5240
241#define __NR_keyctl 5241
242#define __NR_set_thread_area 5242
243#define __NR_inotify_init 5243
244#define __NR_inotify_add_watch 5244
245#define __NR_inotify_rm_watch 5245
246#define __NR_migrate_pages 5246
247#define __NR_openat 5247
248#define __NR_mkdirat 5248
249#define __NR_mknodat 5249
250#define __NR_fchownat 5250
251#define __NR_futimesat 5251
252#define __NR_newfstatat 5252
253#define __NR_unlinkat 5253
254#define __NR_renameat 5254
255#define __NR_linkat 5255
256#define __NR_symlinkat 5256
257#define __NR_readlinkat 5257
258#define __NR_fchmodat 5258
259#define __NR_faccessat 5259
260#define __NR_pselect6 5260
261#define __NR_ppoll 5261
262#define __NR_unshare 5262
263#define __NR_splice 5263
264#define __NR_sync_file_range 5264
265#define __NR_tee 5265
266#define __NR_vmsplice 5266
267#define __NR_move_pages 5267
268#define __NR_set_robust_list 5268
269#define __NR_get_robust_list 5269
270#define __NR_kexec_load 5270
271#define __NR_getcpu 5271
272#define __NR_epoll_pwait 5272
273#define __NR_ioprio_set 5273
274#define __NR_ioprio_get 5274
275#define __NR_utimensat 5275
276#define __NR_signalfd 5276
277#define __NR_timerfd 5277
278#define __NR_eventfd 5278
279#define __NR_fallocate 5279
280#define __NR_timerfd_create 5280
281#define __NR_timerfd_gettime 5281
282#define __NR_timerfd_settime 5282
283#define __NR_signalfd4 5283
284#define __NR_eventfd2 5284
285#define __NR_epoll_create1 5285
286#define __NR_dup3 5286
287#define __NR_pipe2 5287
288#define __NR_inotify_init1 5288
289#define __NR_preadv 5289
290#define __NR_pwritev 5290
291#define __NR_rt_tgsigqueueinfo 5291
292#define __NR_perf_event_open 5292
293#define __NR_accept4 5293
294#define __NR_recvmmsg 5294
295#define __NR_fanotify_init 5295
296#define __NR_fanotify_mark 5296
297#define __NR_prlimit64 5297
298#define __NR_name_to_handle_at 5298
299#define __NR_open_by_handle_at 5299
300#define __NR_clock_adjtime 5300
301#define __NR_syncfs 5301
302#define __NR_sendmmsg 5302
303#define __NR_setns 5303
304#define __NR_process_vm_readv 5304
305#define __NR_process_vm_writev 5305
306#define __NR_kcmp 5306
307#define __NR_finit_module 5307
308#define __NR_getdents64 5308
309#define __NR_sched_setattr 5309
310#define __NR_sched_getattr 5310
311#define __NR_renameat2 5311
312#define __NR_seccomp 5312
313#define __NR_getrandom 5313
314#define __NR_memfd_create 5314
315#define __NR_bpf 5315
316#define __NR_execveat 5316
317#define __NR_userfaultfd 5317
318#define __NR_membarrier 5318
319#define __NR_mlock2 5319
320#define __NR_copy_file_range 5320
321#define __NR_preadv2 5321
322#define __NR_pwritev2 5322
323#define __NR_pkey_mprotect 5323
324#define __NR_pkey_alloc 5324
325#define __NR_pkey_free 5325
326#define __NR_statx 5326
327#define __NR_rseq 4327
328#define __NR_io_pgetevents 4328
329
libc/musl/arch/mips64/bits/termios.h created+169
...@@ -0,0 +1,169 @@
1struct termios {
2 tcflag_t c_iflag;
3 tcflag_t c_oflag;
4 tcflag_t c_cflag;
5 tcflag_t c_lflag;
6 cc_t c_line;
7 cc_t c_cc[NCCS];
8 speed_t __c_ispeed;
9 speed_t __c_ospeed;
10};
11
12#define VINTR 0
13#define VQUIT 1
14#define VERASE 2
15#define VKILL 3
16#define VMIN 4
17#define VTIME 5
18#define VEOL2 6
19#define VSWTC 7
20#define VSWTCH 7
21#define VSTART 8
22#define VSTOP 9
23#define VSUSP 10
24#define VREPRINT 12
25#define VDISCARD 13
26#define VWERASE 14
27#define VLNEXT 15
28#define VEOF 16
29#define VEOL 17
30
31#define IGNBRK 0000001
32#define BRKINT 0000002
33#define IGNPAR 0000004
34#define PARMRK 0000010
35#define INPCK 0000020
36#define ISTRIP 0000040
37#define INLCR 0000100
38#define IGNCR 0000200
39#define ICRNL 0000400
40#define IUCLC 0001000
41#define IXON 0002000
42#define IXANY 0004000
43#define IXOFF 0010000
44#define IMAXBEL 0020000
45#define IUTF8 0040000
46
47#define OPOST 0000001
48#define OLCUC 0000002
49#define ONLCR 0000004
50#define OCRNL 0000010
51#define ONOCR 0000020
52#define ONLRET 0000040
53#define OFILL 0000100
54#define OFDEL 0000200
55#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
56#define NLDLY 0000400
57#define NL0 0000000
58#define NL1 0000400
59#define CRDLY 0003000
60#define CR0 0000000
61#define CR1 0001000
62#define CR2 0002000
63#define CR3 0003000
64#define TABDLY 0014000
65#define TAB0 0000000
66#define TAB1 0004000
67#define TAB2 0010000
68#define TAB3 0014000
69#define BSDLY 0020000
70#define BS0 0000000
71#define BS1 0020000
72#define FFDLY 0100000
73#define FF0 0000000
74#define FF1 0100000
75#endif
76
77#define VTDLY 0040000
78#define VT0 0000000
79#define VT1 0040000
80
81#define B0 0000000
82#define B50 0000001
83#define B75 0000002
84#define B110 0000003
85#define B134 0000004
86#define B150 0000005
87#define B200 0000006
88#define B300 0000007
89#define B600 0000010
90#define B1200 0000011
91#define B1800 0000012
92#define B2400 0000013
93#define B4800 0000014
94#define B9600 0000015
95#define B19200 0000016
96#define B38400 0000017
97
98#define B57600 0010001
99#define B115200 0010002
100#define B230400 0010003
101#define B460800 0010004
102#define B500000 0010005
103#define B576000 0010006
104#define B921600 0010007
105#define B1000000 0010010
106#define B1152000 0010011
107#define B1500000 0010012
108#define B2000000 0010013
109#define B2500000 0010014
110#define B3000000 0010015
111#define B3500000 0010016
112#define B4000000 0010017
113
114#define CSIZE 0000060
115#define CS5 0000000
116#define CS6 0000020
117#define CS7 0000040
118#define CS8 0000060
119#define CSTOPB 0000100
120#define CREAD 0000200
121#define PARENB 0000400
122#define PARODD 0001000
123#define HUPCL 0002000
124#define CLOCAL 0004000
125
126#define ISIG 0000001
127#define ICANON 0000002
128#define ECHO 0000010
129#define ECHOE 0000020
130#define ECHOK 0000040
131#define ECHONL 0000100
132#define NOFLSH 0000200
133#define IEXTEN 0000400
134#define TOSTOP 0100000
135#define ITOSTOP 0100000
136
137#define TCOOFF 0
138#define TCOON 1
139#define TCIOFF 2
140#define TCION 3
141
142#define TCIFLUSH 0
143#define TCOFLUSH 1
144#define TCIOFLUSH 2
145
146#define TCSANOW 0
147#define TCSADRAIN 1
148#define TCSAFLUSH 2
149
150#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
151#define EXTA 0000016
152#define EXTB 0000017
153#define CBAUD 0010017
154#define CBAUDEX 0010000
155#define CIBAUD 002003600000
156#define CMSPAR 010000000000
157#define CRTSCTS 020000000000
158
159#define XCASE 0000004
160#define ECHOCTL 0001000
161#define ECHOPRT 0002000
162#define ECHOKE 0004000
163#define FLUSHO 0020000
164#define PENDIN 0040000
165#define EXTPROC 0200000
166
167#define XTABS 0014000
168#define TIOCSER_TEMT 0x01
169#endif
libc/musl/arch/mips64/bits/user.h created+15
...@@ -0,0 +1,15 @@
1struct user {
2 unsigned long regs[102];
3 unsigned long u_tsize, u_dsize, u_ssize;
4 unsigned long long start_code, start_data, start_stack;
5 long long signal;
6 unsigned long long *u_ar0;
7 unsigned long long magic;
8 char u_comm[32];
9};
10
11#define ELF_NGREG 45
12#define ELF_NFPREG 33
13
14typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
15typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
libc/musl/arch/mips64/crt_arch.h created+33
...@@ -0,0 +1,33 @@
1__asm__(
2".set push\n"
3".set noreorder\n"
4".text \n"
5".global _" START "\n"
6".global " START "\n"
7".global " START "_data\n"
8".type _" START ", @function\n"
9".type " START ", @function\n"
10".type " START "_data, @function\n"
11"_" START ":\n"
12"" START ":\n"
13".align 8 \n"
14" bal 1f \n"
15" move $fp, $0 \n"
16"" START "_data: \n"
17" .gpdword " START "_data \n"
18" .gpdword " START "_c \n"
19".weak _DYNAMIC \n"
20".hidden _DYNAMIC \n"
21" .gpdword _DYNAMIC \n"
22"1: ld $gp, 0($ra) \n"
23" dsubu $gp, $ra, $gp \n"
24" move $4, $sp \n"
25" ld $5, 16($ra) \n"
26" daddu $5, $5, $gp \n"
27" ld $25, 8($ra) \n"
28" daddu $25, $25, $gp \n"
29" and $sp, $sp, -16 \n"
30" jalr $25 \n"
31" nop \n"
32".set pop \n"
33);
libc/musl/arch/mips64/ksigaction.h created+10
...@@ -0,0 +1,10 @@
1#include <features.h>
2
3struct k_sigaction {
4 unsigned flags;
5 void (*handler)(int);
6 unsigned long mask[2];
7 void (*restorer)();
8};
9
10hidden void __restore(), __restore_rt();
libc/musl/arch/mips64/pthread_arch.h created+19
...@@ -0,0 +1,19 @@
1static inline struct pthread *__pthread_self()
2{
3#if __mips_isa_rev < 2
4 register char *tp __asm__("$3");
5 __asm__ (".word 0x7c03e83b" : "=r" (tp) );
6#else
7 char *tp;
8 __asm__ ("rdhwr %0, $29" : "=r" (tp) );
9#endif
10 return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
11}
12
13#define TLS_ABOVE_TP
14#define GAP_ABOVE_TP 0
15#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
16
17#define DTP_OFFSET 0x8000
18
19#define MC_PC pc
libc/musl/arch/mips64/reloc.h created+66
...@@ -0,0 +1,66 @@
1#ifndef __RELOC_H__
2#define __RELOC_H__
3
4#define _GNU_SOURCE
5#include <endian.h>
6
7#if __mips_isa_rev >= 6
8#define ISA_SUFFIX "r6"
9#else
10#define ISA_SUFFIX ""
11#endif
12
13#if __BYTE_ORDER == __LITTLE_ENDIAN
14#define ENDIAN_SUFFIX "el"
15#else
16#define ENDIAN_SUFFIX ""
17#endif
18
19#ifdef __mips_soft_float
20#define FP_SUFFIX "-sf"
21#else
22#define FP_SUFFIX ""
23#endif
24
25#define LDSO_ARCH "mips64" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX
26
27#define TPOFF_K (-0x7000)
28
29#define REL_SYM_OR_REL 4611
30#define REL_PLT R_MIPS_JUMP_SLOT
31#define REL_COPY R_MIPS_COPY
32#define REL_DTPMOD R_MIPS_TLS_DTPMOD64
33#define REL_DTPOFF R_MIPS_TLS_DTPREL64
34#define REL_TPOFF R_MIPS_TLS_TPREL64
35
36#undef R_TYPE
37#undef R_SYM
38#undef R_INFO
39#define R_TYPE(x) (be64toh(x)&0x7fffffff)
40#define R_SYM(x) (be32toh(be64toh(x)>>32))
41#define R_INFO(s,t) (htobe64((uint64_t)htobe32(s)<<32 | (uint64_t)t))
42
43#define NEED_MIPS_GOT_RELOCS 1
44#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
45#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
46
47#define CRTJMP(pc,sp) __asm__ __volatile__( \
48 "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
49
50#define GETFUNCSYM(fp, sym, got) __asm__ ( \
51 ".hidden " #sym "\n" \
52 ".set push \n" \
53 ".set noreorder \n" \
54 ".align 8 \n" \
55 " bal 1f \n" \
56 " nop \n" \
57 " .gpdword . \n" \
58 " .gpdword " #sym " \n" \
59 "1: ld %0, ($ra) \n" \
60 " dsubu %0, $ra, %0 \n" \
61 " ld $ra, 8($ra) \n" \
62 " daddu %0, %0, $ra \n" \
63 ".set pop \n" \
64 : "=r"(*(fp)) : : "memory", "ra" )
65
66#endif
libc/musl/arch/mips64/syscall_arch.h created+225
...@@ -0,0 +1,225 @@
1#define __SYSCALL_LL_E(x) (x)
2#define __SYSCALL_LL_O(x) (x)
3
4__attribute__((visibility("hidden")))
5long (__syscall)(long, ...);
6
7#define SYSCALL_RLIM_INFINITY (-1UL/2)
8
9#include <sys/stat.h>
10struct kernel_stat {
11 unsigned int st_dev;
12 unsigned int __pad1[3];
13 unsigned long long st_ino;
14 unsigned int st_mode;
15 unsigned int st_nlink;
16 int st_uid;
17 int st_gid;
18 unsigned int st_rdev;
19 unsigned int __pad2[3];
20 long long st_size;
21 unsigned int st_atime_sec;
22 unsigned int st_atime_nsec;
23 unsigned int st_mtime_sec;
24 unsigned int st_mtime_nsec;
25 unsigned int st_ctime_sec;
26 unsigned int st_ctime_nsec;
27 unsigned int st_blksize;
28 unsigned int __pad3;
29 unsigned long long st_blocks;
30};
31
32static void __stat_fix(struct kernel_stat *kst, struct stat *st)
33{
34 st->st_dev = kst->st_dev;
35 st->st_ino = kst->st_ino;
36 st->st_mode = kst->st_mode;
37 st->st_nlink = kst->st_nlink;
38 st->st_uid = kst->st_uid;
39 st->st_gid = kst->st_gid;
40 st->st_rdev = kst->st_rdev;
41 st->st_size = kst->st_size;
42 st->st_atim.tv_sec = kst->st_atime_sec;
43 st->st_atim.tv_nsec = kst->st_atime_nsec;
44 st->st_mtim.tv_sec = kst->st_mtime_sec;
45 st->st_mtim.tv_nsec = kst->st_mtime_nsec;
46 st->st_ctim.tv_sec = kst->st_ctime_sec;
47 st->st_ctim.tv_nsec = kst->st_ctime_nsec;
48 st->st_blksize = kst->st_blksize;
49 st->st_blocks = kst->st_blocks;
50}
51
52static inline long __syscall0(long n)
53{
54 register long r7 __asm__("$7");
55 register long r2 __asm__("$2");
56 __asm__ __volatile__ (
57 "daddu $2,$0,%2 ; syscall"
58 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
59 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
60 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
61 return r7 ? -r2 : r2;
62}
63
64static inline long __syscall1(long n, long a)
65{
66 register long r4 __asm__("$4") = a;
67 register long r7 __asm__("$7");
68 register long r2 __asm__("$2");
69 __asm__ __volatile__ (
70 "daddu $2,$0,%2 ; syscall"
71 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
72 "r"(r4)
73 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
74 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
75 return r7 ? -r2 : r2;
76}
77
78static inline long __syscall2(long n, long a, long b)
79{
80 struct kernel_stat kst;
81 long ret;
82 register long r4 __asm__("$4");
83 register long r5 __asm__("$5");
84 register long r7 __asm__("$7");
85 register long r2 __asm__("$2");
86
87 r5 = b;
88 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
89 r5 = (long) &kst;
90
91 r4 = a;
92 __asm__ __volatile__ (
93 "daddu $2,$0,%2 ; syscall"
94 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
95 "r"(r4), "r"(r5)
96 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
97 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
98
99 if (r7) return -r2;
100 ret = r2;
101
102 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
103 __stat_fix(&kst, (struct stat *)b);
104
105 return ret;
106}
107
108static inline long __syscall3(long n, long a, long b, long c)
109{
110 struct kernel_stat kst;
111 long ret;
112 register long r4 __asm__("$4");
113 register long r5 __asm__("$5");
114 register long r6 __asm__("$6");
115 register long r7 __asm__("$7");
116 register long r2 __asm__("$2");
117
118 r5 = b;
119 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
120 r5 = (long) &kst;
121
122 r4 = a;
123 r6 = c;
124 __asm__ __volatile__ (
125 "daddu $2,$0,%2 ; syscall"
126 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
127 "r"(r4), "r"(r5), "r"(r6)
128 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
129 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
130
131 if (r7) return -r2;
132 ret = r2;
133
134 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
135 __stat_fix(&kst, (struct stat *)b);
136
137 return ret;
138}
139
140static inline long __syscall4(long n, long a, long b, long c, long d)
141{
142 struct kernel_stat kst;
143 long ret;
144 register long r4 __asm__("$4");
145 register long r5 __asm__("$5");
146 register long r6 __asm__("$6");
147 register long r7 __asm__("$7");
148 register long r2 __asm__("$2");
149
150 r4 = a;
151 r5 = b;
152 r6 = c;
153 r7 = d;
154 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
155 r5 = (long) &kst;
156 if (n == SYS_newfstatat)
157 r6 = (long) &kst;
158
159 __asm__ __volatile__ (
160 "daddu $2,$0,%2 ; syscall"
161 : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
162 "r"(r4), "r"(r5), "r"(r6)
163 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
164 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
165
166 if (r7) return -r2;
167 ret = r2;
168
169 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
170 __stat_fix(&kst, (struct stat *)b);
171 if (n == SYS_newfstatat)
172 __stat_fix(&kst, (struct stat *)c);
173
174 return ret;
175}
176
177static inline long __syscall5(long n, long a, long b, long c, long d, long e)
178{
179 long r2;
180 long old_b = b;
181 long old_c = c;
182 struct kernel_stat kst;
183
184 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
185 b = (long) &kst;
186 if (n == SYS_newfstatat)
187 c = (long) &kst;
188
189 r2 = (__syscall)(n, a, b, c, d, e);
190 if (r2 > -4096UL) return r2;
191
192 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
193 __stat_fix(&kst, (struct stat *)old_b);
194 if (n == SYS_newfstatat)
195 __stat_fix(&kst, (struct stat *)old_c);
196
197 return r2;
198}
199
200static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
201{
202 long r2;
203 long old_b = b;
204 long old_c = c;
205 struct kernel_stat kst;
206
207 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
208 b = (long) &kst;
209 if (n == SYS_newfstatat)
210 c = (long) &kst;
211
212 r2 = (__syscall)(n, a, b, c, d, e, f);
213 if (r2 > -4096UL) return r2;
214
215 if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
216 __stat_fix(&kst, (struct stat *)old_b);
217 if (n == SYS_newfstatat)
218 __stat_fix(&kst, (struct stat *)old_c);
219
220 return r2;
221}
222
223#define VDSO_USEFUL
224#define VDSO_CGT_SYM "__vdso_clock_gettime"
225#define VDSO_CGT_VER "LINUX_2.6"
libc/musl/arch/powerpc/atomic_arch.h created+38
...@@ -0,0 +1,38 @@
1#define a_ll a_ll
2static inline int a_ll(volatile int *p)
3{
4 int v;
5 __asm__ __volatile__ ("lwarx %0, 0, %2" : "=r"(v) : "m"(*p), "r"(p));
6 return v;
7}
8
9#define a_sc a_sc
10static inline int a_sc(volatile int *p, int v)
11{
12 int r;
13 __asm__ __volatile__ (
14 "stwcx. %2, 0, %3 ; mfcr %0"
15 : "=r"(r), "=m"(*p) : "r"(v), "r"(p) : "memory", "cc");
16 return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
17}
18
19#define a_barrier a_barrier
20static inline void a_barrier()
21{
22 __asm__ __volatile__ ("sync" : : : "memory");
23}
24
25#define a_pre_llsc a_barrier
26
27#define a_post_llsc a_post_llsc
28static inline void a_post_llsc()
29{
30 __asm__ __volatile__ ("isync" : : : "memory");
31}
32
33#define a_clz_32 a_clz_32
34static inline int a_clz_32(uint32_t x)
35{
36 __asm__ ("cntlzw %0, %1" : "=r"(x) : "r"(x));
37 return x;
38}
libc/musl/arch/powerpc/bits/alltypes.h.in created+26
...@@ -0,0 +1,26 @@
1#define _Addr int
2#define _Int64 long long
3#define _Reg int
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF long wchar_t;
10#endif
11
12TYPEDEF float float_t;
13TYPEDEF double double_t;
14
15TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
16
17TYPEDEF long time_t;
18TYPEDEF long suseconds_t;
19
20TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
21TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
22TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
23TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
24TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
25TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
26TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
libc/musl/arch/powerpc/bits/endian.h created+15
...@@ -0,0 +1,15 @@
1#ifdef __BIG_ENDIAN__
2 #if __BIG_ENDIAN__
3 #define __BYTE_ORDER __BIG_ENDIAN
4 #endif
5#endif /* __BIG_ENDIAN__ */
6
7#ifdef __LITTLE_ENDIAN__
8 #if __LITTLE_ENDIAN__
9 #define __BYTE_ORDER __LITTLE_ENDIAN
10 #endif
11#endif /* __LITTLE_ENDIAN__ */
12
13#ifndef __BYTE_ORDER
14 #define __BYTE_ORDER __BIG_ENDIAN
15#endif
libc/musl/arch/powerpc/bits/errno.h created+134
...@@ -0,0 +1,134 @@
1#define EPERM 1
2#define ENOENT 2
3#define ESRCH 3
4#define EINTR 4
5#define EIO 5
6#define ENXIO 6
7#define E2BIG 7
8#define ENOEXEC 8
9#define EBADF 9
10#define ECHILD 10
11#define EAGAIN 11
12#define ENOMEM 12
13#define EACCES 13
14#define EFAULT 14
15#define ENOTBLK 15
16#define EBUSY 16
17#define EEXIST 17
18#define EXDEV 18
19#define ENODEV 19
20#define ENOTDIR 20
21#define EISDIR 21
22#define EINVAL 22
23#define ENFILE 23
24#define EMFILE 24
25#define ENOTTY 25
26#define ETXTBSY 26
27#define EFBIG 27
28#define ENOSPC 28
29#define ESPIPE 29
30#define EROFS 30
31#define EMLINK 31
32#define EPIPE 32
33#define EDOM 33
34#define ERANGE 34
35#define EDEADLK 35
36#define ENAMETOOLONG 36
37#define ENOLCK 37
38#define ENOSYS 38
39#define ENOTEMPTY 39
40#define ELOOP 40
41#define EWOULDBLOCK EAGAIN
42#define ENOMSG 42
43#define EIDRM 43
44#define ECHRNG 44
45#define EL2NSYNC 45
46#define EL3HLT 46
47#define EL3RST 47
48#define ELNRNG 48
49#define EUNATCH 49
50#define ENOCSI 50
51#define EL2HLT 51
52#define EBADE 52
53#define EBADR 53
54#define EXFULL 54
55#define ENOANO 55
56#define EBADRQC 56
57#define EBADSLT 57
58#define EDEADLOCK 58
59#define EBFONT 59
60#define ENOSTR 60
61#define ENODATA 61
62#define ETIME 62
63#define ENOSR 63
64#define ENONET 64
65#define ENOPKG 65
66#define EREMOTE 66
67#define ENOLINK 67
68#define EADV 68
69#define ESRMNT 69
70#define ECOMM 70
71#define EPROTO 71
72#define EMULTIHOP 72
73#define EDOTDOT 73
74#define EBADMSG 74
75#define EOVERFLOW 75
76#define ENOTUNIQ 76
77#define EBADFD 77
78#define EREMCHG 78
79#define ELIBACC 79
80#define ELIBBAD 80
81#define ELIBSCN 81
82#define ELIBMAX 82
83#define ELIBEXEC 83
84#define EILSEQ 84
85#define ERESTART 85
86#define ESTRPIPE 86
87#define EUSERS 87
88#define ENOTSOCK 88
89#define EDESTADDRREQ 89
90#define EMSGSIZE 90
91#define EPROTOTYPE 91
92#define ENOPROTOOPT 92
93#define EPROTONOSUPPORT 93
94#define ESOCKTNOSUPPORT 94
95#define EOPNOTSUPP 95
96#define ENOTSUP EOPNOTSUPP
97#define EPFNOSUPPORT 96
98#define EAFNOSUPPORT 97
99#define EADDRINUSE 98
100#define EADDRNOTAVAIL 99
101#define ENETDOWN 100
102#define ENETUNREACH 101
103#define ENETRESET 102
104#define ECONNABORTED 103
105#define ECONNRESET 104
106#define ENOBUFS 105
107#define EISCONN 106
108#define ENOTCONN 107
109#define ESHUTDOWN 108
110#define ETOOMANYREFS 109
111#define ETIMEDOUT 110
112#define ECONNREFUSED 111
113#define EHOSTDOWN 112
114#define EHOSTUNREACH 113
115#define EALREADY 114
116#define EINPROGRESS 115
117#define ESTALE 116
118#define EUCLEAN 117
119#define ENOTNAM 118
120#define ENAVAIL 119
121#define EISNAM 120
122#define EREMOTEIO 121
123#define EDQUOT 122
124#define ENOMEDIUM 123
125#define EMEDIUMTYPE 124
126#define ECANCELED 125
127#define ENOKEY 126
128#define EKEYEXPIRED 127
129#define EKEYREVOKED 128
130#define EKEYREJECTED 129
131#define EOWNERDEAD 130
132#define ENOTRECOVERABLE 131
133#define ERFKILL 132
134#define EHWPOISON 133
libc/musl/arch/powerpc/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0100
2#define O_EXCL 0200
3#define O_NOCTTY 0400
4#define O_TRUNC 01000
5#define O_APPEND 02000
6#define O_NONBLOCK 04000
7#define O_DSYNC 010000
8#define O_SYNC 04010000
9#define O_RSYNC 04010000
10#define O_DIRECTORY 040000
11#define O_NOFOLLOW 0100000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 020000
15#define O_DIRECT 0400000
16#define O_LARGEFILE 0200000
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020040000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_SETOWN 8
29#define F_GETOWN 9
30#define F_SETSIG 10
31#define F_GETSIG 11
32
33#define F_GETLK 12
34#define F_SETLK 13
35#define F_SETLKW 14
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/powerpc/bits/fenv.h created+36
...@@ -0,0 +1,36 @@
1#ifdef _SOFT_FLOAT
2#define FE_ALL_EXCEPT 0
3#define FE_TONEAREST 0
4#else
5#define FE_TONEAREST 0
6#define FE_TOWARDZERO 1
7#define FE_UPWARD 2
8#define FE_DOWNWARD 3
9
10#define FE_INEXACT 0x02000000
11#define FE_DIVBYZERO 0x04000000
12#define FE_UNDERFLOW 0x08000000
13#define FE_OVERFLOW 0x10000000
14#define FE_INVALID 0x20000000
15
16#define FE_ALL_EXCEPT 0x3e000000
17
18#ifdef _GNU_SOURCE
19#define FE_INVALID_SNAN 0x01000000
20#define FE_INVALID_ISI 0x00800000
21#define FE_INVALID_IDI 0x00400000
22#define FE_INVALID_ZDZ 0x00200000
23#define FE_INVALID_IMZ 0x00100000
24#define FE_INVALID_COMPARE 0x00080000
25#define FE_INVALID_SOFTWARE 0x00000400
26#define FE_INVALID_SQRT 0x00000200
27#define FE_INVALID_INTEGER_CONVERSION 0x00000100
28
29#define FE_ALL_INVALID 0x01f80700
30#endif
31#endif
32
33typedef unsigned fexcept_t;
34typedef double fenv_t;
35
36#define FE_DFL_ENV ((const fenv_t *)-1)
libc/musl/arch/powerpc/bits/float.h created+16
...@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
4#define LDBL_MIN 2.22507385850720138309e-308L
5#define LDBL_MAX 1.79769313486231570815e+308L
6#define LDBL_EPSILON 2.22044604925031308085e-16L
7
8#define LDBL_MANT_DIG 53
9#define LDBL_MIN_EXP (-1021)
10#define LDBL_MAX_EXP 1024
11
12#define LDBL_DIG 15
13#define LDBL_MIN_10_EXP (-307)
14#define LDBL_MAX_10_EXP 308
15
16#define DECIMAL_DIG 17
libc/musl/arch/powerpc/bits/hwcap.h created+43
...@@ -0,0 +1,43 @@
1#define PPC_FEATURE_32 0x80000000
2#define PPC_FEATURE_64 0x40000000
3#define PPC_FEATURE_601_INSTR 0x20000000
4#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
5#define PPC_FEATURE_HAS_FPU 0x08000000
6#define PPC_FEATURE_HAS_MMU 0x04000000
7#define PPC_FEATURE_HAS_4xxMAC 0x02000000
8#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
9#define PPC_FEATURE_HAS_SPE 0x00800000
10#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
11#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
12#define PPC_FEATURE_NO_TB 0x00100000
13#define PPC_FEATURE_POWER4 0x00080000
14#define PPC_FEATURE_POWER5 0x00040000
15#define PPC_FEATURE_POWER5_PLUS 0x00020000
16#define PPC_FEATURE_CELL 0x00010000
17#define PPC_FEATURE_BOOKE 0x00008000
18#define PPC_FEATURE_SMT 0x00004000
19#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
20#define PPC_FEATURE_ARCH_2_05 0x00001000
21#define PPC_FEATURE_PA6T 0x00000800
22#define PPC_FEATURE_HAS_DFP 0x00000400
23#define PPC_FEATURE_POWER6_EXT 0x00000200
24#define PPC_FEATURE_ARCH_2_06 0x00000100
25#define PPC_FEATURE_HAS_VSX 0x00000080
26#define PPC_FEATURE_PSERIES_PERFMON_COMPAT 0x00000040
27
28#define PPC_FEATURE_TRUE_LE 0x00000002
29#define PPC_FEATURE_PPC_LE 0x00000001
30
31#define PPC_FEATURE2_ARCH_2_07 0x80000000
32#define PPC_FEATURE2_HTM 0x40000000
33#define PPC_FEATURE2_DSCR 0x20000000
34#define PPC_FEATURE2_EBB 0x10000000
35#define PPC_FEATURE2_ISEL 0x08000000
36#define PPC_FEATURE2_TAR 0x04000000
37#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
38#define PPC_FEATURE2_HTM_NOSC 0x01000000
39#define PPC_FEATURE2_ARCH_3_00 0x00800000
40#define PPC_FEATURE2_HAS_IEEE128 0x00400000
41#define PPC_FEATURE2_DARN 0x00200000
42#define PPC_FEATURE2_SCV 0x00100000
43#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
libc/musl/arch/powerpc/bits/ioctl.h created+217
...@@ -0,0 +1,217 @@
1#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
2#define _IOC_NONE 1U
3#define _IOC_WRITE 4U
4#define _IOC_READ 2U
5
6#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
7#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
8#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
9#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
10
11#define FIONCLEX _IO('f', 2)
12#define FIOCLEX _IO('f', 1)
13#define FIOASYNC _IOW('f', 125, int)
14#define FIONBIO _IOW('f', 126, int)
15#define FIONREAD _IOR('f', 127, int)
16#define TIOCINQ FIONREAD
17#define FIOQSIZE _IOR('f', 128, char[8])
18#define TIOCGETP _IOR('t', 8, char[6])
19#define TIOCSETP _IOW('t', 9, char[6])
20#define TIOCSETN _IOW('t', 10, char[6])
21
22#define TIOCSETC _IOW('t', 17, char[6])
23#define TIOCGETC _IOR('t', 18, char[6])
24#define TCGETS _IOR('t', 19, char[44])
25#define TCSETS _IOW('t', 20, char[44])
26#define TCSETSW _IOW('t', 21, char[44])
27#define TCSETSF _IOW('t', 22, char[44])
28
29#define TCGETA _IOR('t', 23, char[20])
30#define TCSETA _IOW('t', 24, char[20])
31#define TCSETAW _IOW('t', 25, char[20])
32#define TCSETAF _IOW('t', 28, char[20])
33
34#define TCSBRK _IO('t', 29)
35#define TCXONC _IO('t', 30)
36#define TCFLSH _IO('t', 31)
37
38#define TIOCSWINSZ _IOW('t', 103, char[8])
39#define TIOCGWINSZ _IOR('t', 104, char[8])
40#define TIOCSTART _IO('t', 110)
41#define TIOCSTOP _IO('t', 111)
42
43#define TIOCOUTQ _IOR('t', 115, int)
44
45#define TIOCGLTC _IOR('t', 116, char[6])
46#define TIOCSLTC _IOW('t', 117, char[6])
47#define TIOCSPGRP _IOW('t', 118, int)
48#define TIOCGPGRP _IOR('t', 119, int)
49
50#define TIOCEXCL 0x540C
51#define TIOCNXCL 0x540D
52#define TIOCSCTTY 0x540E
53
54#define TIOCSTI 0x5412
55#define TIOCMGET 0x5415
56#define TIOCMBIS 0x5416
57#define TIOCMBIC 0x5417
58#define TIOCMSET 0x5418
59#define TIOCM_LE 0x001
60#define TIOCM_DTR 0x002
61#define TIOCM_RTS 0x004
62#define TIOCM_ST 0x008
63#define TIOCM_SR 0x010
64#define TIOCM_CTS 0x020
65#define TIOCM_CAR 0x040
66#define TIOCM_RNG 0x080
67#define TIOCM_DSR 0x100
68#define TIOCM_CD TIOCM_CAR
69#define TIOCM_RI TIOCM_RNG
70#define TIOCM_OUT1 0x2000
71#define TIOCM_OUT2 0x4000
72#define TIOCM_LOOP 0x8000
73
74#define TIOCGSOFTCAR 0x5419
75#define TIOCSSOFTCAR 0x541A
76#define TIOCLINUX 0x541C
77#define TIOCCONS 0x541D
78#define TIOCGSERIAL 0x541E
79#define TIOCSSERIAL 0x541F
80#define TIOCPKT 0x5420
81#define TIOCPKT_DATA 0
82#define TIOCPKT_FLUSHREAD 1
83#define TIOCPKT_FLUSHWRITE 2
84#define TIOCPKT_STOP 4
85#define TIOCPKT_START 8
86#define TIOCPKT_NOSTOP 16
87#define TIOCPKT_DOSTOP 32
88#define TIOCPKT_IOCTL 64
89
90#define TIOCNOTTY 0x5422
91#define TIOCSETD 0x5423
92#define TIOCGETD 0x5424
93#define TCSBRKP 0x5425
94#define TIOCSBRK 0x5427
95#define TIOCCBRK 0x5428
96#define TIOCGSID 0x5429
97#define TIOCGRS485 0x542e
98#define TIOCSRS485 0x542f
99#define TIOCGPTN _IOR('T',0x30, unsigned int)
100#define TIOCSPTLCK _IOW('T',0x31, int)
101#define TIOCGDEV _IOR('T',0x32, unsigned int)
102#define TIOCSIG _IOW('T',0x36, int)
103#define TIOCVHANGUP 0x5437
104#define TIOCGPKT _IOR('T', 0x38, int)
105#define TIOCGPTLCK _IOR('T', 0x39, int)
106#define TIOCGEXCL _IOR('T', 0x40, int)
107#define TIOCGPTPEER _IO('T', 0x41)
108
109#define TIOCSERCONFIG 0x5453
110#define TIOCSERGWILD 0x5454
111#define TIOCSERSWILD 0x5455
112#define TIOCGLCKTRMIOS 0x5456
113#define TIOCSLCKTRMIOS 0x5457
114#define TIOCSERGSTRUCT 0x5458
115#define TIOCSERGETLSR 0x5459
116#define TIOCSER_TEMT 0x01
117#define TIOCSERGETMULTI 0x545A
118#define TIOCSERSETMULTI 0x545B
119
120#define TIOCMIWAIT 0x545C
121#define TIOCGICOUNT 0x545D
122
123
124struct winsize {
125 unsigned short ws_row;
126 unsigned short ws_col;
127 unsigned short ws_xpixel;
128 unsigned short ws_ypixel;
129};
130
131#define N_TTY 0
132#define N_SLIP 1
133#define N_MOUSE 2
134#define N_PPP 3
135#define N_STRIP 4
136#define N_AX25 5
137#define N_X25 6
138#define N_6PACK 7
139#define N_MASC 8
140#define N_R3964 9
141#define N_PROFIBUS_FDL 10
142#define N_IRDA 11
143#define N_SMSBLOCK 12
144#define N_HDLC 13
145#define N_SYNC_PPP 14
146#define N_HCI 15
147
148#define FIOSETOWN 0x8901
149#define SIOCSPGRP 0x8902
150#define FIOGETOWN 0x8903
151#define SIOCGPGRP 0x8904
152#define SIOCATMARK 0x8905
153#define SIOCGSTAMP 0x8906
154#define SIOCGSTAMPNS 0x8907
155
156#define SIOCADDRT 0x890B
157#define SIOCDELRT 0x890C
158#define SIOCRTMSG 0x890D
159
160#define SIOCGIFNAME 0x8910
161#define SIOCSIFLINK 0x8911
162#define SIOCGIFCONF 0x8912
163#define SIOCGIFFLAGS 0x8913
164#define SIOCSIFFLAGS 0x8914
165#define SIOCGIFADDR 0x8915
166#define SIOCSIFADDR 0x8916
167#define SIOCGIFDSTADDR 0x8917
168#define SIOCSIFDSTADDR 0x8918
169#define SIOCGIFBRDADDR 0x8919
170#define SIOCSIFBRDADDR 0x891a
171#define SIOCGIFNETMASK 0x891b
172#define SIOCSIFNETMASK 0x891c
173#define SIOCGIFMETRIC 0x891d
174#define SIOCSIFMETRIC 0x891e
175#define SIOCGIFMEM 0x891f
176#define SIOCSIFMEM 0x8920
177#define SIOCGIFMTU 0x8921
178#define SIOCSIFMTU 0x8922
179#define SIOCSIFNAME 0x8923
180#define SIOCSIFHWADDR 0x8924
181#define SIOCGIFENCAP 0x8925
182#define SIOCSIFENCAP 0x8926
183#define SIOCGIFHWADDR 0x8927
184#define SIOCGIFSLAVE 0x8929
185#define SIOCSIFSLAVE 0x8930
186#define SIOCADDMULTI 0x8931
187#define SIOCDELMULTI 0x8932
188#define SIOCGIFINDEX 0x8933
189#define SIOGIFINDEX SIOCGIFINDEX
190#define SIOCSIFPFLAGS 0x8934
191#define SIOCGIFPFLAGS 0x8935
192#define SIOCDIFADDR 0x8936
193#define SIOCSIFHWBROADCAST 0x8937
194#define SIOCGIFCOUNT 0x8938
195
196#define SIOCGIFBR 0x8940
197#define SIOCSIFBR 0x8941
198
199#define SIOCGIFTXQLEN 0x8942
200#define SIOCSIFTXQLEN 0x8943
201
202#define SIOCDARP 0x8953
203#define SIOCGARP 0x8954
204#define SIOCSARP 0x8955
205
206#define SIOCDRARP 0x8960
207#define SIOCGRARP 0x8961
208#define SIOCSRARP 0x8962
209
210#define SIOCGIFMAP 0x8970
211#define SIOCSIFMAP 0x8971
212
213#define SIOCADDDLCI 0x8980
214#define SIOCDELDLCI 0x8981
215
216#define SIOCDEVPRIVATE 0x89F0
217#define SIOCPROTOPRIVATE 0x89E0
libc/musl/arch/powerpc/bits/ipc.h created+15
...@@ -0,0 +1,15 @@
1struct ipc_perm {
2 key_t __ipc_perm_key;
3 uid_t uid;
4 gid_t gid;
5 uid_t cuid;
6 gid_t cgid;
7 mode_t mode;
8 int __ipc_perm_seq;
9 int __pad1;
10 long long __pad2;
11 long long __pad3;
12};
13
14#define IPC_64 0x100
15
libc/musl/arch/powerpc/bits/limits.h created+7
...@@ -0,0 +1,7 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define LONG_BIT 32
4#endif
5
6#define LONG_MAX 0x7fffffffL
7#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/powerpc/bits/mman.h created+14
...@@ -0,0 +1,14 @@
1#define PROT_SAO 0x10
2
3#undef MAP_NORESERVE
4#define MAP_NORESERVE 0x40
5#undef MAP_LOCKED
6#define MAP_LOCKED 0x80
7#undef MAP_SYNC
8
9#undef MCL_CURRENT
10#define MCL_CURRENT 0x2000
11#undef MCL_FUTURE
12#define MCL_FUTURE 0x4000
13#undef MCL_ONFAULT
14#define MCL_ONFAULT 0x8000
libc/musl/arch/powerpc/bits/msg.h created+15
...@@ -0,0 +1,15 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 int __unused1;
4 time_t msg_stime;
5 int __unused2;
6 time_t msg_rtime;
7 int __unused3;
8 time_t msg_ctime;
9 unsigned long msg_cbytes;
10 msgqnum_t msg_qnum;
11 msglen_t msg_qbytes;
12 pid_t msg_lspid;
13 pid_t msg_lrpid;
14 unsigned long __unused[2];
15};
libc/musl/arch/powerpc/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_ILP32_OFFBIG 1
2#define _POSIX_V7_ILP32_OFFBIG 1
libc/musl/arch/powerpc/bits/ptrace.h created+23
...@@ -0,0 +1,23 @@
1#define PTRACE_GETVRREGS 0x12
2#define PTRACE_SETVRREGS 0x13
3#define PTRACE_GETEVRREGS 0x14
4#define PTRACE_SETEVRREGS 0x15
5#define PTRACE_GETREGS64 0x16
6#define PTRACE_SETREGS64 0x17
7#define PTRACE_GET_DEBUGREG 0x19
8#define PTRACE_SET_DEBUGREG 0x1a
9#define PTRACE_GETVSRREGS 0x1b
10#define PTRACE_SETVSRREGS 0x1c
11#define PTRACE_SINGLEBLOCK 0x100
12
13#define PT_GETVRREGS PTRACE_GETVRREGS
14#define PT_SETVRREGS PTRACE_SETVRREGS
15#define PT_GETEVRREGS PTRACE_GETEVRREGS
16#define PT_SETEVRREGS PTRACE_SETEVRREGS
17#define PT_GETREGS64 PTRACE_GETREGS64
18#define PT_SETREGS64 PTRACE_SETREGS64
19#define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG
20#define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG
21#define PT_GETVSRREGS PTRACE_GETVSRREGS
22#define PT_SETVSRREGS PTRACE_SETVSRREGS
23#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
libc/musl/arch/powerpc/bits/reg.h created+3
...@@ -0,0 +1,3 @@
1#undef __WORDSIZE
2#define __WORDSIZE 32
3/* FIXME */
libc/musl/arch/powerpc/bits/sem.h created+10
...@@ -0,0 +1,10 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 int __unused1;
4 time_t sem_otime;
5 int __unused2;
6 time_t sem_ctime;
7 unsigned short __sem_nsems_pad, sem_nsems;
8 long __unused3;
9 long __unused4;
10};
libc/musl/arch/powerpc/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long long __jmp_buf[56];
libc/musl/arch/powerpc/bits/shm.h created+29
...@@ -0,0 +1,29 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 int __unused1;
6 time_t shm_atime;
7 int __unused2;
8 time_t shm_dtime;
9 int __unused3;
10 time_t shm_ctime;
11 int __unused4;
12 size_t shm_segsz;
13 pid_t shm_cpid;
14 pid_t shm_lpid;
15 unsigned long shm_nattch;
16 unsigned long __pad1;
17 unsigned long __pad2;
18};
19
20struct shminfo {
21 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
22};
23
24struct shm_info {
25 int __used_ids;
26 unsigned long shm_tot, shm_rss, shm_swp;
27 unsigned long __swap_attempts, __swap_successes;
28};
29
libc/musl/arch/powerpc/bits/signal.h created+119
...@@ -0,0 +1,119 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 4096
6#define SIGSTKSZ 10240
7#endif
8
9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10
11typedef unsigned long greg_t, gregset_t[48];
12
13typedef struct {
14 double fpregs[32];
15 double fpscr;
16 unsigned _pad[2];
17} fpregset_t;
18
19typedef struct {
20 unsigned vrregs[32][4];
21 unsigned vrsave;
22 unsigned _pad[2];
23 unsigned vscr;
24} vrregset_t;
25
26struct sigcontext {
27 unsigned long _unused[4];
28 int signal;
29 unsigned long handler;
30 unsigned long oldmask;
31 void *regs;
32};
33
34typedef struct {
35 gregset_t gregs;
36 fpregset_t fpregs;
37 vrregset_t vrregs
38#ifdef __GNUC__
39 __attribute__((__aligned__(16)))
40#endif
41 ;
42} mcontext_t;
43
44#else
45
46typedef struct {
47 long __regs[48+68+4*32+4]
48#ifdef __GNUC__
49 __attribute__((__aligned__(16)))
50#endif
51 ;
52} mcontext_t;
53
54#endif
55
56struct sigaltstack {
57 void *ss_sp;
58 int ss_flags;
59 size_t ss_size;
60};
61
62typedef struct __ucontext {
63 unsigned long uc_flags;
64 struct __ucontext *uc_link;
65 stack_t uc_stack;
66 int uc_pad[7];
67 mcontext_t *uc_regs;
68 sigset_t uc_sigmask;
69 int uc_pad2[3];
70 mcontext_t uc_mcontext;
71} ucontext_t;
72
73#define SA_NOCLDSTOP 1U
74#define SA_NOCLDWAIT 2U
75#define SA_SIGINFO 4U
76#define SA_ONSTACK 0x08000000U
77#define SA_RESTART 0x10000000U
78#define SA_NODEFER 0x40000000U
79#define SA_RESETHAND 0x80000000U
80#define SA_RESTORER 0x04000000U
81
82#endif
83
84#define SIGHUP 1
85#define SIGINT 2
86#define SIGQUIT 3
87#define SIGILL 4
88#define SIGTRAP 5
89#define SIGABRT 6
90#define SIGIOT SIGABRT
91#define SIGBUS 7
92#define SIGFPE 8
93#define SIGKILL 9
94#define SIGUSR1 10
95#define SIGSEGV 11
96#define SIGUSR2 12
97#define SIGPIPE 13
98#define SIGALRM 14
99#define SIGTERM 15
100#define SIGSTKFLT 16
101#define SIGCHLD 17
102#define SIGCONT 18
103#define SIGSTOP 19
104#define SIGTSTP 20
105#define SIGTTIN 21
106#define SIGTTOU 22
107#define SIGURG 23
108#define SIGXCPU 24
109#define SIGXFSZ 25
110#define SIGVTALRM 26
111#define SIGPROF 27
112#define SIGWINCH 28
113#define SIGIO 29
114#define SIGPOLL 29
115#define SIGPWR 30
116#define SIGSYS 31
117#define SIGUNUSED SIGSYS
118
119#define _NSIG 65
libc/musl/arch/powerpc/bits/socket.h created+43
...@@ -0,0 +1,43 @@
1struct msghdr {
2 void *msg_name;
3 socklen_t msg_namelen;
4 struct iovec *msg_iov;
5 int msg_iovlen;
6 void *msg_control;
7 socklen_t msg_controllen;
8 int msg_flags;
9};
10
11struct cmsghdr {
12 socklen_t cmsg_len;
13 int cmsg_level;
14 int cmsg_type;
15};
16
17#define SO_DEBUG 1
18#define SO_REUSEADDR 2
19#define SO_TYPE 3
20#define SO_ERROR 4
21#define SO_DONTROUTE 5
22#define SO_BROADCAST 6
23#define SO_SNDBUF 7
24#define SO_RCVBUF 8
25#define SO_KEEPALIVE 9
26#define SO_OOBINLINE 10
27#define SO_NO_CHECK 11
28#define SO_PRIORITY 12
29#define SO_LINGER 13
30#define SO_BSDCOMPAT 14
31#define SO_REUSEPORT 15
32#define SO_RCVLOWAT 16
33#define SO_SNDLOWAT 17
34#define SO_RCVTIMEO 18
35#define SO_SNDTIMEO 19
36#define SO_PASSCRED 20
37#define SO_PEERCRED 21
38#define SO_ACCEPTCONN 30
39#define SO_PEERSEC 31
40#define SO_SNDBUFFORCE 32
41#define SO_RCVBUFFORCE 33
42#define SO_PROTOCOL 38
43#define SO_DOMAIN 39
libc/musl/arch/powerpc/bits/stat.h created+20
...@@ -0,0 +1,20 @@
1/* copied from kernel definition, but with padding replaced
2 * by the corresponding correctly-sized userspace types. */
3
4struct stat {
5 dev_t st_dev;
6 ino_t st_ino;
7 mode_t st_mode;
8 nlink_t st_nlink;
9 uid_t st_uid;
10 gid_t st_gid;
11 dev_t st_rdev;
12 short __st_rdev_padding;
13 off_t st_size;
14 blksize_t st_blksize;
15 blkcnt_t st_blocks;
16 struct timespec st_atim;
17 struct timespec st_mtim;
18 struct timespec st_ctim;
19 unsigned __unused[2];
20};
libc/musl/arch/powerpc/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT32_MIN
16#define INTPTR_MAX INT32_MAX
17#define UINTPTR_MAX UINT32_MAX
18#define PTRDIFF_MIN INT32_MIN
19#define PTRDIFF_MAX INT32_MAX
20#define SIZE_MAX UINT32_MAX
libc/musl/arch/powerpc/bits/syscall.h.in created+376
...@@ -0,0 +1,376 @@
1#define __NR_restart_syscall 0
2#define __NR_exit 1
3#define __NR_fork 2
4#define __NR_read 3
5#define __NR_write 4
6#define __NR_open 5
7#define __NR_close 6
8#define __NR_waitpid 7
9#define __NR_creat 8
10#define __NR_link 9
11#define __NR_unlink 10
12#define __NR_execve 11
13#define __NR_chdir 12
14#define __NR_time 13
15#define __NR_mknod 14
16#define __NR_chmod 15
17#define __NR_lchown 16
18#define __NR_break 17
19#define __NR_oldstat 18
20#define __NR_lseek 19
21#define __NR_getpid 20
22#define __NR_mount 21
23#define __NR_umount 22
24#define __NR_setuid 23
25#define __NR_getuid 24
26#define __NR_stime 25
27#define __NR_ptrace 26
28#define __NR_alarm 27
29#define __NR_oldfstat 28
30#define __NR_pause 29
31#define __NR_utime 30
32#define __NR_stty 31
33#define __NR_gtty 32
34#define __NR_access 33
35#define __NR_nice 34
36#define __NR_ftime 35
37#define __NR_sync 36
38#define __NR_kill 37
39#define __NR_rename 38
40#define __NR_mkdir 39
41#define __NR_rmdir 40
42#define __NR_dup 41
43#define __NR_pipe 42
44#define __NR_times 43
45#define __NR_prof 44
46#define __NR_brk 45
47#define __NR_setgid 46
48#define __NR_getgid 47
49#define __NR_signal 48
50#define __NR_geteuid 49
51#define __NR_getegid 50
52#define __NR_acct 51
53#define __NR_umount2 52
54#define __NR_lock 53
55#define __NR_ioctl 54
56#define __NR_fcntl 55
57#define __NR_mpx 56
58#define __NR_setpgid 57
59#define __NR_ulimit 58
60#define __NR_oldolduname 59
61#define __NR_umask 60
62#define __NR_chroot 61
63#define __NR_ustat 62
64#define __NR_dup2 63
65#define __NR_getppid 64
66#define __NR_getpgrp 65
67#define __NR_setsid 66
68#define __NR_sigaction 67
69#define __NR_sgetmask 68
70#define __NR_ssetmask 69
71#define __NR_setreuid 70
72#define __NR_setregid 71
73#define __NR_sigsuspend 72
74#define __NR_sigpending 73
75#define __NR_sethostname 74
76#define __NR_setrlimit 75
77#define __NR_getrlimit 76
78#define __NR_getrusage 77
79#define __NR_gettimeofday 78
80#define __NR_settimeofday 79
81#define __NR_getgroups 80
82#define __NR_setgroups 81
83#define __NR_select 82
84#define __NR_symlink 83
85#define __NR_oldlstat 84
86#define __NR_readlink 85
87#define __NR_uselib 86
88#define __NR_swapon 87
89#define __NR_reboot 88
90#define __NR_readdir 89
91#define __NR_mmap 90
92#define __NR_munmap 91
93#define __NR_truncate 92
94#define __NR_ftruncate 93
95#define __NR_fchmod 94
96#define __NR_fchown 95
97#define __NR_getpriority 96
98#define __NR_setpriority 97
99#define __NR_profil 98
100#define __NR_statfs 99
101#define __NR_fstatfs 100
102#define __NR_ioperm 101
103#define __NR_socketcall 102
104#define __NR_syslog 103
105#define __NR_setitimer 104
106#define __NR_getitimer 105
107#define __NR_stat 106
108#define __NR_lstat 107
109#define __NR_fstat 108
110#define __NR_olduname 109
111#define __NR_iopl 110
112#define __NR_vhangup 111
113#define __NR_idle 112
114#define __NR_vm86 113
115#define __NR_wait4 114
116#define __NR_swapoff 115
117#define __NR_sysinfo 116
118#define __NR_ipc 117
119#define __NR_fsync 118
120#define __NR_sigreturn 119
121#define __NR_clone 120
122#define __NR_setdomainname 121
123#define __NR_uname 122
124#define __NR_modify_ldt 123
125#define __NR_adjtimex 124
126#define __NR_mprotect 125
127#define __NR_sigprocmask 126
128#define __NR_create_module 127
129#define __NR_init_module 128
130#define __NR_delete_module 129
131#define __NR_get_kernel_syms 130
132#define __NR_quotactl 131
133#define __NR_getpgid 132
134#define __NR_fchdir 133
135#define __NR_bdflush 134
136#define __NR_sysfs 135
137#define __NR_personality 136
138#define __NR_afs_syscall 137
139#define __NR_setfsuid 138
140#define __NR_setfsgid 139
141#define __NR__llseek 140
142#define __NR_getdents 141
143#define __NR__newselect 142
144#define __NR_flock 143
145#define __NR_msync 144
146#define __NR_readv 145
147#define __NR_writev 146
148#define __NR_getsid 147
149#define __NR_fdatasync 148
150#define __NR__sysctl 149
151#define __NR_mlock 150
152#define __NR_munlock 151
153#define __NR_mlockall 152
154#define __NR_munlockall 153
155#define __NR_sched_setparam 154
156#define __NR_sched_getparam 155
157#define __NR_sched_setscheduler 156
158#define __NR_sched_getscheduler 157
159#define __NR_sched_yield 158
160#define __NR_sched_get_priority_max 159
161#define __NR_sched_get_priority_min 160
162#define __NR_sched_rr_get_interval 161
163#define __NR_nanosleep 162
164#define __NR_mremap 163
165#define __NR_setresuid 164
166#define __NR_getresuid 165
167#define __NR_query_module 166
168#define __NR_poll 167
169#define __NR_nfsservctl 168
170#define __NR_setresgid 169
171#define __NR_getresgid 170
172#define __NR_prctl 171
173#define __NR_rt_sigreturn 172
174#define __NR_rt_sigaction 173
175#define __NR_rt_sigprocmask 174
176#define __NR_rt_sigpending 175
177#define __NR_rt_sigtimedwait 176
178#define __NR_rt_sigqueueinfo 177
179#define __NR_rt_sigsuspend 178
180#define __NR_pread64 179
181#define __NR_pwrite64 180
182#define __NR_chown 181
183#define __NR_getcwd 182
184#define __NR_capget 183
185#define __NR_capset 184
186#define __NR_sigaltstack 185
187#define __NR_sendfile 186
188#define __NR_getpmsg 187
189#define __NR_putpmsg 188
190#define __NR_vfork 189
191#define __NR_ugetrlimit 190
192#define __NR_readahead 191
193#define __NR_mmap2 192
194#define __NR_truncate64 193
195#define __NR_ftruncate64 194
196#define __NR_stat64 195
197#define __NR_lstat64 196
198#define __NR_fstat64 197
199#define __NR_pciconfig_read 198
200#define __NR_pciconfig_write 199
201#define __NR_pciconfig_iobase 200
202#define __NR_multiplexer 201
203#define __NR_getdents64 202
204#define __NR_pivot_root 203
205#define __NR_fcntl64 204
206#define __NR_madvise 205
207#define __NR_mincore 206
208#define __NR_gettid 207
209#define __NR_tkill 208
210#define __NR_setxattr 209
211#define __NR_lsetxattr 210
212#define __NR_fsetxattr 211
213#define __NR_getxattr 212
214#define __NR_lgetxattr 213
215#define __NR_fgetxattr 214
216#define __NR_listxattr 215
217#define __NR_llistxattr 216
218#define __NR_flistxattr 217
219#define __NR_removexattr 218
220#define __NR_lremovexattr 219
221#define __NR_fremovexattr 220
222#define __NR_futex 221
223#define __NR_sched_setaffinity 222
224#define __NR_sched_getaffinity 223
225#define __NR_tuxcall 225
226#define __NR_sendfile64 226
227#define __NR_io_setup 227
228#define __NR_io_destroy 228
229#define __NR_io_getevents 229
230#define __NR_io_submit 230
231#define __NR_io_cancel 231
232#define __NR_set_tid_address 232
233#define __NR_fadvise64 233
234#define __NR_exit_group 234
235#define __NR_lookup_dcookie 235
236#define __NR_epoll_create 236
237#define __NR_epoll_ctl 237
238#define __NR_epoll_wait 238
239#define __NR_remap_file_pages 239
240#define __NR_timer_create 240
241#define __NR_timer_settime 241
242#define __NR_timer_gettime 242
243#define __NR_timer_getoverrun 243
244#define __NR_timer_delete 244
245#define __NR_clock_settime 245
246#define __NR_clock_gettime 246
247#define __NR_clock_getres 247
248#define __NR_clock_nanosleep 248
249#define __NR_swapcontext 249
250#define __NR_tgkill 250
251#define __NR_utimes 251
252#define __NR_statfs64 252
253#define __NR_fstatfs64 253
254#define __NR_fadvise64_64 254
255#define __NR_rtas 255
256#define __NR_sys_debug_setcontext 256
257#define __NR_migrate_pages 258
258#define __NR_mbind 259
259#define __NR_get_mempolicy 260
260#define __NR_set_mempolicy 261
261#define __NR_mq_open 262
262#define __NR_mq_unlink 263
263#define __NR_mq_timedsend 264
264#define __NR_mq_timedreceive 265
265#define __NR_mq_notify 266
266#define __NR_mq_getsetattr 267
267#define __NR_kexec_load 268
268#define __NR_add_key 269
269#define __NR_request_key 270
270#define __NR_keyctl 271
271#define __NR_waitid 272
272#define __NR_ioprio_set 273
273#define __NR_ioprio_get 274
274#define __NR_inotify_init 275
275#define __NR_inotify_add_watch 276
276#define __NR_inotify_rm_watch 277
277#define __NR_spu_run 278
278#define __NR_spu_create 279
279#define __NR_pselect6 280
280#define __NR_ppoll 281
281#define __NR_unshare 282
282#define __NR_splice 283
283#define __NR_tee 284
284#define __NR_vmsplice 285
285#define __NR_openat 286
286#define __NR_mkdirat 287
287#define __NR_mknodat 288
288#define __NR_fchownat 289
289#define __NR_futimesat 290
290#define __NR_fstatat64 291
291#define __NR_unlinkat 292
292#define __NR_renameat 293
293#define __NR_linkat 294
294#define __NR_symlinkat 295
295#define __NR_readlinkat 296
296#define __NR_fchmodat 297
297#define __NR_faccessat 298
298#define __NR_get_robust_list 299
299#define __NR_set_robust_list 300
300#define __NR_move_pages 301
301#define __NR_getcpu 302
302#define __NR_epoll_pwait 303
303#define __NR_utimensat 304
304#define __NR_signalfd 305
305#define __NR_timerfd_create 306
306#define __NR_eventfd 307
307#define __NR_sync_file_range2 308
308#define __NR_fallocate 309
309#define __NR_subpage_prot 310
310#define __NR_timerfd_settime 311
311#define __NR_timerfd_gettime 312
312#define __NR_signalfd4 313
313#define __NR_eventfd2 314
314#define __NR_epoll_create1 315
315#define __NR_dup3 316
316#define __NR_pipe2 317
317#define __NR_inotify_init1 318
318#define __NR_perf_event_open 319
319#define __NR_preadv 320
320#define __NR_pwritev 321
321#define __NR_rt_tgsigqueueinfo 322
322#define __NR_fanotify_init 323
323#define __NR_fanotify_mark 324
324#define __NR_prlimit64 325
325#define __NR_socket 326
326#define __NR_bind 327
327#define __NR_connect 328
328#define __NR_listen 329
329#define __NR_accept 330
330#define __NR_getsockname 331
331#define __NR_getpeername 332
332#define __NR_socketpair 333
333#define __NR_send 334
334#define __NR_sendto 335
335#define __NR_recv 336
336#define __NR_recvfrom 337
337#define __NR_shutdown 338
338#define __NR_setsockopt 339
339#define __NR_getsockopt 340
340#define __NR_sendmsg 341
341#define __NR_recvmsg 342
342#define __NR_recvmmsg 343
343#define __NR_accept4 344
344#define __NR_name_to_handle_at 345
345#define __NR_open_by_handle_at 346
346#define __NR_clock_adjtime 347
347#define __NR_syncfs 348
348#define __NR_sendmmsg 349
349#define __NR_setns 350
350#define __NR_process_vm_readv 351
351#define __NR_process_vm_writev 352
352#define __NR_finit_module 353
353#define __NR_kcmp 354
354#define __NR_sched_setattr 355
355#define __NR_sched_getattr 356
356#define __NR_renameat2 357
357#define __NR_seccomp 358
358#define __NR_getrandom 359
359#define __NR_memfd_create 360
360#define __NR_bpf 361
361#define __NR_execveat 362
362#define __NR_switch_endian 363
363#define __NR_userfaultfd 364
364#define __NR_membarrier 365
365#define __NR_mlock2 378
366#define __NR_copy_file_range 379
367#define __NR_preadv2 380
368#define __NR_pwritev2 381
369#define __NR_kexec_file_load 382
370#define __NR_statx 383
371#define __NR_pkey_alloc 384
372#define __NR_pkey_free 385
373#define __NR_pkey_mprotect 386
374#define __NR_rseq 387
375#define __NR_io_pgetevents 388
376
libc/musl/arch/powerpc/bits/termios.h created+171
...@@ -0,0 +1,171 @@
1#undef NCCS
2#define NCCS 19
3struct termios {
4 tcflag_t c_iflag;
5 tcflag_t c_oflag;
6 tcflag_t c_cflag;
7 tcflag_t c_lflag;
8 cc_t c_cc[NCCS];
9 cc_t c_line;
10 speed_t __c_ispeed;
11 speed_t __c_ospeed;
12};
13
14#define VINTR 0
15#define VQUIT 1
16#define VERASE 2
17#define VKILL 3
18#define VEOF 4
19#define VMIN 5
20#define VEOL 6
21#define VTIME 7
22#define VEOL2 8
23#define VSWTC 9
24#define VWERASE 10
25#define VREPRINT 11
26#define VSUSP 12
27#define VSTART 13
28#define VSTOP 14
29#define VLNEXT 15
30#define VDISCARD 16
31
32#define IGNBRK 0000001
33#define BRKINT 0000002
34#define IGNPAR 0000004
35#define PARMRK 0000010
36#define INPCK 0000020
37#define ISTRIP 0000040
38#define INLCR 0000100
39#define IGNCR 0000200
40#define ICRNL 0000400
41#define IXON 0001000
42#define IXOFF 0002000
43#define IXANY 0004000
44#define IUCLC 0010000
45#define IMAXBEL 0020000
46#define IUTF8 0040000
47
48#define OPOST 0000001
49#define ONLCR 0000002
50#define OLCUC 0000004
51#define OCRNL 0000010
52#define ONOCR 0000020
53#define ONLRET 0000040
54#define OFILL 0000100
55#define OFDEL 0000200
56#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
57#define NLDLY 0001400
58#define NL0 0000000
59#define NL1 0000400
60#define NL2 0001000
61#define NL3 0001400
62#define TABDLY 0006000
63#define TAB0 0000000
64#define TAB1 0002000
65#define TAB2 0004000
66#define TAB3 0006000
67#define CRDLY 0030000
68#define CR0 0000000
69#define CR1 0010000
70#define CR2 0020000
71#define CR3 0030000
72#define FFDLY 0040000
73#define FF0 0000000
74#define FF1 0040000
75#define BSDLY 0100000
76#define BS0 0000000
77#define BS1 0100000
78#endif
79
80#define VTDLY 0200000
81#define VT0 0000000
82#define VT1 0200000
83
84#define B0 0000000
85#define B50 0000001
86#define B75 0000002
87#define B110 0000003
88#define B134 0000004
89#define B150 0000005
90#define B200 0000006
91#define B300 0000007
92#define B600 0000010
93#define B1200 0000011
94#define B1800 0000012
95#define B2400 0000013
96#define B4800 0000014
97#define B9600 0000015
98#define B19200 0000016
99#define B38400 0000017
100
101#define B57600 00020
102#define B115200 00021
103#define B230400 00022
104#define B460800 00023
105#define B500000 00024
106#define B576000 00025
107#define B921600 00026
108#define B1000000 00027
109#define B1152000 00030
110#define B1500000 00031
111#define B2000000 00032
112#define B2500000 00033
113#define B3000000 00034
114#define B3500000 00035
115#define B4000000 00036
116
117#define CSIZE 00001400
118#define CS5 00000000
119#define CS6 00000400
120#define CS7 00001000
121#define CS8 00001400
122#define CSTOPB 00002000
123#define CREAD 00004000
124#define PARENB 00010000
125#define PARODD 00020000
126#define HUPCL 00040000
127#define CLOCAL 00100000
128
129#define ECHOE 0x00000002
130#define ECHOK 0x00000004
131#define ECHO 0x00000008
132#define ECHONL 0x00000010
133#define ISIG 0x00000080
134#define ICANON 0x00000100
135#define IEXTEN 0x00000400
136#define TOSTOP 0x00400000
137#define NOFLSH 0x80000000
138
139#define TCOOFF 0
140#define TCOON 1
141#define TCIOFF 2
142#define TCION 3
143
144#define TCIFLUSH 0
145#define TCOFLUSH 1
146#define TCIOFLUSH 2
147
148#define TCSANOW 0
149#define TCSADRAIN 1
150#define TCSAFLUSH 2
151
152#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
153#define EXTA 0000016
154#define EXTB 0000017
155#define CBAUD 00377
156#define CBAUDEX 0000020
157#define CIBAUD 077600000
158#define CMSPAR 010000000000
159#define CRTSCTS 020000000000
160
161#define XCASE 0x00004000
162#define ECHOCTL 0x00000040
163#define ECHOPRT 0x00000020
164#define ECHOKE 0x00000001
165#define FLUSHO 0x00800000
166#define PENDIN 0x20000000
167#define EXTPROC 0x10000000
168
169#define XTABS 00006000
170#define TIOCSER_TEMT 0x01
171#endif
libc/musl/arch/powerpc/bits/user.h created+25
...@@ -0,0 +1,25 @@
1struct pt_regs {
2 unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq;
3 unsigned long trap, dar, dsisr, result;
4};
5
6struct user {
7 struct pt_regs regs;
8 unsigned long u_tsize, u_dsize, u_ssize;
9 unsigned long start_code, start_data, start_stack;
10 long signal;
11 void *u_ar0;
12 unsigned long magic;
13 char u_comm[32];
14};
15
16#define ELF_NGREG 48
17#define ELF_NFPREG 33
18#define ELF_NVRREG 33
19typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
20typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
21typedef struct { unsigned u[4]; }
22#ifdef __GNUC__
23__attribute__((__aligned__(16)))
24#endif
25 elf_vrreg_t, elf_vrregset_t[ELF_NVRREG];
libc/musl/arch/powerpc/crt_arch.h created+20
...@@ -0,0 +1,20 @@
1__asm__(
2".text \n"
3".global " START " \n"
4".type " START ", %function \n"
5START ": \n"
6" bl 1f \n"
7".weak _DYNAMIC \n"
8".hidden _DYNAMIC \n"
9" .long _DYNAMIC-. \n"
10"1: mflr 4 \n"
11" lwz 3, 0(4) \n"
12" add 4, 3, 4 \n"
13" mr 3, 1 \n"
14" clrrwi 1, 1, 4 \n"
15" li 0, 0 \n"
16" stwu 1, -16(1) \n"
17" mtlr 0 \n"
18" stw 0, 0(1) \n"
19" bl " START "_c \n"
20);
libc/musl/arch/powerpc/pthread_arch.h created+18
...@@ -0,0 +1,18 @@
1static inline struct pthread *__pthread_self()
2{
3 register char *tp __asm__("r2");
4 __asm__ ("" : "=r" (tp) );
5 return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
6}
7
8#define TLS_ABOVE_TP
9#define GAP_ABOVE_TP 0
10#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
11
12#define DTP_OFFSET 0x8000
13
14// the kernel calls the ip "nip", it's the first saved value after the 32
15// GPRs.
16#define MC_PC gregs[32]
17
18#define CANARY canary_at_end
libc/musl/arch/powerpc/reloc.h created+30
...@@ -0,0 +1,30 @@
1#ifdef _SOFT_FLOAT
2#define FP_SUFFIX "-sf"
3#else
4#define FP_SUFFIX ""
5#endif
6
7#define LDSO_ARCH "powerpc" FP_SUFFIX
8
9#define TPOFF_K (-0x7000)
10
11#define REL_SYMBOLIC R_PPC_ADDR32
12#define REL_GOT R_PPC_GLOB_DAT
13#define REL_PLT R_PPC_JMP_SLOT
14#define REL_RELATIVE R_PPC_RELATIVE
15#define REL_COPY R_PPC_COPY
16#define REL_DTPMOD R_PPC_DTPMOD32
17#define REL_DTPOFF R_PPC_DTPREL32
18#define REL_TPOFF R_PPC_TPREL32
19
20#define CRTJMP(pc,sp) __asm__ __volatile__( \
21 "mr 1,%1 ; mtlr %0 ; blr" : : "r"(pc), "r"(sp) : "memory" )
22
23#define GETFUNCSYM(fp, sym, got) __asm__ ( \
24 ".hidden " #sym " \n" \
25 " bl 1f \n" \
26 " .long " #sym "-. \n" \
27 "1: mflr %1 \n" \
28 " lwz %0, 0(%1) \n" \
29 " add %0, %0, %1 \n" \
30 : "=r"(*(fp)), "=r"((int){0}) : : "memory", "lr" )
libc/musl/arch/powerpc/syscall_arch.h created+9
...@@ -0,0 +1,9 @@
1#define __SYSCALL_LL_E(x) \
2((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
3((union { long long ll; long l[2]; }){ .ll = x }).l[1]
4#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
5
6#undef SYSCALL_NO_INLINE
7#define SYSCALL_NO_INLINE
8
9#define SYSCALL_FADVISE_6_ARG
libc/musl/arch/powerpc64/atomic_arch.h created+62
...@@ -0,0 +1,62 @@
1#define a_ll a_ll
2static inline int a_ll(volatile int *p)
3{
4 int v;
5 __asm__ __volatile__ ("lwarx %0, 0, %2" : "=r"(v) : "m"(*p), "r"(p));
6 return v;
7}
8
9#define a_sc a_sc
10static inline int a_sc(volatile int *p, int v)
11{
12 int r;
13 __asm__ __volatile__ (
14 "stwcx. %2, 0, %3 ; mfcr %0"
15 : "=r"(r), "=m"(*p) : "r"(v), "r"(p) : "memory", "cc");
16 return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
17}
18
19#define a_ll_p a_ll_p
20static inline void *a_ll_p(volatile void *p)
21{
22 void *v;
23 __asm__ __volatile__ ("ldarx %0, 0, %2" : "=r"(v) : "m"(*(void *volatile *)p), "r"(p));
24 return v;
25}
26
27#define a_sc_p a_sc_p
28static inline int a_sc_p(volatile void *p, void *v)
29{
30 int r;
31 __asm__ __volatile__ (
32 "stdcx. %2, 0, %3 ; mfcr %0"
33 : "=r"(r), "=m"(*(void *volatile *)p) : "r"(v), "r"(p) : "memory", "cc");
34 return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
35}
36
37#define a_barrier a_barrier
38static inline void a_barrier()
39{
40 __asm__ __volatile__ ("sync" : : : "memory");
41}
42
43#define a_pre_llsc a_barrier
44
45#define a_post_llsc a_post_llsc
46static inline void a_post_llsc()
47{
48 __asm__ __volatile__ ("isync" : : : "memory");
49}
50
51#define a_crash a_crash
52static inline void a_crash()
53{
54 __asm__ __volatile__ (".long 0");
55}
56
57#define a_clz_64 a_clz_64
58static inline int a_clz_64(uint64_t x)
59{
60 __asm__ ("cntlzd %0, %1" : "=r"(x) : "r"(x));
61 return x;
62}
libc/musl/arch/powerpc64/bits/alltypes.h.in created+26
...@@ -0,0 +1,26 @@
1#define _Addr long
2#define _Int64 long
3#define _Reg long
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF int wchar_t;
10#endif
11
12TYPEDEF float float_t;
13TYPEDEF double double_t;
14
15TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
16
17TYPEDEF long time_t;
18TYPEDEF long suseconds_t;
19
20TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
21TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
22TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
23TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
24TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
25TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
26TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
libc/musl/arch/powerpc64/bits/endian.h created+5
...@@ -0,0 +1,5 @@
1#if __BIG_ENDIAN__
2#define __BYTE_ORDER __BIG_ENDIAN
3#else
4#define __BYTE_ORDER __LITTLE_ENDIAN
5#endif
libc/musl/arch/powerpc64/bits/errno.h created+134
...@@ -0,0 +1,134 @@
1#define EPERM 1
2#define ENOENT 2
3#define ESRCH 3
4#define EINTR 4
5#define EIO 5
6#define ENXIO 6
7#define E2BIG 7
8#define ENOEXEC 8
9#define EBADF 9
10#define ECHILD 10
11#define EAGAIN 11
12#define ENOMEM 12
13#define EACCES 13
14#define EFAULT 14
15#define ENOTBLK 15
16#define EBUSY 16
17#define EEXIST 17
18#define EXDEV 18
19#define ENODEV 19
20#define ENOTDIR 20
21#define EISDIR 21
22#define EINVAL 22
23#define ENFILE 23
24#define EMFILE 24
25#define ENOTTY 25
26#define ETXTBSY 26
27#define EFBIG 27
28#define ENOSPC 28
29#define ESPIPE 29
30#define EROFS 30
31#define EMLINK 31
32#define EPIPE 32
33#define EDOM 33
34#define ERANGE 34
35#define EDEADLK 35
36#define ENAMETOOLONG 36
37#define ENOLCK 37
38#define ENOSYS 38
39#define ENOTEMPTY 39
40#define ELOOP 40
41#define EWOULDBLOCK EAGAIN
42#define ENOMSG 42
43#define EIDRM 43
44#define ECHRNG 44
45#define EL2NSYNC 45
46#define EL3HLT 46
47#define EL3RST 47
48#define ELNRNG 48
49#define EUNATCH 49
50#define ENOCSI 50
51#define EL2HLT 51
52#define EBADE 52
53#define EBADR 53
54#define EXFULL 54
55#define ENOANO 55
56#define EBADRQC 56
57#define EBADSLT 57
58#define EDEADLOCK 58
59#define EBFONT 59
60#define ENOSTR 60
61#define ENODATA 61
62#define ETIME 62
63#define ENOSR 63
64#define ENONET 64
65#define ENOPKG 65
66#define EREMOTE 66
67#define ENOLINK 67
68#define EADV 68
69#define ESRMNT 69
70#define ECOMM 70
71#define EPROTO 71
72#define EMULTIHOP 72
73#define EDOTDOT 73
74#define EBADMSG 74
75#define EOVERFLOW 75
76#define ENOTUNIQ 76
77#define EBADFD 77
78#define EREMCHG 78
79#define ELIBACC 79
80#define ELIBBAD 80
81#define ELIBSCN 81
82#define ELIBMAX 82
83#define ELIBEXEC 83
84#define EILSEQ 84
85#define ERESTART 85
86#define ESTRPIPE 86
87#define EUSERS 87
88#define ENOTSOCK 88
89#define EDESTADDRREQ 89
90#define EMSGSIZE 90
91#define EPROTOTYPE 91
92#define ENOPROTOOPT 92
93#define EPROTONOSUPPORT 93
94#define ESOCKTNOSUPPORT 94
95#define EOPNOTSUPP 95
96#define ENOTSUP EOPNOTSUPP
97#define EPFNOSUPPORT 96
98#define EAFNOSUPPORT 97
99#define EADDRINUSE 98
100#define EADDRNOTAVAIL 99
101#define ENETDOWN 100
102#define ENETUNREACH 101
103#define ENETRESET 102
104#define ECONNABORTED 103
105#define ECONNRESET 104
106#define ENOBUFS 105
107#define EISCONN 106
108#define ENOTCONN 107
109#define ESHUTDOWN 108
110#define ETOOMANYREFS 109
111#define ETIMEDOUT 110
112#define ECONNREFUSED 111
113#define EHOSTDOWN 112
114#define EHOSTUNREACH 113
115#define EALREADY 114
116#define EINPROGRESS 115
117#define ESTALE 116
118#define EUCLEAN 117
119#define ENOTNAM 118
120#define ENAVAIL 119
121#define EISNAM 120
122#define EREMOTEIO 121
123#define EDQUOT 122
124#define ENOMEDIUM 123
125#define EMEDIUMTYPE 124
126#define ECANCELED 125
127#define ENOKEY 126
128#define EKEYEXPIRED 127
129#define EKEYREVOKED 128
130#define EKEYREJECTED 129
131#define EOWNERDEAD 130
132#define ENOTRECOVERABLE 131
133#define ERFKILL 132
134#define EHWPOISON 133
libc/musl/arch/powerpc64/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0100
2#define O_EXCL 0200
3#define O_NOCTTY 0400
4#define O_TRUNC 01000
5#define O_APPEND 02000
6#define O_NONBLOCK 04000
7#define O_DSYNC 010000
8#define O_SYNC 04010000
9#define O_RSYNC 04010000
10#define O_DIRECTORY 040000
11#define O_NOFOLLOW 0100000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 020000
15#define O_DIRECT 0400000
16#define O_LARGEFILE 0200000
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020040000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_GETLK 5
29#define F_SETLK 6
30#define F_SETLKW 7
31
32#define F_SETOWN 8
33#define F_GETOWN 9
34#define F_SETSIG 10
35#define F_GETSIG 11
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/powerpc64/bits/fenv.h created+31
...@@ -0,0 +1,31 @@
1#define FE_TONEAREST 0
2#define FE_TOWARDZERO 1
3#define FE_UPWARD 2
4#define FE_DOWNWARD 3
5
6#define FE_INEXACT 0x02000000
7#define FE_DIVBYZERO 0x04000000
8#define FE_UNDERFLOW 0x08000000
9#define FE_OVERFLOW 0x10000000
10#define FE_INVALID 0x20000000
11
12#define FE_ALL_EXCEPT 0x3e000000
13
14#ifdef _GNU_SOURCE
15#define FE_INVALID_SNAN 0x01000000
16#define FE_INVALID_ISI 0x00800000
17#define FE_INVALID_IDI 0x00400000
18#define FE_INVALID_ZDZ 0x00200000
19#define FE_INVALID_IMZ 0x00100000
20#define FE_INVALID_COMPARE 0x00080000
21#define FE_INVALID_SOFTWARE 0x00000400
22#define FE_INVALID_SQRT 0x00000200
23#define FE_INVALID_INTEGER_CONVERSION 0x00000100
24
25#define FE_ALL_INVALID 0x01f80700
26#endif
27
28typedef unsigned fexcept_t;
29typedef double fenv_t;
30
31#define FE_DFL_ENV ((const fenv_t *)-1)
libc/musl/arch/powerpc64/bits/float.h created+16
...@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 0
2
3#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
4#define LDBL_MIN 2.22507385850720138309e-308L
5#define LDBL_MAX 1.79769313486231570815e+308L
6#define LDBL_EPSILON 2.22044604925031308085e-16L
7
8#define LDBL_MANT_DIG 53
9#define LDBL_MIN_EXP (-1021)
10#define LDBL_MAX_EXP 1024
11
12#define LDBL_DIG 15
13#define LDBL_MIN_10_EXP (-307)
14#define LDBL_MAX_10_EXP 308
15
16#define DECIMAL_DIG 17
libc/musl/arch/powerpc64/bits/hwcap.h created+43
...@@ -0,0 +1,43 @@
1#define PPC_FEATURE_32 0x80000000
2#define PPC_FEATURE_64 0x40000000
3#define PPC_FEATURE_601_INSTR 0x20000000
4#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
5#define PPC_FEATURE_HAS_FPU 0x08000000
6#define PPC_FEATURE_HAS_MMU 0x04000000
7#define PPC_FEATURE_HAS_4xxMAC 0x02000000
8#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
9#define PPC_FEATURE_HAS_SPE 0x00800000
10#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
11#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
12#define PPC_FEATURE_NO_TB 0x00100000
13#define PPC_FEATURE_POWER4 0x00080000
14#define PPC_FEATURE_POWER5 0x00040000
15#define PPC_FEATURE_POWER5_PLUS 0x00020000
16#define PPC_FEATURE_CELL 0x00010000
17#define PPC_FEATURE_BOOKE 0x00008000
18#define PPC_FEATURE_SMT 0x00004000
19#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
20#define PPC_FEATURE_ARCH_2_05 0x00001000
21#define PPC_FEATURE_PA6T 0x00000800
22#define PPC_FEATURE_HAS_DFP 0x00000400
23#define PPC_FEATURE_POWER6_EXT 0x00000200
24#define PPC_FEATURE_ARCH_2_06 0x00000100
25#define PPC_FEATURE_HAS_VSX 0x00000080
26#define PPC_FEATURE_PSERIES_PERFMON_COMPAT 0x00000040
27
28#define PPC_FEATURE_TRUE_LE 0x00000002
29#define PPC_FEATURE_PPC_LE 0x00000001
30
31#define PPC_FEATURE2_ARCH_2_07 0x80000000
32#define PPC_FEATURE2_HTM 0x40000000
33#define PPC_FEATURE2_DSCR 0x20000000
34#define PPC_FEATURE2_EBB 0x10000000
35#define PPC_FEATURE2_ISEL 0x08000000
36#define PPC_FEATURE2_TAR 0x04000000
37#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
38#define PPC_FEATURE2_HTM_NOSC 0x01000000
39#define PPC_FEATURE2_ARCH_3_00 0x00800000
40#define PPC_FEATURE2_HAS_IEEE128 0x00400000
41#define PPC_FEATURE2_DARN 0x00200000
42#define PPC_FEATURE2_SCV 0x00100000
43#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
libc/musl/arch/powerpc64/bits/ioctl.h created+217
...@@ -0,0 +1,217 @@
1#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
2#define _IOC_NONE 1U
3#define _IOC_WRITE 4U
4#define _IOC_READ 2U
5
6#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
7#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
8#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
9#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
10
11#define FIONCLEX _IO('f', 2)
12#define FIOCLEX _IO('f', 1)
13#define FIOASYNC _IOW('f', 125, int)
14#define FIONBIO _IOW('f', 126, int)
15#define FIONREAD _IOR('f', 127, int)
16#define TIOCINQ FIONREAD
17#define FIOQSIZE _IOR('f', 128, char[8])
18#define TIOCGETP _IOR('t', 8, char[6])
19#define TIOCSETP _IOW('t', 9, char[6])
20#define TIOCSETN _IOW('t', 10, char[6])
21
22#define TIOCSETC _IOW('t', 17, char[6])
23#define TIOCGETC _IOR('t', 18, char[6])
24#define TCGETS _IOR('t', 19, char[44])
25#define TCSETS _IOW('t', 20, char[44])
26#define TCSETSW _IOW('t', 21, char[44])
27#define TCSETSF _IOW('t', 22, char[44])
28
29#define TCGETA _IOR('t', 23, char[20])
30#define TCSETA _IOW('t', 24, char[20])
31#define TCSETAW _IOW('t', 25, char[20])
32#define TCSETAF _IOW('t', 28, char[20])
33
34#define TCSBRK _IO('t', 29)
35#define TCXONC _IO('t', 30)
36#define TCFLSH _IO('t', 31)
37
38#define TIOCSWINSZ _IOW('t', 103, char[8])
39#define TIOCGWINSZ _IOR('t', 104, char[8])
40#define TIOCSTART _IO('t', 110)
41#define TIOCSTOP _IO('t', 111)
42
43#define TIOCOUTQ _IOR('t', 115, int)
44
45#define TIOCGLTC _IOR('t', 116, char[6])
46#define TIOCSLTC _IOW('t', 117, char[6])
47#define TIOCSPGRP _IOW('t', 118, int)
48#define TIOCGPGRP _IOR('t', 119, int)
49
50#define TIOCEXCL 0x540C
51#define TIOCNXCL 0x540D
52#define TIOCSCTTY 0x540E
53
54#define TIOCSTI 0x5412
55#define TIOCMGET 0x5415
56#define TIOCMBIS 0x5416
57#define TIOCMBIC 0x5417
58#define TIOCMSET 0x5418
59#define TIOCM_LE 0x001
60#define TIOCM_DTR 0x002
61#define TIOCM_RTS 0x004
62#define TIOCM_ST 0x008
63#define TIOCM_SR 0x010
64#define TIOCM_CTS 0x020
65#define TIOCM_CAR 0x040
66#define TIOCM_RNG 0x080
67#define TIOCM_DSR 0x100
68#define TIOCM_CD TIOCM_CAR
69#define TIOCM_RI TIOCM_RNG
70#define TIOCM_OUT1 0x2000
71#define TIOCM_OUT2 0x4000
72#define TIOCM_LOOP 0x8000
73
74#define TIOCGSOFTCAR 0x5419
75#define TIOCSSOFTCAR 0x541A
76#define TIOCLINUX 0x541C
77#define TIOCCONS 0x541D
78#define TIOCGSERIAL 0x541E
79#define TIOCSSERIAL 0x541F
80#define TIOCPKT 0x5420
81#define TIOCPKT_DATA 0
82#define TIOCPKT_FLUSHREAD 1
83#define TIOCPKT_FLUSHWRITE 2
84#define TIOCPKT_STOP 4
85#define TIOCPKT_START 8
86#define TIOCPKT_NOSTOP 16
87#define TIOCPKT_DOSTOP 32
88#define TIOCPKT_IOCTL 64
89
90#define TIOCNOTTY 0x5422
91#define TIOCSETD 0x5423
92#define TIOCGETD 0x5424
93#define TCSBRKP 0x5425
94#define TIOCSBRK 0x5427
95#define TIOCCBRK 0x5428
96#define TIOCGSID 0x5429
97#define TIOCGRS485 0x542e
98#define TIOCSRS485 0x542f
99#define TIOCGPTN _IOR('T',0x30, unsigned int)
100#define TIOCSPTLCK _IOW('T',0x31, int)
101#define TIOCGDEV _IOR('T',0x32, unsigned int)
102#define TIOCSIG _IOW('T',0x36, int)
103#define TIOCVHANGUP 0x5437
104#define TIOCGPKT _IOR('T', 0x38, int)
105#define TIOCGPTLCK _IOR('T', 0x39, int)
106#define TIOCGEXCL _IOR('T', 0x40, int)
107#define TIOCGPTPEER _IO('T', 0x41)
108
109#define TIOCSERCONFIG 0x5453
110#define TIOCSERGWILD 0x5454
111#define TIOCSERSWILD 0x5455
112#define TIOCGLCKTRMIOS 0x5456
113#define TIOCSLCKTRMIOS 0x5457
114#define TIOCSERGSTRUCT 0x5458
115#define TIOCSERGETLSR 0x5459
116#define TIOCSER_TEMT 0x01
117#define TIOCSERGETMULTI 0x545A
118#define TIOCSERSETMULTI 0x545B
119
120#define TIOCMIWAIT 0x545C
121#define TIOCGICOUNT 0x545D
122
123
124struct winsize {
125 unsigned short ws_row;
126 unsigned short ws_col;
127 unsigned short ws_xpixel;
128 unsigned short ws_ypixel;
129};
130
131#define N_TTY 0
132#define N_SLIP 1
133#define N_MOUSE 2
134#define N_PPP 3
135#define N_STRIP 4
136#define N_AX25 5
137#define N_X25 6
138#define N_6PACK 7
139#define N_MASC 8
140#define N_R3964 9
141#define N_PROFIBUS_FDL 10
142#define N_IRDA 11
143#define N_SMSBLOCK 12
144#define N_HDLC 13
145#define N_SYNC_PPP 14
146#define N_HCI 15
147
148#define FIOSETOWN 0x8901
149#define SIOCSPGRP 0x8902
150#define FIOGETOWN 0x8903
151#define SIOCGPGRP 0x8904
152#define SIOCATMARK 0x8905
153#define SIOCGSTAMP 0x8906
154#define SIOCGSTAMPNS 0x8907
155
156#define SIOCADDRT 0x890B
157#define SIOCDELRT 0x890C
158#define SIOCRTMSG 0x890D
159
160#define SIOCGIFNAME 0x8910
161#define SIOCSIFLINK 0x8911
162#define SIOCGIFCONF 0x8912
163#define SIOCGIFFLAGS 0x8913
164#define SIOCSIFFLAGS 0x8914
165#define SIOCGIFADDR 0x8915
166#define SIOCSIFADDR 0x8916
167#define SIOCGIFDSTADDR 0x8917
168#define SIOCSIFDSTADDR 0x8918
169#define SIOCGIFBRDADDR 0x8919
170#define SIOCSIFBRDADDR 0x891a
171#define SIOCGIFNETMASK 0x891b
172#define SIOCSIFNETMASK 0x891c
173#define SIOCGIFMETRIC 0x891d
174#define SIOCSIFMETRIC 0x891e
175#define SIOCGIFMEM 0x891f
176#define SIOCSIFMEM 0x8920
177#define SIOCGIFMTU 0x8921
178#define SIOCSIFMTU 0x8922
179#define SIOCSIFNAME 0x8923
180#define SIOCSIFHWADDR 0x8924
181#define SIOCGIFENCAP 0x8925
182#define SIOCSIFENCAP 0x8926
183#define SIOCGIFHWADDR 0x8927
184#define SIOCGIFSLAVE 0x8929
185#define SIOCSIFSLAVE 0x8930
186#define SIOCADDMULTI 0x8931
187#define SIOCDELMULTI 0x8932
188#define SIOCGIFINDEX 0x8933
189#define SIOGIFINDEX SIOCGIFINDEX
190#define SIOCSIFPFLAGS 0x8934
191#define SIOCGIFPFLAGS 0x8935
192#define SIOCDIFADDR 0x8936
193#define SIOCSIFHWBROADCAST 0x8937
194#define SIOCGIFCOUNT 0x8938
195
196#define SIOCGIFBR 0x8940
197#define SIOCSIFBR 0x8941
198
199#define SIOCGIFTXQLEN 0x8942
200#define SIOCSIFTXQLEN 0x8943
201
202#define SIOCDARP 0x8953
203#define SIOCGARP 0x8954
204#define SIOCSARP 0x8955
205
206#define SIOCDRARP 0x8960
207#define SIOCGRARP 0x8961
208#define SIOCSRARP 0x8962
209
210#define SIOCGIFMAP 0x8970
211#define SIOCSIFMAP 0x8971
212
213#define SIOCADDDLCI 0x8980
214#define SIOCDELDLCI 0x8981
215
216#define SIOCDEVPRIVATE 0x89F0
217#define SIOCPROTOPRIVATE 0x89E0
libc/musl/arch/powerpc64/bits/ipc.h created+15
...@@ -0,0 +1,15 @@
1struct ipc_perm {
2 key_t __ipc_perm_key;
3 uid_t uid;
4 gid_t gid;
5 uid_t cuid;
6 gid_t cgid;
7 mode_t mode;
8 int __ipc_perm_seq;
9 int __pad1;
10 long long __pad2;
11 long long __pad3;
12};
13
14#define IPC_64 0x100
15
libc/musl/arch/powerpc64/bits/limits.h created+7
...@@ -0,0 +1,7 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define LONG_BIT 64
4#endif
5
6#define LONG_MAX 0x7fffffffffffffffL
7#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/powerpc64/bits/mman.h created+14
...@@ -0,0 +1,14 @@
1#define PROT_SAO 0x10
2
3#undef MAP_NORESERVE
4#define MAP_NORESERVE 0x40
5#undef MAP_LOCKED
6#define MAP_LOCKED 0x80
7#undef MAP_SYNC
8
9#undef MCL_CURRENT
10#define MCL_CURRENT 0x2000
11#undef MCL_FUTURE
12#define MCL_FUTURE 0x4000
13#undef MCL_ONFAULT
14#define MCL_ONFAULT 0x8000
libc/musl/arch/powerpc64/bits/msg.h created+12
...@@ -0,0 +1,12 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 time_t msg_stime;
4 time_t msg_rtime;
5 time_t msg_ctime;
6 unsigned long msg_cbytes;
7 msgqnum_t msg_qnum;
8 msglen_t msg_qbytes;
9 pid_t msg_lspid;
10 pid_t msg_lrpid;
11 unsigned long __unused[2];
12};
libc/musl/arch/powerpc64/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_LP64_OFF64 1
2#define _POSIX_V7_LP64_OFF64 1
libc/musl/arch/powerpc64/bits/ptrace.h created+23
...@@ -0,0 +1,23 @@
1#define PTRACE_GETVRREGS 0x12
2#define PTRACE_SETVRREGS 0x13
3#define PTRACE_GETEVRREGS 0x14
4#define PTRACE_SETEVRREGS 0x15
5#define PTRACE_GETREGS64 0x16
6#define PTRACE_SETREGS64 0x17
7#define PTRACE_GET_DEBUGREG 0x19
8#define PTRACE_SET_DEBUGREG 0x1a
9#define PTRACE_GETVSRREGS 0x1b
10#define PTRACE_SETVSRREGS 0x1c
11#define PTRACE_SINGLEBLOCK 0x100
12
13#define PT_GETVRREGS PTRACE_GETVRREGS
14#define PT_SETVRREGS PTRACE_SETVRREGS
15#define PT_GETEVRREGS PTRACE_GETEVRREGS
16#define PT_SETEVRREGS PTRACE_SETEVRREGS
17#define PT_GETREGS64 PTRACE_GETREGS64
18#define PT_SETREGS64 PTRACE_SETREGS64
19#define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG
20#define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG
21#define PT_GETVSRREGS PTRACE_GETVSRREGS
22#define PT_SETVSRREGS PTRACE_SETVSRREGS
23#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
libc/musl/arch/powerpc64/bits/reg.h created+3
...@@ -0,0 +1,3 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
3/* FIXME */
libc/musl/arch/powerpc64/bits/sem.h created+13
...@@ -0,0 +1,13 @@
1#include <endian.h>
2
3struct semid_ds {
4 struct ipc_perm sem_perm;
5 time_t sem_otime;
6 time_t sem_ctime;
7#if __BYTE_ORDER == __BIG_ENDIAN
8 unsigned short __pad[3], sem_nsems;
9#else
10 unsigned short sem_nsems, __pad[3];
11#endif
12 unsigned long __unused[2];
13};
libc/musl/arch/powerpc64/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned __int128 __jmp_buf[32];
libc/musl/arch/powerpc64/bits/shm.h created+24
...@@ -0,0 +1,24 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 time_t shm_atime;
6 time_t shm_dtime;
7 time_t shm_ctime;
8 size_t shm_segsz;
9 pid_t shm_cpid;
10 pid_t shm_lpid;
11 unsigned long shm_nattch;
12 unsigned long __unused[2];
13};
14
15struct shminfo {
16 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
17};
18
19struct shm_info {
20 int __used_ids;
21 unsigned long shm_tot, shm_rss, shm_swp;
22 unsigned long __swap_attempts, __swap_successes;
23};
24
libc/musl/arch/powerpc64/bits/signal.h created+107
...@@ -0,0 +1,107 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 4096
6#define SIGSTKSZ 10240
7#endif
8
9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10
11typedef unsigned long greg_t, gregset_t[48];
12
13typedef struct {
14 double fpregs[32];
15 double fpscr;
16} fpregset_t;
17
18typedef struct {
19 unsigned __int128 vrregs[32];
20 unsigned _pad[3];
21 unsigned vrsave;
22 unsigned vscr;
23 unsigned _pad2[3];
24} vrregset_t;
25
26typedef struct sigcontext {
27 unsigned long _unused[4];
28 int signal;
29 int _pad0;
30 unsigned long handler;
31 unsigned long oldmask;
32 void *regs;
33 gregset_t gp_regs;
34 fpregset_t fp_regs;
35 vrregset_t *v_regs;
36 long vmx_reserve[34+34+32+1];
37} mcontext_t;
38
39#else
40
41typedef struct {
42 long __regs[4+4+48+33+1+34+34+32+1];
43} mcontext_t;
44
45#endif
46
47struct sigaltstack {
48 void *ss_sp;
49 int ss_flags;
50 size_t ss_size;
51};
52
53typedef struct __ucontext {
54 unsigned long uc_flags;
55 struct __ucontext *uc_link;
56 stack_t uc_stack;
57 sigset_t uc_sigmask;
58 mcontext_t uc_mcontext;
59} ucontext_t;
60
61#define SA_NOCLDSTOP 1U
62#define SA_NOCLDWAIT 2U
63#define SA_SIGINFO 4U
64#define SA_ONSTACK 0x08000000U
65#define SA_RESTART 0x10000000U
66#define SA_NODEFER 0x40000000U
67#define SA_RESETHAND 0x80000000U
68#define SA_RESTORER 0x04000000U
69
70#endif
71
72#define SIGHUP 1
73#define SIGINT 2
74#define SIGQUIT 3
75#define SIGILL 4
76#define SIGTRAP 5
77#define SIGABRT 6
78#define SIGIOT SIGABRT
79#define SIGBUS 7
80#define SIGFPE 8
81#define SIGKILL 9
82#define SIGUSR1 10
83#define SIGSEGV 11
84#define SIGUSR2 12
85#define SIGPIPE 13
86#define SIGALRM 14
87#define SIGTERM 15
88#define SIGSTKFLT 16
89#define SIGCHLD 17
90#define SIGCONT 18
91#define SIGSTOP 19
92#define SIGTSTP 20
93#define SIGTTIN 21
94#define SIGTTOU 22
95#define SIGURG 23
96#define SIGXCPU 24
97#define SIGXFSZ 25
98#define SIGVTALRM 26
99#define SIGPROF 27
100#define SIGWINCH 28
101#define SIGIO 29
102#define SIGPOLL SIGIO
103#define SIGPWR 30
104#define SIGSYS 31
105#define SIGUNUSED SIGSYS
106
107#define _NSIG 65
libc/musl/arch/powerpc64/bits/socket.h created+61
...@@ -0,0 +1,61 @@
1#include <endian.h>
2
3struct msghdr {
4 void *msg_name;
5 socklen_t msg_namelen;
6 struct iovec *msg_iov;
7#if __BYTE_ORDER == __BIG_ENDIAN
8 int __pad1, msg_iovlen;
9#else
10 int msg_iovlen, __pad1;
11#endif
12 void *msg_control;
13#if __BYTE_ORDER == __BIG_ENDIAN
14 int __pad2;
15 socklen_t msg_controllen;
16#else
17 socklen_t msg_controllen;
18 int __pad2;
19#endif
20 int msg_flags;
21};
22
23struct cmsghdr {
24#if __BYTE_ORDER == __BIG_ENDIAN
25 int __pad1;
26 socklen_t cmsg_len;
27#else
28 socklen_t cmsg_len;
29 int __pad1;
30#endif
31 int cmsg_level;
32 int cmsg_type;
33};
34
35#define SO_DEBUG 1
36#define SO_REUSEADDR 2
37#define SO_TYPE 3
38#define SO_ERROR 4
39#define SO_DONTROUTE 5
40#define SO_BROADCAST 6
41#define SO_SNDBUF 7
42#define SO_RCVBUF 8
43#define SO_KEEPALIVE 9
44#define SO_OOBINLINE 10
45#define SO_NO_CHECK 11
46#define SO_PRIORITY 12
47#define SO_LINGER 13
48#define SO_BSDCOMPAT 14
49#define SO_REUSEPORT 15
50#define SO_RCVLOWAT 16
51#define SO_SNDLOWAT 17
52#define SO_RCVTIMEO 18
53#define SO_SNDTIMEO 19
54#define SO_PASSCRED 20
55#define SO_PEERCRED 21
56#define SO_ACCEPTCONN 30
57#define SO_PEERSEC 31
58#define SO_SNDBUFFORCE 32
59#define SO_RCVBUFFORCE 33
60#define SO_PROTOCOL 38
61#define SO_DOMAIN 39
libc/musl/arch/powerpc64/bits/stat.h created+16
...@@ -0,0 +1,16 @@
1struct stat {
2 dev_t st_dev;
3 ino_t st_ino;
4 nlink_t st_nlink;
5 mode_t st_mode;
6 uid_t st_uid;
7 gid_t st_gid;
8 dev_t st_rdev;
9 off_t st_size;
10 blksize_t st_blksize;
11 blkcnt_t st_blocks;
12 struct timespec st_atim;
13 struct timespec st_mtim;
14 struct timespec st_ctim;
15 unsigned long __unused[3];
16};
libc/musl/arch/powerpc64/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT64_MIN
16#define INTPTR_MAX INT64_MAX
17#define UINTPTR_MAX UINT64_MAX
18#define PTRDIFF_MIN INT64_MIN
19#define PTRDIFF_MAX INT64_MAX
20#define SIZE_MAX UINT64_MAX
libc/musl/arch/powerpc64/bits/syscall.h.in created+367
...@@ -0,0 +1,367 @@
1#define __NR_restart_syscall 0
2#define __NR_exit 1
3#define __NR_fork 2
4#define __NR_read 3
5#define __NR_write 4
6#define __NR_open 5
7#define __NR_close 6
8#define __NR_waitpid 7
9#define __NR_creat 8
10#define __NR_link 9
11#define __NR_unlink 10
12#define __NR_execve 11
13#define __NR_chdir 12
14#define __NR_time 13
15#define __NR_mknod 14
16#define __NR_chmod 15
17#define __NR_lchown 16
18#define __NR_break 17
19#define __NR_oldstat 18
20#define __NR_lseek 19
21#define __NR_getpid 20
22#define __NR_mount 21
23#define __NR_umount 22
24#define __NR_setuid 23
25#define __NR_getuid 24
26#define __NR_stime 25
27#define __NR_ptrace 26
28#define __NR_alarm 27
29#define __NR_oldfstat 28
30#define __NR_pause 29
31#define __NR_utime 30
32#define __NR_stty 31
33#define __NR_gtty 32
34#define __NR_access 33
35#define __NR_nice 34
36#define __NR_ftime 35
37#define __NR_sync 36
38#define __NR_kill 37
39#define __NR_rename 38
40#define __NR_mkdir 39
41#define __NR_rmdir 40
42#define __NR_dup 41
43#define __NR_pipe 42
44#define __NR_times 43
45#define __NR_prof 44
46#define __NR_brk 45
47#define __NR_setgid 46
48#define __NR_getgid 47
49#define __NR_signal 48
50#define __NR_geteuid 49
51#define __NR_getegid 50
52#define __NR_acct 51
53#define __NR_umount2 52
54#define __NR_lock 53
55#define __NR_ioctl 54
56#define __NR_fcntl 55
57#define __NR_mpx 56
58#define __NR_setpgid 57
59#define __NR_ulimit 58
60#define __NR_oldolduname 59
61#define __NR_umask 60
62#define __NR_chroot 61
63#define __NR_ustat 62
64#define __NR_dup2 63
65#define __NR_getppid 64
66#define __NR_getpgrp 65
67#define __NR_setsid 66
68#define __NR_sigaction 67
69#define __NR_sgetmask 68
70#define __NR_ssetmask 69
71#define __NR_setreuid 70
72#define __NR_setregid 71
73#define __NR_sigsuspend 72
74#define __NR_sigpending 73
75#define __NR_sethostname 74
76#define __NR_setrlimit 75
77#define __NR_getrlimit 76
78#define __NR_getrusage 77
79#define __NR_gettimeofday 78
80#define __NR_settimeofday 79
81#define __NR_getgroups 80
82#define __NR_setgroups 81
83#define __NR_select 82
84#define __NR_symlink 83
85#define __NR_oldlstat 84
86#define __NR_readlink 85
87#define __NR_uselib 86
88#define __NR_swapon 87
89#define __NR_reboot 88
90#define __NR_readdir 89
91#define __NR_mmap 90
92#define __NR_munmap 91
93#define __NR_truncate 92
94#define __NR_ftruncate 93
95#define __NR_fchmod 94
96#define __NR_fchown 95
97#define __NR_getpriority 96
98#define __NR_setpriority 97
99#define __NR_profil 98
100#define __NR_statfs 99
101#define __NR_fstatfs 100
102#define __NR_ioperm 101
103#define __NR_socketcall 102
104#define __NR_syslog 103
105#define __NR_setitimer 104
106#define __NR_getitimer 105
107#define __NR_stat 106
108#define __NR_lstat 107
109#define __NR_fstat 108
110#define __NR_olduname 109
111#define __NR_iopl 110
112#define __NR_vhangup 111
113#define __NR_idle 112
114#define __NR_vm86 113
115#define __NR_wait4 114
116#define __NR_swapoff 115
117#define __NR_sysinfo 116
118#define __NR_ipc 117
119#define __NR_fsync 118
120#define __NR_sigreturn 119
121#define __NR_clone 120
122#define __NR_setdomainname 121
123#define __NR_uname 122
124#define __NR_modify_ldt 123
125#define __NR_adjtimex 124
126#define __NR_mprotect 125
127#define __NR_sigprocmask 126
128#define __NR_create_module 127
129#define __NR_init_module 128
130#define __NR_delete_module 129
131#define __NR_get_kernel_syms 130
132#define __NR_quotactl 131
133#define __NR_getpgid 132
134#define __NR_fchdir 133
135#define __NR_bdflush 134
136#define __NR_sysfs 135
137#define __NR_personality 136
138#define __NR_afs_syscall 137
139#define __NR_setfsuid 138
140#define __NR_setfsgid 139
141#define __NR__llseek 140
142#define __NR_getdents 141
143#define __NR__newselect 142
144#define __NR_flock 143
145#define __NR_msync 144
146#define __NR_readv 145
147#define __NR_writev 146
148#define __NR_getsid 147
149#define __NR_fdatasync 148
150#define __NR__sysctl 149
151#define __NR_mlock 150
152#define __NR_munlock 151
153#define __NR_mlockall 152
154#define __NR_munlockall 153
155#define __NR_sched_setparam 154
156#define __NR_sched_getparam 155
157#define __NR_sched_setscheduler 156
158#define __NR_sched_getscheduler 157
159#define __NR_sched_yield 158
160#define __NR_sched_get_priority_max 159
161#define __NR_sched_get_priority_min 160
162#define __NR_sched_rr_get_interval 161
163#define __NR_nanosleep 162
164#define __NR_mremap 163
165#define __NR_setresuid 164
166#define __NR_getresuid 165
167#define __NR_query_module 166
168#define __NR_poll 167
169#define __NR_nfsservctl 168
170#define __NR_setresgid 169
171#define __NR_getresgid 170
172#define __NR_prctl 171
173#define __NR_rt_sigreturn 172
174#define __NR_rt_sigaction 173
175#define __NR_rt_sigprocmask 174
176#define __NR_rt_sigpending 175
177#define __NR_rt_sigtimedwait 176
178#define __NR_rt_sigqueueinfo 177
179#define __NR_rt_sigsuspend 178
180#define __NR_pread64 179
181#define __NR_pwrite64 180
182#define __NR_chown 181
183#define __NR_getcwd 182
184#define __NR_capget 183
185#define __NR_capset 184
186#define __NR_sigaltstack 185
187#define __NR_sendfile 186
188#define __NR_getpmsg 187
189#define __NR_putpmsg 188
190#define __NR_vfork 189
191#define __NR_ugetrlimit 190
192#define __NR_readahead 191
193#define __NR_pciconfig_read 198
194#define __NR_pciconfig_write 199
195#define __NR_pciconfig_iobase 200
196#define __NR_multiplexer 201
197#define __NR_getdents64 202
198#define __NR_pivot_root 203
199#define __NR_madvise 205
200#define __NR_mincore 206
201#define __NR_gettid 207
202#define __NR_tkill 208
203#define __NR_setxattr 209
204#define __NR_lsetxattr 210
205#define __NR_fsetxattr 211
206#define __NR_getxattr 212
207#define __NR_lgetxattr 213
208#define __NR_fgetxattr 214
209#define __NR_listxattr 215
210#define __NR_llistxattr 216
211#define __NR_flistxattr 217
212#define __NR_removexattr 218
213#define __NR_lremovexattr 219
214#define __NR_fremovexattr 220
215#define __NR_futex 221
216#define __NR_sched_setaffinity 222
217#define __NR_sched_getaffinity 223
218#define __NR_tuxcall 225
219#define __NR_io_setup 227
220#define __NR_io_destroy 228
221#define __NR_io_getevents 229
222#define __NR_io_submit 230
223#define __NR_io_cancel 231
224#define __NR_set_tid_address 232
225#define __NR_fadvise64 233
226#define __NR_exit_group 234
227#define __NR_lookup_dcookie 235
228#define __NR_epoll_create 236
229#define __NR_epoll_ctl 237
230#define __NR_epoll_wait 238
231#define __NR_remap_file_pages 239
232#define __NR_timer_create 240
233#define __NR_timer_settime 241
234#define __NR_timer_gettime 242
235#define __NR_timer_getoverrun 243
236#define __NR_timer_delete 244
237#define __NR_clock_settime 245
238#define __NR_clock_gettime 246
239#define __NR_clock_getres 247
240#define __NR_clock_nanosleep 248
241#define __NR_swapcontext 249
242#define __NR_tgkill 250
243#define __NR_utimes 251
244#define __NR_statfs64 252
245#define __NR_fstatfs64 253
246#define __NR_rtas 255
247#define __NR_sys_debug_setcontext 256
248#define __NR_migrate_pages 258
249#define __NR_mbind 259
250#define __NR_get_mempolicy 260
251#define __NR_set_mempolicy 261
252#define __NR_mq_open 262
253#define __NR_mq_unlink 263
254#define __NR_mq_timedsend 264
255#define __NR_mq_timedreceive 265
256#define __NR_mq_notify 266
257#define __NR_mq_getsetattr 267
258#define __NR_kexec_load 268
259#define __NR_add_key 269
260#define __NR_request_key 270
261#define __NR_keyctl 271
262#define __NR_waitid 272
263#define __NR_ioprio_set 273
264#define __NR_ioprio_get 274
265#define __NR_inotify_init 275
266#define __NR_inotify_add_watch 276
267#define __NR_inotify_rm_watch 277
268#define __NR_spu_run 278
269#define __NR_spu_create 279
270#define __NR_pselect6 280
271#define __NR_ppoll 281
272#define __NR_unshare 282
273#define __NR_splice 283
274#define __NR_tee 284
275#define __NR_vmsplice 285
276#define __NR_openat 286
277#define __NR_mkdirat 287
278#define __NR_mknodat 288
279#define __NR_fchownat 289
280#define __NR_futimesat 290
281#define __NR_newfstatat 291
282#define __NR_unlinkat 292
283#define __NR_renameat 293
284#define __NR_linkat 294
285#define __NR_symlinkat 295
286#define __NR_readlinkat 296
287#define __NR_fchmodat 297
288#define __NR_faccessat 298
289#define __NR_get_robust_list 299
290#define __NR_set_robust_list 300
291#define __NR_move_pages 301
292#define __NR_getcpu 302
293#define __NR_epoll_pwait 303
294#define __NR_utimensat 304
295#define __NR_signalfd 305
296#define __NR_timerfd_create 306
297#define __NR_eventfd 307
298#define __NR_sync_file_range2 308
299#define __NR_fallocate 309
300#define __NR_subpage_prot 310
301#define __NR_timerfd_settime 311
302#define __NR_timerfd_gettime 312
303#define __NR_signalfd4 313
304#define __NR_eventfd2 314
305#define __NR_epoll_create1 315
306#define __NR_dup3 316
307#define __NR_pipe2 317
308#define __NR_inotify_init1 318
309#define __NR_perf_event_open 319
310#define __NR_preadv 320
311#define __NR_pwritev 321
312#define __NR_rt_tgsigqueueinfo 322
313#define __NR_fanotify_init 323
314#define __NR_fanotify_mark 324
315#define __NR_prlimit64 325
316#define __NR_socket 326
317#define __NR_bind 327
318#define __NR_connect 328
319#define __NR_listen 329
320#define __NR_accept 330
321#define __NR_getsockname 331
322#define __NR_getpeername 332
323#define __NR_socketpair 333
324#define __NR_send 334
325#define __NR_sendto 335
326#define __NR_recv 336
327#define __NR_recvfrom 337
328#define __NR_shutdown 338
329#define __NR_setsockopt 339
330#define __NR_getsockopt 340
331#define __NR_sendmsg 341
332#define __NR_recvmsg 342
333#define __NR_recvmmsg 343
334#define __NR_accept4 344
335#define __NR_name_to_handle_at 345
336#define __NR_open_by_handle_at 346
337#define __NR_clock_adjtime 347
338#define __NR_syncfs 348
339#define __NR_sendmmsg 349
340#define __NR_setns 350
341#define __NR_process_vm_readv 351
342#define __NR_process_vm_writev 352
343#define __NR_finit_module 353
344#define __NR_kcmp 354
345#define __NR_sched_setattr 355
346#define __NR_sched_getattr 356
347#define __NR_renameat2 357
348#define __NR_seccomp 358
349#define __NR_getrandom 359
350#define __NR_memfd_create 360
351#define __NR_bpf 361
352#define __NR_execveat 362
353#define __NR_switch_endian 363
354#define __NR_userfaultfd 364
355#define __NR_membarrier 365
356#define __NR_mlock2 378
357#define __NR_copy_file_range 379
358#define __NR_preadv2 380
359#define __NR_pwritev2 381
360#define __NR_kexec_file_load 382
361#define __NR_statx 383
362#define __NR_pkey_alloc 384
363#define __NR_pkey_free 385
364#define __NR_pkey_mprotect 386
365#define __NR_rseq 387
366#define __NR_io_pgetevents 388
367
libc/musl/arch/powerpc64/bits/termios.h created+171
...@@ -0,0 +1,171 @@
1#undef NCCS
2#define NCCS 19
3struct termios {
4 tcflag_t c_iflag;
5 tcflag_t c_oflag;
6 tcflag_t c_cflag;
7 tcflag_t c_lflag;
8 cc_t c_cc[NCCS];
9 cc_t c_line;
10 speed_t __c_ispeed;
11 speed_t __c_ospeed;
12};
13
14#define VINTR 0
15#define VQUIT 1
16#define VERASE 2
17#define VKILL 3
18#define VEOF 4
19#define VMIN 5
20#define VEOL 6
21#define VTIME 7
22#define VEOL2 8
23#define VSWTC 9
24#define VWERASE 10
25#define VREPRINT 11
26#define VSUSP 12
27#define VSTART 13
28#define VSTOP 14
29#define VLNEXT 15
30#define VDISCARD 16
31
32#define IGNBRK 0000001
33#define BRKINT 0000002
34#define IGNPAR 0000004
35#define PARMRK 0000010
36#define INPCK 0000020
37#define ISTRIP 0000040
38#define INLCR 0000100
39#define IGNCR 0000200
40#define ICRNL 0000400
41#define IXON 0001000
42#define IXOFF 0002000
43#define IXANY 0004000
44#define IUCLC 0010000
45#define IMAXBEL 0020000
46#define IUTF8 0040000
47
48#define OPOST 0000001
49#define ONLCR 0000002
50#define OLCUC 0000004
51#define OCRNL 0000010
52#define ONOCR 0000020
53#define ONLRET 0000040
54#define OFILL 0000100
55#define OFDEL 0000200
56#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
57#define NLDLY 0001400
58#define NL0 0000000
59#define NL1 0000400
60#define NL2 0001000
61#define NL3 0001400
62#define TABDLY 0006000
63#define TAB0 0000000
64#define TAB1 0002000
65#define TAB2 0004000
66#define TAB3 0006000
67#define CRDLY 0030000
68#define CR0 0000000
69#define CR1 0010000
70#define CR2 0020000
71#define CR3 0030000
72#define FFDLY 0040000
73#define FF0 0000000
74#define FF1 0040000
75#define BSDLY 0100000
76#define BS0 0000000
77#define BS1 0100000
78#endif
79
80#define VTDLY 0200000
81#define VT0 0000000
82#define VT1 0200000
83
84#define B0 0000000
85#define B50 0000001
86#define B75 0000002
87#define B110 0000003
88#define B134 0000004
89#define B150 0000005
90#define B200 0000006
91#define B300 0000007
92#define B600 0000010
93#define B1200 0000011
94#define B1800 0000012
95#define B2400 0000013
96#define B4800 0000014
97#define B9600 0000015
98#define B19200 0000016
99#define B38400 0000017
100
101#define B57600 00020
102#define B115200 00021
103#define B230400 00022
104#define B460800 00023
105#define B500000 00024
106#define B576000 00025
107#define B921600 00026
108#define B1000000 00027
109#define B1152000 00030
110#define B1500000 00031
111#define B2000000 00032
112#define B2500000 00033
113#define B3000000 00034
114#define B3500000 00035
115#define B4000000 00036
116
117#define CSIZE 00001400
118#define CS5 00000000
119#define CS6 00000400
120#define CS7 00001000
121#define CS8 00001400
122#define CSTOPB 00002000
123#define CREAD 00004000
124#define PARENB 00010000
125#define PARODD 00020000
126#define HUPCL 00040000
127#define CLOCAL 00100000
128
129#define ECHOE 0x00000002
130#define ECHOK 0x00000004
131#define ECHO 0x00000008
132#define ECHONL 0x00000010
133#define ISIG 0x00000080
134#define ICANON 0x00000100
135#define IEXTEN 0x00000400
136#define TOSTOP 0x00400000
137#define NOFLSH 0x80000000
138
139#define TCOOFF 0
140#define TCOON 1
141#define TCIOFF 2
142#define TCION 3
143
144#define TCIFLUSH 0
145#define TCOFLUSH 1
146#define TCIOFLUSH 2
147
148#define TCSANOW 0
149#define TCSADRAIN 1
150#define TCSAFLUSH 2
151
152#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
153#define EXTA 0000016
154#define EXTB 0000017
155#define CBAUD 00377
156#define CBAUDEX 0000020
157#define CIBAUD 077600000
158#define CMSPAR 010000000000
159#define CRTSCTS 020000000000
160
161#define XCASE 0x00004000
162#define ECHOCTL 0x00000040
163#define ECHOPRT 0x00000020
164#define ECHOKE 0x00000001
165#define FLUSHO 0x00800000
166#define PENDIN 0x20000000
167#define EXTPROC 0x10000000
168
169#define XTABS 00006000
170#define TIOCSER_TEMT 0x01
171#endif
libc/musl/arch/powerpc64/bits/user.h created+25
...@@ -0,0 +1,25 @@
1struct pt_regs {
2 unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe;
3 unsigned long trap, dar, dsisr, result;
4};
5
6struct user {
7 struct pt_regs regs;
8 unsigned long u_tsize, u_dsize, u_ssize;
9 unsigned long start_code, start_data, start_stack;
10 long signal;
11 void *u_ar0;
12 unsigned long magic;
13 char u_comm[32];
14};
15
16#define ELF_NGREG 48
17#define ELF_NFPREG 33
18#define ELF_NVRREG 34
19typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
20typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
21typedef struct { unsigned u[4]; }
22#ifdef __GNUC__
23__attribute__((__aligned__(16)))
24#endif
25 elf_vrreg_t, elf_vrregset_t[ELF_NVRREG];
libc/musl/arch/powerpc64/crt_arch.h created+19
...@@ -0,0 +1,19 @@
1__asm__(
2".text \n"
3".global " START " \n"
4".type " START ", %function \n"
5START ": \n"
6" addis 2, 12, .TOC.-" START "@ha \n"
7" addi 2, 2, .TOC.-" START "@l \n"
8" lwz 4, 1f-" START "(12)\n"
9" add 4, 4, 12 \n"
10" mr 3, 1 \n"
11" clrrdi 1, 1, 4 \n"
12" li 0, 0 \n"
13" stdu 0, -32(1) \n"
14" mtlr 0 \n"
15" bl " START "_c \n"
16".weak _DYNAMIC \n"
17".hidden _DYNAMIC \n"
18"1: .long _DYNAMIC-" START "\n"
19);
libc/musl/arch/powerpc64/pthread_arch.h created+18
...@@ -0,0 +1,18 @@
1static inline struct pthread *__pthread_self()
2{
3 register char *tp __asm__("r13");
4 __asm__ ("" : "=r" (tp) );
5 return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
6}
7
8#define TLS_ABOVE_TP
9#define GAP_ABOVE_TP 0
10#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
11
12#define DTP_OFFSET 0x8000
13
14// the kernel calls the ip "nip", it's the first saved value after the 32
15// GPRs.
16#define MC_PC gp_regs[32]
17
18#define CANARY canary_at_end
libc/musl/arch/powerpc64/reloc.h created+32
...@@ -0,0 +1,32 @@
1#include <endian.h>
2
3#if __BYTE_ORDER == __LITTLE_ENDIAN
4#define ENDIAN_SUFFIX "le"
5#else
6#define ENDIAN_SUFFIX ""
7#endif
8
9#define LDSO_ARCH "powerpc64" ENDIAN_SUFFIX
10
11#define TPOFF_K (-0x7000)
12
13#define REL_SYMBOLIC R_PPC64_ADDR64
14#define REL_GOT R_PPC64_GLOB_DAT
15#define REL_PLT R_PPC64_JMP_SLOT
16#define REL_RELATIVE R_PPC64_RELATIVE
17#define REL_COPY R_PPC64_COPY
18#define REL_DTPMOD R_PPC64_DTPMOD64
19#define REL_DTPOFF R_PPC64_DTPREL64
20#define REL_TPOFF R_PPC64_TPREL64
21
22#define CRTJMP(pc,sp) __asm__ __volatile__( \
23 "mr 1,%1; mr 12,%0; mtctr 12; bctrl" : : "r"(pc), "r"(sp) : "memory" )
24
25#define GETFUNCSYM(fp, sym, got) __asm__ ( \
26 ".hidden " #sym " \n" \
27 " bl 1f \n" \
28 " .long " #sym "-. \n" \
29 "1: mflr %1 \n" \
30 " lwa %0, 0(%1) \n" \
31 " add %0, %0, %1 \n" \
32 : "=r"(*(fp)), "=r"((long){0}) : : "memory", "lr" )
libc/musl/arch/powerpc64/syscall_arch.h created+87
...@@ -0,0 +1,87 @@
1#define __SYSCALL_LL_E(x) (x)
2#define __SYSCALL_LL_O(x) (x)
3
4static inline long __syscall0(long n)
5{
6 register long r0 __asm__("r0") = n;
7 register long r3 __asm__("r3");
8 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
9 : "+r"(r0), "=r"(r3)
10 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
11 return r3;
12}
13
14static inline long __syscall1(long n, long a)
15{
16 register long r0 __asm__("r0") = n;
17 register long r3 __asm__("r3") = a;
18 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
19 : "+r"(r0), "+r"(r3)
20 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
21 return r3;
22}
23
24static inline long __syscall2(long n, long a, long b)
25{
26 register long r0 __asm__("r0") = n;
27 register long r3 __asm__("r3") = a;
28 register long r4 __asm__("r4") = b;
29 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
30 : "+r"(r0), "+r"(r3), "+r"(r4)
31 :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
32 return r3;
33}
34
35static inline long __syscall3(long n, long a, long b, long c)
36{
37 register long r0 __asm__("r0") = n;
38 register long r3 __asm__("r3") = a;
39 register long r4 __asm__("r4") = b;
40 register long r5 __asm__("r5") = c;
41 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
42 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
43 :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
44 return r3;
45}
46
47static inline long __syscall4(long n, long a, long b, long c, long d)
48{
49 register long r0 __asm__("r0") = n;
50 register long r3 __asm__("r3") = a;
51 register long r4 __asm__("r4") = b;
52 register long r5 __asm__("r5") = c;
53 register long r6 __asm__("r6") = d;
54 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
55 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
56 :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");
57 return r3;
58}
59
60static inline long __syscall5(long n, long a, long b, long c, long d, long e)
61{
62 register long r0 __asm__("r0") = n;
63 register long r3 __asm__("r3") = a;
64 register long r4 __asm__("r4") = b;
65 register long r5 __asm__("r5") = c;
66 register long r6 __asm__("r6") = d;
67 register long r7 __asm__("r7") = e;
68 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
69 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
70 :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");
71 return r3;
72}
73
74static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
75{
76 register long r0 __asm__("r0") = n;
77 register long r3 __asm__("r3") = a;
78 register long r4 __asm__("r4") = b;
79 register long r5 __asm__("r5") = c;
80 register long r6 __asm__("r6") = d;
81 register long r7 __asm__("r7") = e;
82 register long r8 __asm__("r8") = f;
83 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
84 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
85 :: "memory", "cr0", "r9", "r10", "r11", "r12");
86 return r3;
87}
libc/musl/arch/s390x/atomic_arch.h created+30
...@@ -0,0 +1,30 @@
1#define a_cas a_cas
2static inline int a_cas(volatile int *p, int t, int s)
3{
4 __asm__ __volatile__ (
5 "cs %0, %2, %1"
6 : "+d"(t), "+Q"(*p) : "d"(s) : "memory", "cc");
7 return t;
8}
9
10#define a_cas_p a_cas_p
11static inline void *a_cas_p(volatile void *p, void *t, void *s)
12{
13 __asm__ __volatile__ (
14 "csg %0, %2, %1"
15 : "+d"(t), "+Q"(*(void *volatile *)p) : "d"(s)
16 : "memory", "cc");
17 return t;
18}
19
20#define a_barrier a_barrier
21static inline void a_barrier()
22{
23 __asm__ __volatile__ ("bcr 15,0" : : : "memory");
24}
25
26#define a_crash a_crash
27static inline void a_crash()
28{
29 __asm__ __volatile__ (".insn e,0");
30}
libc/musl/arch/s390x/bits/alltypes.h.in created+26
...@@ -0,0 +1,26 @@
1#define _Addr long
2#define _Int64 long
3#define _Reg long
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF int wchar_t;
10#endif
11
12TYPEDEF double float_t;
13TYPEDEF double double_t;
14
15TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
16
17TYPEDEF long time_t;
18TYPEDEF long suseconds_t;
19
20TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
21TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
22TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
23TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
24TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
25TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
26TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
libc/musl/arch/s390x/bits/endian.h created+1
...@@ -0,0 +1 @@
1#define __BYTE_ORDER __BIG_ENDIAN
libc/musl/arch/s390x/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0100
2#define O_EXCL 0200
3#define O_NOCTTY 0400
4#define O_TRUNC 01000
5#define O_APPEND 02000
6#define O_NONBLOCK 04000
7#define O_DSYNC 010000
8#define O_SYNC 04010000
9#define O_RSYNC 04010000
10#define O_DIRECTORY 0200000
11#define O_NOFOLLOW 0400000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 020000
15#define O_DIRECT 040000
16#define O_LARGEFILE 0100000
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020200000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_GETLK 5
29#define F_SETLK 6
30#define F_SETLKW 7
31
32#define F_SETOWN 8
33#define F_GETOWN 9
34#define F_SETSIG 10
35#define F_GETSIG 11
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/s390x/bits/fenv.h created+17
...@@ -0,0 +1,17 @@
1#define FE_TONEAREST 0
2#define FE_TOWARDZERO 1
3#define FE_UPWARD 2
4#define FE_DOWNWARD 3
5
6#define FE_INEXACT 0x00080000
7#define FE_UNDERFLOW 0x00100000
8#define FE_OVERFLOW 0x00200000
9#define FE_DIVBYZERO 0x00400000
10#define FE_INVALID 0x00800000
11
12#define FE_ALL_EXCEPT 0x00f80000
13
14typedef unsigned fexcept_t;
15typedef unsigned fenv_t;
16
17#define FE_DFL_ENV ((const fenv_t *)-1)
libc/musl/arch/s390x/bits/float.h created+16
...@@ -0,0 +1,16 @@
1#define FLT_EVAL_METHOD 1
2
3#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
4#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
5#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
6#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
7
8#define LDBL_MANT_DIG 113
9#define LDBL_MIN_EXP (-16381)
10#define LDBL_MAX_EXP 16384
11
12#define LDBL_DIG 33
13#define LDBL_MIN_10_EXP (-4931)
14#define LDBL_MAX_10_EXP 4932
15
16#define DECIMAL_DIG 36
libc/musl/arch/s390x/bits/hwcap.h created+15
...@@ -0,0 +1,15 @@
1#define HWCAP_S390_ESAN3 1
2#define HWCAP_S390_ZARCH 2
3#define HWCAP_S390_STFLE 4
4#define HWCAP_S390_MSA 8
5#define HWCAP_S390_LDISP 16
6#define HWCAP_S390_EIMM 32
7#define HWCAP_S390_DFP 64
8#define HWCAP_S390_HPAGE 128
9#define HWCAP_S390_ETF3EH 256
10#define HWCAP_S390_HIGH_GPRS 512
11#define HWCAP_S390_TE 1024
12#define HWCAP_S390_VXRS 2048
13#define HWCAP_S390_VXRS_BCD 4096
14#define HWCAP_S390_VXRS_EXT 8192
15#define HWCAP_S390_GS 16384
libc/musl/arch/s390x/bits/ioctl_fix.h created+2
...@@ -0,0 +1,2 @@
1#undef FIOQSIZE
2#define FIOQSIZE 0x545e
libc/musl/arch/s390x/bits/ipc.h created+14
...@@ -0,0 +1,14 @@
1struct ipc_perm {
2 key_t __ipc_perm_key;
3 uid_t uid;
4 gid_t gid;
5 uid_t cuid;
6 gid_t cgid;
7 mode_t mode;
8 unsigned short __pad1;
9 unsigned short __ipc_perm_seq;
10 unsigned long __pad2;
11 unsigned long __pad3;
12};
13
14#define IPC_64 0x100
libc/musl/arch/s390x/bits/limits.h created+8
...@@ -0,0 +1,8 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define PAGESIZE 4096
4#define LONG_BIT 64
5#endif
6
7#define LONG_MAX 0x7fffffffffffffffL
8#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/s390x/bits/link.h created+1
...@@ -0,0 +1 @@
1typedef uint64_t Elf_Symndx;
libc/musl/arch/s390x/bits/msg.h created+12
...@@ -0,0 +1,12 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 time_t msg_stime;
4 time_t msg_rtime;
5 time_t msg_ctime;
6 unsigned long msg_cbytes;
7 msgqnum_t msg_qnum;
8 msglen_t msg_qbytes;
9 pid_t msg_lspid;
10 pid_t msg_lrpid;
11 unsigned long __unused[2];
12};
libc/musl/arch/s390x/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_LP64_OFF64 1
2#define _POSIX_V7_LP64_OFF64 1
libc/musl/arch/s390x/bits/ptrace.h created+9
...@@ -0,0 +1,9 @@
1#define PTRACE_SINGLEBLOCK 12
2#define PTRACE_PEEKUSR_AREA 0x5000
3#define PTRACE_POKEUSR_AREA 0x5001
4#define PTRACE_GET_LAST_BREAK 0x5006
5#define PTRACE_ENABLE_TE 0x5009
6#define PTRACE_DISABLE_TE 0x5010
7#define PTRACE_TE_ABORT_RAND 0x5011
8
9#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
libc/musl/arch/s390x/bits/reg.h created+2
...@@ -0,0 +1,2 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
libc/musl/arch/s390x/bits/sem.h created+7
...@@ -0,0 +1,7 @@
1struct semid_ds {
2 struct ipc_perm sem_perm;
3 time_t sem_otime;
4 time_t sem_ctime;
5 unsigned short __pad[3], sem_nsems;
6 unsigned long __unused[2];
7};
libc/musl/arch/s390x/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[18];
libc/musl/arch/s390x/bits/shm.h created+25
...@@ -0,0 +1,25 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 time_t shm_atime;
7 time_t shm_dtime;
8 time_t shm_ctime;
9 pid_t shm_cpid;
10 pid_t shm_lpid;
11 unsigned long shm_nattch;
12 unsigned long __pad1;
13 unsigned long __pad2;
14};
15
16struct shminfo {
17 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
18};
19
20struct shm_info {
21 int __used_ids;
22 unsigned long shm_tot, shm_rss, shm_swp;
23 unsigned long __swap_attempts, __swap_successes;
24};
25
libc/musl/arch/s390x/bits/signal.h created+121
...@@ -0,0 +1,121 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 4096
6#define SIGSTKSZ 10240
7#endif
8
9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10
11typedef unsigned long greg_t, gregset_t[27];
12
13typedef struct {
14 unsigned long mask;
15 unsigned long addr;
16} __psw_t;
17
18typedef union {
19 double d;
20 float f;
21} fpreg_t;
22
23typedef struct {
24 unsigned fpc;
25 fpreg_t fprs[16];
26} fpregset_t;
27
28typedef struct
29{
30 __psw_t psw;
31 unsigned long gregs[16];
32 unsigned aregs[16];
33 fpregset_t fpregs;
34} mcontext_t;
35
36struct sigcontext {
37 unsigned long oldmask[1];
38 struct {
39 struct {
40 __psw_t psw;
41 unsigned long gprs[16];
42 unsigned acrs[16];
43 } regs;
44 struct {
45 unsigned fpc;
46 double fprs[16];
47 } fpregs;
48 } *sregs;
49};
50
51#else
52
53typedef struct {
54 unsigned long __regs1[18];
55 unsigned __regs2[18];
56 double __regs3[16];
57} mcontext_t;
58
59#endif
60
61struct sigaltstack {
62 void *ss_sp;
63 int ss_flags;
64 size_t ss_size;
65};
66
67typedef struct __ucontext {
68 unsigned long uc_flags;
69 struct __ucontext *uc_link;
70 stack_t uc_stack;
71 mcontext_t uc_mcontext;
72 sigset_t uc_sigmask;
73} ucontext_t;
74
75#define SA_NOCLDSTOP 1U
76#define SA_NOCLDWAIT 2U
77#define SA_SIGINFO 4U
78#define SA_ONSTACK 0x08000000U
79#define SA_RESTART 0x10000000U
80#define SA_NODEFER 0x40000000U
81#define SA_RESETHAND 0x80000000U
82#define SA_RESTORER 0x04000000U
83
84#endif
85
86#define SIGHUP 1
87#define SIGINT 2
88#define SIGQUIT 3
89#define SIGILL 4
90#define SIGTRAP 5
91#define SIGABRT 6
92#define SIGIOT SIGABRT
93#define SIGBUS 7
94#define SIGFPE 8
95#define SIGKILL 9
96#define SIGUSR1 10
97#define SIGSEGV 11
98#define SIGUSR2 12
99#define SIGPIPE 13
100#define SIGALRM 14
101#define SIGTERM 15
102#define SIGSTKFLT 16
103#define SIGCHLD 17
104#define SIGCONT 18
105#define SIGSTOP 19
106#define SIGTSTP 20
107#define SIGTTIN 21
108#define SIGTTOU 22
109#define SIGURG 23
110#define SIGXCPU 24
111#define SIGXFSZ 25
112#define SIGVTALRM 26
113#define SIGPROF 27
114#define SIGWINCH 28
115#define SIGIO 29
116#define SIGPOLL SIGIO
117#define SIGPWR 30
118#define SIGSYS 31
119#define SIGUNUSED SIGSYS
120
121#define _NSIG 65
libc/musl/arch/s390x/bits/socket.h created+44
...@@ -0,0 +1,44 @@
1struct msghdr {
2 void *msg_name;
3 socklen_t msg_namelen;
4 struct iovec *msg_iov;
5 int __pad1, msg_iovlen;
6 void *msg_control;
7 int __pad2;
8 socklen_t msg_controllen;
9 int msg_flags;
10};
11
12struct cmsghdr {
13 int __pad1;
14 socklen_t cmsg_len;
15 int cmsg_level;
16 int cmsg_type;
17};
18
19#define SO_DEBUG 1
20#define SO_REUSEADDR 2
21#define SO_TYPE 3
22#define SO_ERROR 4
23#define SO_DONTROUTE 5
24#define SO_BROADCAST 6
25#define SO_SNDBUF 7
26#define SO_RCVBUF 8
27#define SO_KEEPALIVE 9
28#define SO_OOBINLINE 10
29#define SO_NO_CHECK 11
30#define SO_PRIORITY 12
31#define SO_LINGER 13
32#define SO_BSDCOMPAT 14
33#define SO_REUSEPORT 15
34#define SO_PASSCRED 16
35#define SO_PEERCRED 17
36#define SO_RCVLOWAT 18
37#define SO_SNDLOWAT 19
38#define SO_RCVTIMEO 20
39#define SO_SNDTIMEO 21
40#define SO_ACCEPTCONN 30
41#define SO_SNDBUFFORCE 32
42#define SO_RCVBUFFORCE 33
43#define SO_PROTOCOL 38
44#define SO_DOMAIN 39
libc/musl/arch/s390x/bits/stat.h created+16
...@@ -0,0 +1,16 @@
1struct stat {
2 dev_t st_dev;
3 ino_t st_ino;
4 nlink_t st_nlink;
5 mode_t st_mode;
6 uid_t st_uid;
7 gid_t st_gid;
8 dev_t st_rdev;
9 off_t st_size;
10 struct timespec st_atim;
11 struct timespec st_mtim;
12 struct timespec st_ctim;
13 blksize_t st_blksize;
14 blkcnt_t st_blocks;
15 unsigned long __unused[3];
16};
libc/musl/arch/s390x/bits/statfs.h created+7
...@@ -0,0 +1,7 @@
1struct statfs {
2 unsigned f_type, f_bsize;
3 fsblkcnt_t f_blocks, f_bfree, f_bavail;
4 fsfilcnt_t f_files, f_ffree;
5 fsid_t f_fsid;
6 unsigned f_namelen, f_frsize, f_flags, f_spare[4];
7};
libc/musl/arch/s390x/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT64_MIN
16#define INTPTR_MAX INT64_MAX
17#define UINTPTR_MAX UINT64_MAX
18#define PTRDIFF_MIN INT64_MIN
19#define PTRDIFF_MAX INT64_MAX
20#define SIZE_MAX UINT64_MAX
libc/musl/arch/s390x/bits/syscall.h.in created+329
...@@ -0,0 +1,329 @@
1#define __NR_exit 1
2#define __NR_fork 2
3#define __NR_read 3
4#define __NR_write 4
5#define __NR_open 5
6#define __NR_close 6
7#define __NR_restart_syscall 7
8#define __NR_creat 8
9#define __NR_link 9
10#define __NR_unlink 10
11#define __NR_execve 11
12#define __NR_chdir 12
13#define __NR_mknod 14
14#define __NR_chmod 15
15#define __NR_lseek 19
16#define __NR_getpid 20
17#define __NR_mount 21
18#define __NR_umount 22
19#define __NR_ptrace 26
20#define __NR_alarm 27
21#define __NR_pause 29
22#define __NR_utime 30
23#define __NR_access 33
24#define __NR_nice 34
25#define __NR_sync 36
26#define __NR_kill 37
27#define __NR_rename 38
28#define __NR_mkdir 39
29#define __NR_rmdir 40
30#define __NR_dup 41
31#define __NR_pipe 42
32#define __NR_times 43
33#define __NR_brk 45
34#define __NR_signal 48
35#define __NR_acct 51
36#define __NR_umount2 52
37#define __NR_ioctl 54
38#define __NR_fcntl 55
39#define __NR_setpgid 57
40#define __NR_umask 60
41#define __NR_chroot 61
42#define __NR_ustat 62
43#define __NR_dup2 63
44#define __NR_getppid 64
45#define __NR_getpgrp 65
46#define __NR_setsid 66
47#define __NR_sigaction 67
48#define __NR_sigsuspend 72
49#define __NR_sigpending 73
50#define __NR_sethostname 74
51#define __NR_setrlimit 75
52#define __NR_getrusage 77
53#define __NR_gettimeofday 78
54#define __NR_settimeofday 79
55#define __NR_symlink 83
56#define __NR_readlink 85
57#define __NR_uselib 86
58#define __NR_swapon 87
59#define __NR_reboot 88
60#define __NR_readdir 89
61#define __NR_mmap 90
62#define __NR_munmap 91
63#define __NR_truncate 92
64#define __NR_ftruncate 93
65#define __NR_fchmod 94
66#define __NR_getpriority 96
67#define __NR_setpriority 97
68#define __NR_statfs 99
69#define __NR_fstatfs 100
70#define __NR_socketcall 102
71#define __NR_syslog 103
72#define __NR_setitimer 104
73#define __NR_getitimer 105
74#define __NR_stat 106
75#define __NR_lstat 107
76#define __NR_fstat 108
77#define __NR_lookup_dcookie 110
78#define __NR_vhangup 111
79#define __NR_idle 112
80#define __NR_wait4 114
81#define __NR_swapoff 115
82#define __NR_sysinfo 116
83#define __NR_ipc 117
84#define __NR_fsync 118
85#define __NR_sigreturn 119
86#define __NR_clone 120
87#define __NR_setdomainname 121
88#define __NR_uname 122
89#define __NR_adjtimex 124
90#define __NR_mprotect 125
91#define __NR_sigprocmask 126
92#define __NR_create_module 127
93#define __NR_init_module 128
94#define __NR_delete_module 129
95#define __NR_get_kernel_syms 130
96#define __NR_quotactl 131
97#define __NR_getpgid 132
98#define __NR_fchdir 133
99#define __NR_bdflush 134
100#define __NR_sysfs 135
101#define __NR_personality 136
102#define __NR_afs_syscall 137
103#define __NR_getdents 141
104#define __NR_select 142
105#define __NR_flock 143
106#define __NR_msync 144
107#define __NR_readv 145
108#define __NR_writev 146
109#define __NR_getsid 147
110#define __NR_fdatasync 148
111#define __NR__sysctl 149
112#define __NR_mlock 150
113#define __NR_munlock 151
114#define __NR_mlockall 152
115#define __NR_munlockall 153
116#define __NR_sched_setparam 154
117#define __NR_sched_getparam 155
118#define __NR_sched_setscheduler 156
119#define __NR_sched_getscheduler 157
120#define __NR_sched_yield 158
121#define __NR_sched_get_priority_max 159
122#define __NR_sched_get_priority_min 160
123#define __NR_sched_rr_get_interval 161
124#define __NR_nanosleep 162
125#define __NR_mremap 163
126#define __NR_query_module 167
127#define __NR_poll 168
128#define __NR_nfsservctl 169
129#define __NR_prctl 172
130#define __NR_rt_sigreturn 173
131#define __NR_rt_sigaction 174
132#define __NR_rt_sigprocmask 175
133#define __NR_rt_sigpending 176
134#define __NR_rt_sigtimedwait 177
135#define __NR_rt_sigqueueinfo 178
136#define __NR_rt_sigsuspend 179
137#define __NR_pread64 180
138#define __NR_pwrite64 181
139#define __NR_getcwd 183
140#define __NR_capget 184
141#define __NR_capset 185
142#define __NR_sigaltstack 186
143#define __NR_sendfile 187
144#define __NR_getpmsg 188
145#define __NR_putpmsg 189
146#define __NR_vfork 190
147#define __NR_getrlimit 191
148#define __NR_lchown 198
149#define __NR_getuid 199
150#define __NR_getgid 200
151#define __NR_geteuid 201
152#define __NR_getegid 202
153#define __NR_setreuid 203
154#define __NR_setregid 204
155#define __NR_getgroups 205
156#define __NR_setgroups 206
157#define __NR_fchown 207
158#define __NR_setresuid 208
159#define __NR_getresuid 209
160#define __NR_setresgid 210
161#define __NR_getresgid 211
162#define __NR_chown 212
163#define __NR_setuid 213
164#define __NR_setgid 214
165#define __NR_setfsuid 215
166#define __NR_setfsgid 216
167#define __NR_pivot_root 217
168#define __NR_mincore 218
169#define __NR_madvise 219
170#define __NR_getdents64 220
171#define __NR_readahead 222
172#define __NR_setxattr 224
173#define __NR_lsetxattr 225
174#define __NR_fsetxattr 226
175#define __NR_getxattr 227
176#define __NR_lgetxattr 228
177#define __NR_fgetxattr 229
178#define __NR_listxattr 230
179#define __NR_llistxattr 231
180#define __NR_flistxattr 232
181#define __NR_removexattr 233
182#define __NR_lremovexattr 234
183#define __NR_fremovexattr 235
184#define __NR_gettid 236
185#define __NR_tkill 237
186#define __NR_futex 238
187#define __NR_sched_setaffinity 239
188#define __NR_sched_getaffinity 240
189#define __NR_tgkill 241
190#define __NR_io_setup 243
191#define __NR_io_destroy 244
192#define __NR_io_getevents 245
193#define __NR_io_submit 246
194#define __NR_io_cancel 247
195#define __NR_exit_group 248
196#define __NR_epoll_create 249
197#define __NR_epoll_ctl 250
198#define __NR_epoll_wait 251
199#define __NR_set_tid_address 252
200#define __NR_fadvise64 253
201#define __NR_timer_create 254
202#define __NR_timer_settime 255
203#define __NR_timer_gettime 256
204#define __NR_timer_getoverrun 257
205#define __NR_timer_delete 258
206#define __NR_clock_settime 259
207#define __NR_clock_gettime 260
208#define __NR_clock_getres 261
209#define __NR_clock_nanosleep 262
210#define __NR_statfs64 265
211#define __NR_fstatfs64 266
212#define __NR_remap_file_pages 267
213#define __NR_mbind 268
214#define __NR_get_mempolicy 269
215#define __NR_set_mempolicy 270
216#define __NR_mq_open 271
217#define __NR_mq_unlink 272
218#define __NR_mq_timedsend 273
219#define __NR_mq_timedreceive 274
220#define __NR_mq_notify 275
221#define __NR_mq_getsetattr 276
222#define __NR_kexec_load 277
223#define __NR_add_key 278
224#define __NR_request_key 279
225#define __NR_keyctl 280
226#define __NR_waitid 281
227#define __NR_ioprio_set 282
228#define __NR_ioprio_get 283
229#define __NR_inotify_init 284
230#define __NR_inotify_add_watch 285
231#define __NR_inotify_rm_watch 286
232#define __NR_migrate_pages 287
233#define __NR_openat 288
234#define __NR_mkdirat 289
235#define __NR_mknodat 290
236#define __NR_fchownat 291
237#define __NR_futimesat 292
238#define __NR_newfstatat 293
239#define __NR_unlinkat 294
240#define __NR_renameat 295
241#define __NR_linkat 296
242#define __NR_symlinkat 297
243#define __NR_readlinkat 298
244#define __NR_fchmodat 299
245#define __NR_faccessat 300
246#define __NR_pselect6 301
247#define __NR_ppoll 302
248#define __NR_unshare 303
249#define __NR_set_robust_list 304
250#define __NR_get_robust_list 305
251#define __NR_splice 306
252#define __NR_sync_file_range 307
253#define __NR_tee 308
254#define __NR_vmsplice 309
255#define __NR_move_pages 310
256#define __NR_getcpu 311
257#define __NR_epoll_pwait 312
258#define __NR_utimes 313
259#define __NR_fallocate 314
260#define __NR_utimensat 315
261#define __NR_signalfd 316
262#define __NR_timerfd 317
263#define __NR_eventfd 318
264#define __NR_timerfd_create 319
265#define __NR_timerfd_settime 320
266#define __NR_timerfd_gettime 321
267#define __NR_signalfd4 322
268#define __NR_eventfd2 323
269#define __NR_inotify_init1 324
270#define __NR_pipe2 325
271#define __NR_dup3 326
272#define __NR_epoll_create1 327
273#define __NR_preadv 328
274#define __NR_pwritev 329
275#define __NR_rt_tgsigqueueinfo 330
276#define __NR_perf_event_open 331
277#define __NR_fanotify_init 332
278#define __NR_fanotify_mark 333
279#define __NR_prlimit64 334
280#define __NR_name_to_handle_at 335
281#define __NR_open_by_handle_at 336
282#define __NR_clock_adjtime 337
283#define __NR_syncfs 338
284#define __NR_setns 339
285#define __NR_process_vm_readv 340
286#define __NR_process_vm_writev 341
287#define __NR_s390_runtime_instr 342
288#define __NR_kcmp 343
289#define __NR_finit_module 344
290#define __NR_sched_setattr 345
291#define __NR_sched_getattr 346
292#define __NR_renameat2 347
293#define __NR_seccomp 348
294#define __NR_getrandom 349
295#define __NR_memfd_create 350
296#define __NR_bpf 351
297#define __NR_s390_pci_mmio_write 352
298#define __NR_s390_pci_mmio_read 353
299#define __NR_execveat 354
300#define __NR_userfaultfd 355
301#define __NR_membarrier 356
302#define __NR_recvmmsg 357
303#define __NR_sendmmsg 358
304#define __NR_socket 359
305#define __NR_socketpair 360
306#define __NR_bind 361
307#define __NR_connect 362
308#define __NR_listen 363
309#define __NR_accept4 364
310#define __NR_getsockopt 365
311#define __NR_setsockopt 366
312#define __NR_getsockname 367
313#define __NR_getpeername 368
314#define __NR_sendto 369
315#define __NR_sendmsg 370
316#define __NR_recvfrom 371
317#define __NR_recvmsg 372
318#define __NR_shutdown 373
319#define __NR_mlock2 374
320#define __NR_copy_file_range 375
321#define __NR_preadv2 376
322#define __NR_pwritev2 377
323#define __NR_s390_guarded_storage 378
324#define __NR_statx 379
325#define __NR_s390_sthyi 380
326#define __NR_kexec_file_load 381
327#define __NR_io_pgetevents 382
328#define __NR_rseq 383
329
libc/musl/arch/s390x/bits/user.h created+62
...@@ -0,0 +1,62 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
3
4typedef union {
5 double d;
6 float f;
7} elf_fpreg_t;
8
9typedef struct {
10 unsigned fpc;
11 elf_fpreg_t fprs[16];
12} elf_fpregset_t;
13
14#define ELF_NGREG 27
15typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
16
17struct _user_psw_struct {
18 unsigned long mask, addr;
19};
20
21struct _user_fpregs_struct {
22 unsigned fpc;
23 double fprs[16];
24};
25
26struct _user_per_struct {
27 unsigned long control_regs[3];
28 unsigned single_step : 1;
29 unsigned instruction_fetch : 1;
30 unsigned : 30;
31 unsigned long starting_addr, ending_addr;
32 unsigned short perc_atmid;
33 unsigned long address;
34 unsigned char access_id;
35};
36
37struct _user_regs_struct {
38 struct _user_psw_struct psw;
39 unsigned long gprs[16];
40 unsigned acrs[16];
41 unsigned long orig_gpr2;
42 struct _user_fpregs_struct fp_regs;
43 struct _user_per_struct per_info;
44 unsigned long ieee_instruction_pointer;
45};
46
47struct user {
48 struct _user_regs_struct regs;
49 unsigned long u_tsize, u_dsize, u_ssize;
50 unsigned long start_code, start_stack;
51 long signal;
52 struct _user_regs_struct *u_ar0;
53 unsigned long magic;
54 char u_comm[32];
55};
56
57#define PAGE_MASK (~(PAGESIZE-1))
58#define NBPG PAGESIZE
59#define UPAGES 1
60#define HOST_TEXT_START_ADDR (u.start_code)
61#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
62
libc/musl/arch/s390x/crt_arch.h created+17
...@@ -0,0 +1,17 @@
1__asm__(
2".text\n"
3".global " START "\n"
4".type " START ", %function\n"
5START ":\n"
6" lgr %r2, %r15\n"
7" larl %r3, 1f\n"
8" agf %r3, 0(%r3)\n"
9" aghi %r15, -160\n"
10" lghi %r0, 0\n"
11" stg %r0, 0(%r15)\n"
12" jg " START "_c\n"
13" .align 8\n"
14".weak _DYNAMIC\n"
15".hidden _DYNAMIC\n"
16"1: .long _DYNAMIC-.\n"
17);
libc/musl/arch/s390x/pthread_arch.h created+14
...@@ -0,0 +1,14 @@
1static inline struct pthread *__pthread_self()
2{
3 struct pthread *self;
4 __asm__ (
5 "ear %0, %%a0\n"
6 "sllg %0, %0, 32\n"
7 "ear %0, %%a1\n"
8 : "=r"(self));
9 return self;
10}
11
12#define TP_ADJ(p) (p)
13
14#define MC_PC psw.addr
libc/musl/arch/s390x/reloc.h created+15
...@@ -0,0 +1,15 @@
1#include <endian.h>
2
3#define LDSO_ARCH "s390x"
4
5#define REL_SYMBOLIC R_390_64
6#define REL_GOT R_390_GLOB_DAT
7#define REL_PLT R_390_JMP_SLOT
8#define REL_RELATIVE R_390_RELATIVE
9#define REL_COPY R_390_COPY
10#define REL_DTPMOD R_390_TLS_DTPMOD
11#define REL_DTPOFF R_390_TLS_DTPOFF
12#define REL_TPOFF R_390_TLS_TPOFF
13
14#define CRTJMP(pc,sp) __asm__ __volatile__( \
15 "lgr %%r15,%1; br %0" : : "r"(pc), "r"(sp) : "memory" )
libc/musl/arch/s390x/syscall_arch.h created+76
...@@ -0,0 +1,76 @@
1#define __SYSCALL_LL_E(x) (x)
2#define __SYSCALL_LL_O(x) (x)
3
4#define __asm_syscall(ret, ...) do { \
5 __asm__ __volatile__ ("svc 0\n" \
6 : ret : __VA_ARGS__ : "memory"); \
7 return r2; \
8 } while (0)
9
10static inline long __syscall0(long n)
11{
12 register long r1 __asm__("r1") = n;
13 register long r2 __asm__("r2");
14 __asm_syscall("=r"(r2), "r"(r1));
15}
16
17static inline long __syscall1(long n, long a)
18{
19 register long r1 __asm__("r1") = n;
20 register long r2 __asm__("r2") = a;
21 __asm_syscall("+r"(r2), "r"(r1));
22}
23
24static inline long __syscall2(long n, long a, long b)
25{
26 register long r1 __asm__("r1") = n;
27 register long r2 __asm__("r2") = a;
28 register long r3 __asm__("r3") = b;
29 __asm_syscall("+r"(r2), "r"(r1), "r"(r3));
30}
31
32static inline long __syscall3(long n, long a, long b, long c)
33{
34 register long r1 __asm__("r1") = n;
35 register long r2 __asm__("r2") = a;
36 register long r3 __asm__("r3") = b;
37 register long r4 __asm__("r4") = c;
38 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4));
39}
40
41static inline long __syscall4(long n, long a, long b, long c, long d)
42{
43 register long r1 __asm__("r1") = n;
44 register long r2 __asm__("r2") = a;
45 register long r3 __asm__("r3") = b;
46 register long r4 __asm__("r4") = c;
47 register long r5 __asm__("r5") = d;
48 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5));
49}
50
51static inline long __syscall5(long n, long a, long b, long c, long d, long e)
52{
53 register long r1 __asm__("r1") = n;
54 register long r2 __asm__("r2") = a;
55 register long r3 __asm__("r3") = b;
56 register long r4 __asm__("r4") = c;
57 register long r5 __asm__("r5") = d;
58 register long r6 __asm__("r6") = e;
59 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5), "r"(r6));
60}
61
62static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
63{
64 if (n == SYS_mmap) return __syscall1(n, (long)(long[]){a,b,c,d,e,f});
65
66 register long r1 __asm__("r1") = n;
67 register long r2 __asm__("r2") = a;
68 register long r3 __asm__("r3") = b;
69 register long r4 __asm__("r4") = c;
70 register long r5 __asm__("r5") = d;
71 register long r6 __asm__("r6") = e;
72 register long r7 __asm__("r7") = f;
73 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7));
74}
75
76#define SYSCALL_USE_SOCKETCALL
libc/musl/arch/x86_64/atomic_arch.h created+123
...@@ -0,0 +1,123 @@
1#define a_cas a_cas
2static inline int a_cas(volatile int *p, int t, int s)
3{
4 __asm__ __volatile__ (
5 "lock ; cmpxchg %3, %1"
6 : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
7 return t;
8}
9
10#define a_cas_p a_cas_p
11static inline void *a_cas_p(volatile void *p, void *t, void *s)
12{
13 __asm__( "lock ; cmpxchg %3, %1"
14 : "=a"(t), "=m"(*(void *volatile *)p)
15 : "a"(t), "r"(s) : "memory" );
16 return t;
17}
18
19#define a_swap a_swap
20static inline int a_swap(volatile int *p, int v)
21{
22 __asm__ __volatile__(
23 "xchg %0, %1"
24 : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
25 return v;
26}
27
28#define a_fetch_add a_fetch_add
29static inline int a_fetch_add(volatile int *p, int v)
30{
31 __asm__ __volatile__(
32 "lock ; xadd %0, %1"
33 : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
34 return v;
35}
36
37#define a_and a_and
38static inline void a_and(volatile int *p, int v)
39{
40 __asm__ __volatile__(
41 "lock ; and %1, %0"
42 : "=m"(*p) : "r"(v) : "memory" );
43}
44
45#define a_or a_or
46static inline void a_or(volatile int *p, int v)
47{
48 __asm__ __volatile__(
49 "lock ; or %1, %0"
50 : "=m"(*p) : "r"(v) : "memory" );
51}
52
53#define a_and_64 a_and_64
54static inline void a_and_64(volatile uint64_t *p, uint64_t v)
55{
56 __asm__ __volatile(
57 "lock ; and %1, %0"
58 : "=m"(*p) : "r"(v) : "memory" );
59}
60
61#define a_or_64 a_or_64
62static inline void a_or_64(volatile uint64_t *p, uint64_t v)
63{
64 __asm__ __volatile__(
65 "lock ; or %1, %0"
66 : "=m"(*p) : "r"(v) : "memory" );
67}
68
69#define a_inc a_inc
70static inline void a_inc(volatile int *p)
71{
72 __asm__ __volatile__(
73 "lock ; incl %0"
74 : "=m"(*p) : "m"(*p) : "memory" );
75}
76
77#define a_dec a_dec
78static inline void a_dec(volatile int *p)
79{
80 __asm__ __volatile__(
81 "lock ; decl %0"
82 : "=m"(*p) : "m"(*p) : "memory" );
83}
84
85#define a_store a_store
86static inline void a_store(volatile int *p, int x)
87{
88 __asm__ __volatile__(
89 "mov %1, %0 ; lock ; orl $0,(%%rsp)"
90 : "=m"(*p) : "r"(x) : "memory" );
91}
92
93#define a_barrier a_barrier
94static inline void a_barrier()
95{
96 __asm__ __volatile__( "" : : : "memory" );
97}
98
99#define a_spin a_spin
100static inline void a_spin()
101{
102 __asm__ __volatile__( "pause" : : : "memory" );
103}
104
105#define a_crash a_crash
106static inline void a_crash()
107{
108 __asm__ __volatile__( "hlt" : : : "memory" );
109}
110
111#define a_ctz_64 a_ctz_64
112static inline int a_ctz_64(uint64_t x)
113{
114 __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
115 return x;
116}
117
118#define a_clz_64 a_clz_64
119static inline int a_clz_64(uint64_t x)
120{
121 __asm__( "bsr %1,%0 ; xor $63,%0" : "=r"(x) : "r"(x) );
122 return x;
123}
libc/musl/arch/x86_64/bits/alltypes.h.in created+31
...@@ -0,0 +1,31 @@
1#define _Addr long
2#define _Int64 long
3#define _Reg long
4
5TYPEDEF __builtin_va_list va_list;
6TYPEDEF __builtin_va_list __isoc_va_list;
7
8#ifndef __cplusplus
9TYPEDEF int wchar_t;
10#endif
11
12#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
13TYPEDEF long double float_t;
14TYPEDEF long double double_t;
15#else
16TYPEDEF float float_t;
17TYPEDEF double double_t;
18#endif
19
20TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
21
22TYPEDEF long time_t;
23TYPEDEF long suseconds_t;
24
25TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
26TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
27TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
28TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
29TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
30TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
31TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
libc/musl/arch/x86_64/bits/endian.h created+1
...@@ -0,0 +1 @@
1#define __BYTE_ORDER __LITTLE_ENDIAN
libc/musl/arch/x86_64/bits/fcntl.h created+40
...@@ -0,0 +1,40 @@
1#define O_CREAT 0100
2#define O_EXCL 0200
3#define O_NOCTTY 0400
4#define O_TRUNC 01000
5#define O_APPEND 02000
6#define O_NONBLOCK 04000
7#define O_DSYNC 010000
8#define O_SYNC 04010000
9#define O_RSYNC 04010000
10#define O_DIRECTORY 0200000
11#define O_NOFOLLOW 0400000
12#define O_CLOEXEC 02000000
13
14#define O_ASYNC 020000
15#define O_DIRECT 040000
16#define O_LARGEFILE 0
17#define O_NOATIME 01000000
18#define O_PATH 010000000
19#define O_TMPFILE 020200000
20#define O_NDELAY O_NONBLOCK
21
22#define F_DUPFD 0
23#define F_GETFD 1
24#define F_SETFD 2
25#define F_GETFL 3
26#define F_SETFL 4
27
28#define F_SETOWN 8
29#define F_GETOWN 9
30#define F_SETSIG 10
31#define F_GETSIG 11
32
33#define F_GETLK 5
34#define F_SETLK 6
35#define F_SETLKW 7
36
37#define F_SETOWN_EX 15
38#define F_GETOWN_EX 16
39
40#define F_GETOWNER_UIDS 17
libc/musl/arch/x86_64/bits/fenv.h created+34
...@@ -0,0 +1,34 @@
1#define FE_INVALID 1
2#define __FE_DENORM 2
3#define FE_DIVBYZERO 4
4#define FE_OVERFLOW 8
5#define FE_UNDERFLOW 16
6#define FE_INEXACT 32
7
8#define FE_ALL_EXCEPT 63
9
10#define FE_TONEAREST 0
11#define FE_DOWNWARD 0x400
12#define FE_UPWARD 0x800
13#define FE_TOWARDZERO 0xc00
14
15typedef unsigned short fexcept_t;
16
17typedef struct {
18 unsigned short __control_word;
19 unsigned short __unused1;
20 unsigned short __status_word;
21 unsigned short __unused2;
22 unsigned short __tags;
23 unsigned short __unused3;
24 unsigned int __eip;
25 unsigned short __cs_selector;
26 unsigned int __opcode:11;
27 unsigned int __unused4:5;
28 unsigned int __data_offset;
29 unsigned short __data_selector;
30 unsigned short __unused5;
31 unsigned int __mxcsr;
32} fenv_t;
33
34#define FE_DFL_ENV ((const fenv_t *) -1)
libc/musl/arch/x86_64/bits/float.h created+20
...@@ -0,0 +1,20 @@
1#ifdef __FLT_EVAL_METHOD__
2#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
3#else
4#define FLT_EVAL_METHOD 0
5#endif
6
7#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
8#define LDBL_MIN 3.3621031431120935063e-4932L
9#define LDBL_MAX 1.1897314953572317650e+4932L
10#define LDBL_EPSILON 1.0842021724855044340e-19L
11
12#define LDBL_MANT_DIG 64
13#define LDBL_MIN_EXP (-16381)
14#define LDBL_MAX_EXP 16384
15
16#define LDBL_DIG 18
17#define LDBL_MIN_10_EXP (-4931)
18#define LDBL_MAX_10_EXP 4932
19
20#define DECIMAL_DIG 21
libc/musl/arch/x86_64/bits/io.h created+77
...@@ -0,0 +1,77 @@
1static __inline void outb(unsigned char __val, unsigned short __port)
2{
3 __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
4}
5
6static __inline void outw(unsigned short __val, unsigned short __port)
7{
8 __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
9}
10
11static __inline void outl(unsigned int __val, unsigned short __port)
12{
13 __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
14}
15
16static __inline unsigned char inb(unsigned short __port)
17{
18 unsigned char __val;
19 __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
20 return __val;
21}
22
23static __inline unsigned short inw(unsigned short __port)
24{
25 unsigned short __val;
26 __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
27 return __val;
28}
29
30static __inline unsigned int inl(unsigned short __port)
31{
32 unsigned int __val;
33 __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
34 return __val;
35}
36
37static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
38{
39 __asm__ volatile ("cld; rep; outsb"
40 : "+S" (__buf), "+c" (__n)
41 : "d" (__port));
42}
43
44static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
45{
46 __asm__ volatile ("cld; rep; outsw"
47 : "+S" (__buf), "+c" (__n)
48 : "d" (__port));
49}
50
51static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
52{
53 __asm__ volatile ("cld; rep; outsl"
54 : "+S" (__buf), "+c"(__n)
55 : "d" (__port));
56}
57
58static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
59{
60 __asm__ volatile ("cld; rep; insb"
61 : "+D" (__buf), "+c" (__n)
62 : "d" (__port));
63}
64
65static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
66{
67 __asm__ volatile ("cld; rep; insw"
68 : "+D" (__buf), "+c" (__n)
69 : "d" (__port));
70}
71
72static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
73{
74 __asm__ volatile ("cld; rep; insl"
75 : "+D" (__buf), "+c" (__n)
76 : "d" (__port));
77}
libc/musl/arch/x86_64/bits/ipc.h created+13
...@@ -0,0 +1,13 @@
1struct ipc_perm {
2 key_t __ipc_perm_key;
3 uid_t uid;
4 gid_t gid;
5 uid_t cuid;
6 gid_t cgid;
7 mode_t mode;
8 int __ipc_perm_seq;
9 long __pad1;
10 long __pad2;
11};
12
13#define IPC_64 0
libc/musl/arch/x86_64/bits/limits.h created+8
...@@ -0,0 +1,8 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3#define PAGESIZE 4096
4#define LONG_BIT 64
5#endif
6
7#define LONG_MAX 0x7fffffffffffffffL
8#define LLONG_MAX 0x7fffffffffffffffLL
libc/musl/arch/x86_64/bits/mman.h created+1
...@@ -0,0 +1 @@
1#define MAP_32BIT 0x40
libc/musl/arch/x86_64/bits/msg.h created+12
...@@ -0,0 +1,12 @@
1struct msqid_ds {
2 struct ipc_perm msg_perm;
3 time_t msg_stime;
4 time_t msg_rtime;
5 time_t msg_ctime;
6 unsigned long msg_cbytes;
7 msgqnum_t msg_qnum;
8 msglen_t msg_qbytes;
9 pid_t msg_lspid;
10 pid_t msg_lrpid;
11 unsigned long __unused[2];
12};
libc/musl/arch/x86_64/bits/posix.h created+2
...@@ -0,0 +1,2 @@
1#define _POSIX_V6_LP64_OFF64 1
2#define _POSIX_V7_LP64_OFF64 1
libc/musl/arch/x86_64/bits/ptrace.h created+13
...@@ -0,0 +1,13 @@
1#define PTRACE_GET_THREAD_AREA 25
2#define PTRACE_SET_THREAD_AREA 26
3#define PTRACE_ARCH_PRCTL 30
4#define PTRACE_SYSEMU 31
5#define PTRACE_SYSEMU_SINGLESTEP 32
6#define PTRACE_SINGLEBLOCK 33
7
8#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
9#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
10#define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
11#define PT_SYSEMU PTRACE_SYSEMU
12#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
13#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
libc/musl/arch/x86_64/bits/reg.h created+29
...@@ -0,0 +1,29 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
3#define R15 0
4#define R14 1
5#define R13 2
6#define R12 3
7#define RBP 4
8#define RBX 5
9#define R11 6
10#define R10 7
11#define R9 8
12#define R8 9
13#define RAX 10
14#define RCX 11
15#define RDX 12
16#define RSI 13
17#define RDI 14
18#define ORIG_RAX 15
19#define RIP 16
20#define CS 17
21#define EFLAGS 18
22#define RSP 19
23#define SS 20
24#define FS_BASE 21
25#define GS_BASE 22
26#define DS 23
27#define ES 24
28#define FS 25
29#define GS 26
libc/musl/arch/x86_64/bits/setjmp.h created+1
...@@ -0,0 +1 @@
1typedef unsigned long __jmp_buf[8];
libc/musl/arch/x86_64/bits/shm.h created+25
...@@ -0,0 +1,25 @@
1#define SHMLBA 4096
2
3struct shmid_ds {
4 struct ipc_perm shm_perm;
5 size_t shm_segsz;
6 time_t shm_atime;
7 time_t shm_dtime;
8 time_t shm_ctime;
9 pid_t shm_cpid;
10 pid_t shm_lpid;
11 unsigned long shm_nattch;
12 unsigned long __pad1;
13 unsigned long __pad2;
14};
15
16struct shminfo {
17 unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
18};
19
20struct shm_info {
21 int __used_ids;
22 unsigned long shm_tot, shm_rss, shm_swp;
23 unsigned long __swap_attempts, __swap_successes;
24};
25
libc/musl/arch/x86_64/bits/signal.h created+153
...@@ -0,0 +1,153 @@
1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5#define MINSIGSTKSZ 2048
6#define SIGSTKSZ 8192
7#endif
8
9#ifdef _GNU_SOURCE
10enum { REG_R8 = 0 };
11#define REG_R8 REG_R8
12enum { REG_R9 = 1 };
13#define REG_R9 REG_R9
14enum { REG_R10 = 2 };
15#define REG_R10 REG_R10
16enum { REG_R11 = 3 };
17#define REG_R11 REG_R11
18enum { REG_R12 = 4 };
19#define REG_R12 REG_R12
20enum { REG_R13 = 5 };
21#define REG_R13 REG_R13
22enum { REG_R14 = 6 };
23#define REG_R14 REG_R14
24enum { REG_R15 = 7 };
25#define REG_R15 REG_R15
26enum { REG_RDI = 8 };
27#define REG_RDI REG_RDI
28enum { REG_RSI = 9 };
29#define REG_RSI REG_RSI
30enum { REG_RBP = 10 };
31#define REG_RBP REG_RBP
32enum { REG_RBX = 11 };
33#define REG_RBX REG_RBX
34enum { REG_RDX = 12 };
35#define REG_RDX REG_RDX
36enum { REG_RAX = 13 };
37#define REG_RAX REG_RAX
38enum { REG_RCX = 14 };
39#define REG_RCX REG_RCX
40enum { REG_RSP = 15 };
41#define REG_RSP REG_RSP
42enum { REG_RIP = 16 };
43#define REG_RIP REG_RIP
44enum { REG_EFL = 17 };
45#define REG_EFL REG_EFL
46enum { REG_CSGSFS = 18 };
47#define REG_CSGSFS REG_CSGSFS
48enum { REG_ERR = 19 };
49#define REG_ERR REG_ERR
50enum { REG_TRAPNO = 20 };
51#define REG_TRAPNO REG_TRAPNO
52enum { REG_OLDMASK = 21 };
53#define REG_OLDMASK REG_OLDMASK
54enum { REG_CR2 = 22 };
55#define REG_CR2 REG_CR2
56#endif
57
58#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
59typedef long long greg_t, gregset_t[23];
60typedef struct _fpstate {
61 unsigned short cwd, swd, ftw, fop;
62 unsigned long long rip, rdp;
63 unsigned mxcsr, mxcr_mask;
64 struct {
65 unsigned short significand[4], exponent, padding[3];
66 } _st[8];
67 struct {
68 unsigned element[4];
69 } _xmm[16];
70 unsigned padding[24];
71} *fpregset_t;
72struct sigcontext {
73 unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
74 unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
75 unsigned short cs, gs, fs, __pad0;
76 unsigned long err, trapno, oldmask, cr2;
77 struct _fpstate *fpstate;
78 unsigned long __reserved1[8];
79};
80typedef struct {
81 gregset_t gregs;
82 fpregset_t fpregs;
83 unsigned long long __reserved1[8];
84} mcontext_t;
85#else
86typedef struct {
87 unsigned long __space[32];
88} mcontext_t;
89#endif
90
91struct sigaltstack {
92 void *ss_sp;
93 int ss_flags;
94 size_t ss_size;
95};
96
97typedef struct __ucontext {
98 unsigned long uc_flags;
99 struct __ucontext *uc_link;
100 stack_t uc_stack;
101 mcontext_t uc_mcontext;
102 sigset_t uc_sigmask;
103 unsigned long __fpregs_mem[64];
104} ucontext_t;
105
106#define SA_NOCLDSTOP 1
107#define SA_NOCLDWAIT 2
108#define SA_SIGINFO 4
109#define SA_ONSTACK 0x08000000
110#define SA_RESTART 0x10000000
111#define SA_NODEFER 0x40000000
112#define SA_RESETHAND 0x80000000
113#define SA_RESTORER 0x04000000
114
115#endif
116
117#define SIGHUP 1
118#define SIGINT 2
119#define SIGQUIT 3
120#define SIGILL 4
121#define SIGTRAP 5
122#define SIGABRT 6
123#define SIGIOT SIGABRT
124#define SIGBUS 7
125#define SIGFPE 8
126#define SIGKILL 9
127#define SIGUSR1 10
128#define SIGSEGV 11
129#define SIGUSR2 12
130#define SIGPIPE 13
131#define SIGALRM 14
132#define SIGTERM 15
133#define SIGSTKFLT 16
134#define SIGCHLD 17
135#define SIGCONT 18
136#define SIGSTOP 19
137#define SIGTSTP 20
138#define SIGTTIN 21
139#define SIGTTOU 22
140#define SIGURG 23
141#define SIGXCPU 24
142#define SIGXFSZ 25
143#define SIGVTALRM 26
144#define SIGPROF 27
145#define SIGWINCH 28
146#define SIGIO 29
147#define SIGPOLL 29
148#define SIGPWR 30
149#define SIGSYS 31
150#define SIGUNUSED SIGSYS
151
152#define _NSIG 65
153
libc/musl/arch/x86_64/bits/socket.h created+16
...@@ -0,0 +1,16 @@
1struct msghdr {
2 void *msg_name;
3 socklen_t msg_namelen;
4 struct iovec *msg_iov;
5 int msg_iovlen, __pad1;
6 void *msg_control;
7 socklen_t msg_controllen, __pad2;
8 int msg_flags;
9};
10
11struct cmsghdr {
12 socklen_t cmsg_len;
13 int __pad1;
14 int cmsg_level;
15 int cmsg_type;
16};
libc/musl/arch/x86_64/bits/stat.h created+22
...@@ -0,0 +1,22 @@
1/* copied from kernel definition, but with padding replaced
2 * by the corresponding correctly-sized userspace types. */
3
4struct stat {
5 dev_t st_dev;
6 ino_t st_ino;
7 nlink_t st_nlink;
8
9 mode_t st_mode;
10 uid_t st_uid;
11 gid_t st_gid;
12 unsigned int __pad0;
13 dev_t st_rdev;
14 off_t st_size;
15 blksize_t st_blksize;
16 blkcnt_t st_blocks;
17
18 struct timespec st_atim;
19 struct timespec st_mtim;
20 struct timespec st_ctim;
21 long __unused[3];
22};
libc/musl/arch/x86_64/bits/stdint.h created+20
...@@ -0,0 +1,20 @@
1typedef int32_t int_fast16_t;
2typedef int32_t int_fast32_t;
3typedef uint32_t uint_fast16_t;
4typedef uint32_t uint_fast32_t;
5
6#define INT_FAST16_MIN INT32_MIN
7#define INT_FAST32_MIN INT32_MIN
8
9#define INT_FAST16_MAX INT32_MAX
10#define INT_FAST32_MAX INT32_MAX
11
12#define UINT_FAST16_MAX UINT32_MAX
13#define UINT_FAST32_MAX UINT32_MAX
14
15#define INTPTR_MIN INT64_MIN
16#define INTPTR_MAX INT64_MAX
17#define UINTPTR_MAX UINT64_MAX
18#define PTRDIFF_MIN INT64_MIN
19#define PTRDIFF_MAX INT64_MAX
20#define SIZE_MAX UINT64_MAX
libc/musl/arch/x86_64/bits/syscall.h.in created+336
...@@ -0,0 +1,336 @@
1#define __NR_read 0
2#define __NR_write 1
3#define __NR_open 2
4#define __NR_close 3
5#define __NR_stat 4
6#define __NR_fstat 5
7#define __NR_lstat 6
8#define __NR_poll 7
9#define __NR_lseek 8
10#define __NR_mmap 9
11#define __NR_mprotect 10
12#define __NR_munmap 11
13#define __NR_brk 12
14#define __NR_rt_sigaction 13
15#define __NR_rt_sigprocmask 14
16#define __NR_rt_sigreturn 15
17#define __NR_ioctl 16
18#define __NR_pread64 17
19#define __NR_pwrite64 18
20#define __NR_readv 19
21#define __NR_writev 20
22#define __NR_access 21
23#define __NR_pipe 22
24#define __NR_select 23
25#define __NR_sched_yield 24
26#define __NR_mremap 25
27#define __NR_msync 26
28#define __NR_mincore 27
29#define __NR_madvise 28
30#define __NR_shmget 29
31#define __NR_shmat 30
32#define __NR_shmctl 31
33#define __NR_dup 32
34#define __NR_dup2 33
35#define __NR_pause 34
36#define __NR_nanosleep 35
37#define __NR_getitimer 36
38#define __NR_alarm 37
39#define __NR_setitimer 38
40#define __NR_getpid 39
41#define __NR_sendfile 40
42#define __NR_socket 41
43#define __NR_connect 42
44#define __NR_accept 43
45#define __NR_sendto 44
46#define __NR_recvfrom 45
47#define __NR_sendmsg 46
48#define __NR_recvmsg 47
49#define __NR_shutdown 48
50#define __NR_bind 49
51#define __NR_listen 50
52#define __NR_getsockname 51
53#define __NR_getpeername 52
54#define __NR_socketpair 53
55#define __NR_setsockopt 54
56#define __NR_getsockopt 55
57#define __NR_clone 56
58#define __NR_fork 57
59#define __NR_vfork 58
60#define __NR_execve 59
61#define __NR_exit 60
62#define __NR_wait4 61
63#define __NR_kill 62
64#define __NR_uname 63
65#define __NR_semget 64
66#define __NR_semop 65
67#define __NR_semctl 66
68#define __NR_shmdt 67
69#define __NR_msgget 68
70#define __NR_msgsnd 69
71#define __NR_msgrcv 70
72#define __NR_msgctl 71
73#define __NR_fcntl 72
74#define __NR_flock 73
75#define __NR_fsync 74
76#define __NR_fdatasync 75
77#define __NR_truncate 76
78#define __NR_ftruncate 77
79#define __NR_getdents 78
80#define __NR_getcwd 79
81#define __NR_chdir 80
82#define __NR_fchdir 81
83#define __NR_rename 82
84#define __NR_mkdir 83
85#define __NR_rmdir 84
86#define __NR_creat 85
87#define __NR_link 86
88#define __NR_unlink 87
89#define __NR_symlink 88
90#define __NR_readlink 89
91#define __NR_chmod 90
92#define __NR_fchmod 91
93#define __NR_chown 92
94#define __NR_fchown 93
95#define __NR_lchown 94
96#define __NR_umask 95
97#define __NR_gettimeofday 96
98#define __NR_getrlimit 97
99#define __NR_getrusage 98
100#define __NR_sysinfo 99
101#define __NR_times 100
102#define __NR_ptrace 101
103#define __NR_getuid 102
104#define __NR_syslog 103
105#define __NR_getgid 104
106#define __NR_setuid 105
107#define __NR_setgid 106
108#define __NR_geteuid 107
109#define __NR_getegid 108
110#define __NR_setpgid 109
111#define __NR_getppid 110
112#define __NR_getpgrp 111
113#define __NR_setsid 112
114#define __NR_setreuid 113
115#define __NR_setregid 114
116#define __NR_getgroups 115
117#define __NR_setgroups 116
118#define __NR_setresuid 117
119#define __NR_getresuid 118
120#define __NR_setresgid 119
121#define __NR_getresgid 120
122#define __NR_getpgid 121
123#define __NR_setfsuid 122
124#define __NR_setfsgid 123
125#define __NR_getsid 124
126#define __NR_capget 125
127#define __NR_capset 126
128#define __NR_rt_sigpending 127
129#define __NR_rt_sigtimedwait 128
130#define __NR_rt_sigqueueinfo 129
131#define __NR_rt_sigsuspend 130
132#define __NR_sigaltstack 131
133#define __NR_utime 132
134#define __NR_mknod 133
135#define __NR_uselib 134
136#define __NR_personality 135
137#define __NR_ustat 136
138#define __NR_statfs 137
139#define __NR_fstatfs 138
140#define __NR_sysfs 139
141#define __NR_getpriority 140
142#define __NR_setpriority 141
143#define __NR_sched_setparam 142
144#define __NR_sched_getparam 143
145#define __NR_sched_setscheduler 144
146#define __NR_sched_getscheduler 145
147#define __NR_sched_get_priority_max 146
148#define __NR_sched_get_priority_min 147
149#define __NR_sched_rr_get_interval 148
150#define __NR_mlock 149
151#define __NR_munlock 150
152#define __NR_mlockall 151
153#define __NR_munlockall 152
154#define __NR_vhangup 153
155#define __NR_modify_ldt 154
156#define __NR_pivot_root 155
157#define __NR__sysctl 156
158#define __NR_prctl 157
159#define __NR_arch_prctl 158
160#define __NR_adjtimex 159
161#define __NR_setrlimit 160
162#define __NR_chroot 161
163#define __NR_sync 162
164#define __NR_acct 163
165#define __NR_settimeofday 164
166#define __NR_mount 165
167#define __NR_umount2 166
168#define __NR_swapon 167
169#define __NR_swapoff 168
170#define __NR_reboot 169
171#define __NR_sethostname 170
172#define __NR_setdomainname 171
173#define __NR_iopl 172
174#define __NR_ioperm 173
175#define __NR_create_module 174
176#define __NR_init_module 175
177#define __NR_delete_module 176
178#define __NR_get_kernel_syms 177
179#define __NR_query_module 178
180#define __NR_quotactl 179
181#define __NR_nfsservctl 180
182#define __NR_getpmsg 181
183#define __NR_putpmsg 182
184#define __NR_afs_syscall 183
185#define __NR_tuxcall 184
186#define __NR_security 185
187#define __NR_gettid 186
188#define __NR_readahead 187
189#define __NR_setxattr 188
190#define __NR_lsetxattr 189
191#define __NR_fsetxattr 190
192#define __NR_getxattr 191
193#define __NR_lgetxattr 192
194#define __NR_fgetxattr 193
195#define __NR_listxattr 194
196#define __NR_llistxattr 195
197#define __NR_flistxattr 196
198#define __NR_removexattr 197
199#define __NR_lremovexattr 198
200#define __NR_fremovexattr 199
201#define __NR_tkill 200
202#define __NR_time 201
203#define __NR_futex 202
204#define __NR_sched_setaffinity 203
205#define __NR_sched_getaffinity 204
206#define __NR_set_thread_area 205
207#define __NR_io_setup 206
208#define __NR_io_destroy 207
209#define __NR_io_getevents 208
210#define __NR_io_submit 209
211#define __NR_io_cancel 210
212#define __NR_get_thread_area 211
213#define __NR_lookup_dcookie 212
214#define __NR_epoll_create 213
215#define __NR_epoll_ctl_old 214
216#define __NR_epoll_wait_old 215
217#define __NR_remap_file_pages 216
218#define __NR_getdents64 217
219#define __NR_set_tid_address 218
220#define __NR_restart_syscall 219
221#define __NR_semtimedop 220
222#define __NR_fadvise64 221
223#define __NR_timer_create 222
224#define __NR_timer_settime 223
225#define __NR_timer_gettime 224
226#define __NR_timer_getoverrun 225
227#define __NR_timer_delete 226
228#define __NR_clock_settime 227
229#define __NR_clock_gettime 228
230#define __NR_clock_getres 229
231#define __NR_clock_nanosleep 230
232#define __NR_exit_group 231
233#define __NR_epoll_wait 232
234#define __NR_epoll_ctl 233
235#define __NR_tgkill 234
236#define __NR_utimes 235
237#define __NR_vserver 236
238#define __NR_mbind 237
239#define __NR_set_mempolicy 238
240#define __NR_get_mempolicy 239
241#define __NR_mq_open 240
242#define __NR_mq_unlink 241
243#define __NR_mq_timedsend 242
244#define __NR_mq_timedreceive 243
245#define __NR_mq_notify 244
246#define __NR_mq_getsetattr 245
247#define __NR_kexec_load 246
248#define __NR_waitid 247
249#define __NR_add_key 248
250#define __NR_request_key 249
251#define __NR_keyctl 250
252#define __NR_ioprio_set 251
253#define __NR_ioprio_get 252
254#define __NR_inotify_init 253
255#define __NR_inotify_add_watch 254
256#define __NR_inotify_rm_watch 255
257#define __NR_migrate_pages 256
258#define __NR_openat 257
259#define __NR_mkdirat 258
260#define __NR_mknodat 259
261#define __NR_fchownat 260
262#define __NR_futimesat 261
263#define __NR_newfstatat 262
264#define __NR_unlinkat 263
265#define __NR_renameat 264
266#define __NR_linkat 265
267#define __NR_symlinkat 266
268#define __NR_readlinkat 267
269#define __NR_fchmodat 268
270#define __NR_faccessat 269
271#define __NR_pselect6 270
272#define __NR_ppoll 271
273#define __NR_unshare 272
274#define __NR_set_robust_list 273
275#define __NR_get_robust_list 274
276#define __NR_splice 275
277#define __NR_tee 276
278#define __NR_sync_file_range 277
279#define __NR_vmsplice 278
280#define __NR_move_pages 279
281#define __NR_utimensat 280
282#define __NR_epoll_pwait 281
283#define __NR_signalfd 282
284#define __NR_timerfd_create 283
285#define __NR_eventfd 284
286#define __NR_fallocate 285
287#define __NR_timerfd_settime 286
288#define __NR_timerfd_gettime 287
289#define __NR_accept4 288
290#define __NR_signalfd4 289
291#define __NR_eventfd2 290
292#define __NR_epoll_create1 291
293#define __NR_dup3 292
294#define __NR_pipe2 293
295#define __NR_inotify_init1 294
296#define __NR_preadv 295
297#define __NR_pwritev 296
298#define __NR_rt_tgsigqueueinfo 297
299#define __NR_perf_event_open 298
300#define __NR_recvmmsg 299
301#define __NR_fanotify_init 300
302#define __NR_fanotify_mark 301
303#define __NR_prlimit64 302
304#define __NR_name_to_handle_at 303
305#define __NR_open_by_handle_at 304
306#define __NR_clock_adjtime 305
307#define __NR_syncfs 306
308#define __NR_sendmmsg 307
309#define __NR_setns 308
310#define __NR_getcpu 309
311#define __NR_process_vm_readv 310
312#define __NR_process_vm_writev 311
313#define __NR_kcmp 312
314#define __NR_finit_module 313
315#define __NR_sched_setattr 314
316#define __NR_sched_getattr 315
317#define __NR_renameat2 316
318#define __NR_seccomp 317
319#define __NR_getrandom 318
320#define __NR_memfd_create 319
321#define __NR_kexec_file_load 320
322#define __NR_bpf 321
323#define __NR_execveat 322
324#define __NR_userfaultfd 323
325#define __NR_membarrier 324
326#define __NR_mlock2 325
327#define __NR_copy_file_range 326
328#define __NR_preadv2 327
329#define __NR_pwritev2 328
330#define __NR_pkey_mprotect 329
331#define __NR_pkey_alloc 330
332#define __NR_pkey_free 331
333#define __NR_statx 332
334#define __NR_io_pgetevents 333
335#define __NR_rseq 334
336
libc/musl/arch/x86_64/bits/user.h created+41
...@@ -0,0 +1,41 @@
1#undef __WORDSIZE
2#define __WORDSIZE 64
3
4typedef struct user_fpregs_struct {
5 uint16_t cwd, swd, ftw, fop;
6 uint64_t rip, rdp;
7 uint32_t mxcsr, mxcr_mask;
8 uint32_t st_space[32], xmm_space[64], padding[24];
9} elf_fpregset_t;
10
11struct user_regs_struct {
12 unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
13 unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
14 unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
15};
16#define ELF_NGREG 27
17typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
18
19struct user {
20 struct user_regs_struct regs;
21 int u_fpvalid;
22 struct user_fpregs_struct i387;
23 unsigned long u_tsize;
24 unsigned long u_dsize;
25 unsigned long u_ssize;
26 unsigned long start_code;
27 unsigned long start_stack;
28 long signal;
29 int reserved;
30 struct user_regs_struct *u_ar0;
31 struct user_fpregs_struct *u_fpstate;
32 unsigned long magic;
33 char u_comm[32];
34 unsigned long u_debugreg[8];
35};
36
37#define PAGE_MASK (~(PAGESIZE-1))
38#define NBPG PAGESIZE
39#define UPAGES 1
40#define HOST_TEXT_START_ADDR (u.start_code)
41#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
libc/musl/arch/x86_64/crt_arch.h created+12
...@@ -0,0 +1,12 @@
1__asm__(
2".text \n"
3".global " START " \n"
4START ": \n"
5" xor %rbp,%rbp \n"
6" mov %rsp,%rdi \n"
7".weak _DYNAMIC \n"
8".hidden _DYNAMIC \n"
9" lea _DYNAMIC(%rip),%rsi \n"
10" andq $-16,%rsp \n"
11" call " START "_c \n"
12);
libc/musl/arch/x86_64/ksigaction.h created+11
...@@ -0,0 +1,11 @@
1#include <features.h>
2
3struct k_sigaction {
4 void (*handler)(int);
5 unsigned long flags;
6 void (*restorer)(void);
7 unsigned mask[2];
8};
9
10hidden void __restore_rt();
11#define __restore __restore_rt
libc/musl/arch/x86_64/pthread_arch.h created+10
...@@ -0,0 +1,10 @@
1static inline struct pthread *__pthread_self()
2{
3 struct pthread *self;
4 __asm__ ("mov %%fs:0,%0" : "=r" (self) );
5 return self;
6}
7
8#define TP_ADJ(p) (p)
9
10#define MC_PC gregs[REG_RIP]
libc/musl/arch/x86_64/reloc.h created+20
...@@ -0,0 +1,20 @@
1#define LDSO_ARCH "x86_64"
2
3#define REL_SYMBOLIC R_X86_64_64
4#define REL_OFFSET32 R_X86_64_PC32
5#define REL_GOT R_X86_64_GLOB_DAT
6#define REL_PLT R_X86_64_JUMP_SLOT
7#define REL_RELATIVE R_X86_64_RELATIVE
8#define REL_COPY R_X86_64_COPY
9#define REL_DTPMOD R_X86_64_DTPMOD64
10#define REL_DTPOFF R_X86_64_DTPOFF64
11#define REL_TPOFF R_X86_64_TPOFF64
12#define REL_TLSDESC R_X86_64_TLSDESC
13
14#define CRTJMP(pc,sp) __asm__ __volatile__( \
15 "mov %1,%%rsp ; jmp *%0" : : "r"(pc), "r"(sp) : "memory" )
16
17#define GETFUNCSYM(fp, sym, got) __asm__ ( \
18 ".hidden " #sym "\n" \
19 " lea " #sym "(%%rip),%0\n" \
20 : "=r"(*fp) : : "memory" )
libc/musl/arch/x86_64/syscall_arch.h created+68
...@@ -0,0 +1,68 @@
1#define __SYSCALL_LL_E(x) (x)
2#define __SYSCALL_LL_O(x) (x)
3
4static __inline long __syscall0(long n)
5{
6 unsigned long ret;
7 __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", "memory");
8 return ret;
9}
10
11static __inline long __syscall1(long n, long a1)
12{
13 unsigned long ret;
14 __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory");
15 return ret;
16}
17
18static __inline long __syscall2(long n, long a1, long a2)
19{
20 unsigned long ret;
21 __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
22 : "rcx", "r11", "memory");
23 return ret;
24}
25
26static __inline long __syscall3(long n, long a1, long a2, long a3)
27{
28 unsigned long ret;
29 __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
30 "d"(a3) : "rcx", "r11", "memory");
31 return ret;
32}
33
34static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
35{
36 unsigned long ret;
37 register long r10 __asm__("r10") = a4;
38 __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
39 "d"(a3), "r"(r10): "rcx", "r11", "memory");
40 return ret;
41}
42
43static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
44{
45 unsigned long ret;
46 register long r10 __asm__("r10") = a4;
47 register long r8 __asm__("r8") = a5;
48 __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
49 "d"(a3), "r"(r10), "r"(r8) : "rcx", "r11", "memory");
50 return ret;
51}
52
53static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
54{
55 unsigned long ret;
56 register long r10 __asm__("r10") = a4;
57 register long r8 __asm__("r8") = a5;
58 register long r9 __asm__("r9") = a6;
59 __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
60 "d"(a3), "r"(r10), "r"(r8), "r"(r9) : "rcx", "r11", "memory");
61 return ret;
62}
63
64#define VDSO_USEFUL
65#define VDSO_CGT_SYM "__vdso_clock_gettime"
66#define VDSO_CGT_VER "LINUX_2.6"
67#define VDSO_GETCPU_SYM "__vdso_getcpu"
68#define VDSO_GETCPU_VER "LINUX_2.6"
libc/musl/crt/Scrt1.c created+1
...@@ -0,0 +1 @@
1#include "crt1.c"
libc/musl/crt/aarch64/crti.s created+13
...@@ -0,0 +1,13 @@
1.section .init
2.global _init
3.type _init,%function
4_init:
5 stp x29,x30,[sp,-16]!
6 mov x29,sp
7
8.section .fini
9.global _fini
10.type _fini,%function
11_fini:
12 stp x29,x30,[sp,-16]!
13 mov x29,sp
libc/musl/crt/aarch64/crtn.s created+7
...@@ -0,0 +1,7 @@
1.section .init
2 ldp x29,x30,[sp],#16
3 ret
4
5.section .fini
6 ldp x29,x30,[sp],#16
7 ret
libc/musl/crt/arm/crti.s created+13
...@@ -0,0 +1,13 @@
1.syntax unified
2
3.section .init
4.global _init
5.type _init,%function
6_init:
7 push {r0,lr}
8
9.section .fini
10.global _fini
11.type _fini,%function
12_fini:
13 push {r0,lr}
libc/musl/crt/arm/crtn.s created+9
...@@ -0,0 +1,9 @@
1.syntax unified
2
3.section .init
4 pop {r0,lr}
5 bx lr
6
7.section .fini
8 pop {r0,lr}
9 bx lr
libc/musl/crt/crt1.c created+19
...@@ -0,0 +1,19 @@
1#include <features.h>
2#include "libc.h"
3
4#define START "_start"
5
6#include "crt_arch.h"
7
8int main();
9weak void _init();
10weak void _fini();
11_Noreturn int __libc_start_main(int (*)(), int, char **,
12 void (*)(), void(*)(), void(*)());
13
14void _start_c(long *p)
15{
16 int argc = p[0];
17 char **argv = (void *)(p+1);
18 __libc_start_main(main, argc, argv, _init, _fini, 0);
19}
libc/musl/crt/crti.c created
libc/musl/crt/crtn.c created
libc/musl/crt/i386/crti.s created+9
...@@ -0,0 +1,9 @@
1.section .init
2.global _init
3_init:
4 sub $12,%esp
5
6.section .fini
7.global _fini
8_fini:
9 sub $12,%esp
libc/musl/crt/i386/crtn.s created+7
...@@ -0,0 +1,7 @@
1.section .init
2 add $12,%esp
3 ret
4
5.section .fini
6 add $12,%esp
7 ret
libc/musl/crt/microblaze/crti.s created+13
...@@ -0,0 +1,13 @@
1.section .init
2.global _init
3.align 2
4_init:
5 addi r1, r1, -32
6 swi r15, r1, 0
7
8.section .fini
9.global _fini
10.align 2
11_fini:
12 addi r1, r1, -32
13 swi r15, r1, 0
libc/musl/crt/microblaze/crtn.s created+9
...@@ -0,0 +1,9 @@
1.section .init
2 lwi r15, r1, 0
3 rtsd r15, 8
4 addi r1, r1, 32
5
6.section .fini
7 lwi r15, r1, 0
8 rtsd r15, 8
9 addi r1, r1, 32
libc/musl/crt/mips/crti.s created+19
...@@ -0,0 +1,19 @@
1.set noreorder
2
3.section .init
4.global _init
5.type _init,@function
6.align 2
7_init:
8 subu $sp,$sp,32
9 sw $gp,24($sp)
10 sw $ra,28($sp)
11
12.section .fini
13.global _fini
14.type _fini,@function
15.align 2
16_fini:
17 subu $sp,$sp,32
18 sw $gp,24($sp)
19 sw $ra,28($sp)
libc/musl/crt/mips/crtn.s created+13
...@@ -0,0 +1,13 @@
1.set noreorder
2
3.section .init
4 lw $gp,24($sp)
5 lw $ra,28($sp)
6 j $ra
7 addu $sp,$sp,32
8
9.section .fini
10 lw $gp,24($sp)
11 lw $ra,28($sp)
12 j $ra
13 addu $sp,$sp,32
libc/musl/crt/mips64/crti.s created+17
...@@ -0,0 +1,17 @@
1.set noreorder
2
3.section .init
4.global _init
5.align 3
6_init:
7 dsubu $sp, $sp, 32
8 sd $gp, 16($sp)
9 sd $ra, 24($sp)
10
11.section .fini
12.global _fini
13.align 3
14_fini:
15 dsubu $sp, $sp, 32
16 sd $gp, 16($sp)
17 sd $ra, 24($sp)
libc/musl/crt/mips64/crtn.s created+13
...@@ -0,0 +1,13 @@
1.set noreorder
2
3.section .init
4 ld $gp,16($sp)
5 ld $ra,24($sp)
6 j $ra
7 daddu $sp,$sp,32
8
9.section .fini
10 ld $gp,16($sp)
11 ld $ra,24($sp)
12 j $ra
13 daddu $sp,$sp,32
libc/musl/crt/mipsn32/crti.s created+18
...@@ -0,0 +1,18 @@
1.set noreorder
2.section .init
3.global _init
4.type _init,@function
5.align 2
6_init:
7 subu $sp, $sp, 32
8 sd $gp, 16($sp)
9 sd $ra, 24($sp)
10
11.section .fini
12.global _fini
13.type _fini,@function
14.align 2
15_fini:
16 subu $sp, $sp, 32
17 sd $gp, 16($sp)
18 sd $ra, 24($sp)
libc/musl/crt/mipsn32/crtn.s created+12
...@@ -0,0 +1,12 @@
1.set noreorder
2.section .init
3 ld $gp, 16($sp)
4 ld $ra, 24($sp)
5 j $ra
6 addu $sp, $sp, 32
7
8.section .fini
9 ld $gp, 16($sp)
10 ld $ra, 24($sp)
11 j $ra
12 addu $sp, $sp, 32
libc/musl/crt/or1k/crti.s created+11
...@@ -0,0 +1,11 @@
1.section .init
2.global _init
3_init:
4 l.addi r1,r1,-4
5 l.sw 0(r1),r9
6
7.section .fini
8.global _fini
9_fini:
10 l.addi r1,r1,-4
11 l.sw 0(r1),r9
libc/musl/crt/or1k/crtn.s created+9
...@@ -0,0 +1,9 @@
1.section .init
2 l.lwz r9,0(r1)
3 l.jr r9
4 l.addi r1,r1,4
5
6.section .fini
7 l.lwz r9,0(r1)
8 l.jr r9
9 l.addi r1,r1,4
libc/musl/crt/powerpc/crti.s created+15
...@@ -0,0 +1,15 @@
1.section .init
2.align 2
3.global _init
4_init:
5 stwu 1,-32(1)
6 mflr 0
7 stw 0,36(1)
8
9.section .fini
10.align 2
11.global _fini
12_fini:
13 stwu 1,-32(1)
14 mflr 0
15 stw 0,36(1)
libc/musl/crt/powerpc/crtn.s created+13
...@@ -0,0 +1,13 @@
1.section .init
2.align 2
3 lwz 0,36(1)
4 addi 1,1,32
5 mtlr 0
6 blr
7
8.section .fini
9.align 2
10 lwz 0,36(1)
11 addi 1,1,32
12 mtlr 0
13 blr
libc/musl/crt/powerpc64/crti.s created+21
...@@ -0,0 +1,21 @@
1.section .init
2.align 2
3.global _init
4_init:
5 addis 2, 12, .TOC.-_init@ha
6 addi 2, 2, .TOC.-_init@l
7 .localentry _init,.-_init
8 mflr 0
9 std 0, 16(1)
10 stdu 1,-32(1)
11
12.section .fini
13.align 2
14.global _fini
15_fini:
16 addis 2, 12, .TOC.-_fini@ha
17 addi 2, 2, .TOC.-_fini@l
18 .localentry _fini,.-_fini
19 mflr 0
20 std 0, 16(1)
21 stdu 1,-32(1)
libc/musl/crt/powerpc64/crtn.s created+13
...@@ -0,0 +1,13 @@
1.section .init
2.align 2
3 addi 1, 1, 32
4 ld 0, 16(1)
5 mtlr 0
6 blr
7
8.section .fini
9.align 2
10 addi 1, 1, 32
11 ld 0, 16(1)
12 mtlr 0
13 blr
libc/musl/crt/rcrt1.c created+14
...@@ -0,0 +1,14 @@
1#define START "_start"
2#define _dlstart_c _start_c
3#include "../ldso/dlstart.c"
4
5int main();
6weak void _init();
7weak void _fini();
8_Noreturn int __libc_start_main(int (*)(), int, char **,
9 void (*)(), void(*)(), void(*)());
10
11hidden _Noreturn void __dls2(unsigned char *base, size_t *sp)
12{
13 __libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0);
14}
libc/musl/crt/s390x/crti.s created+17
...@@ -0,0 +1,17 @@
1.section .init
2.align 2
3.global _init
4_init:
5 stmg %r14, %r15, 112(%r15)
6 lgr %r0, %r15
7 aghi %r15, -160
8 stg %r0, 0(%r15)
9
10.section .fini
11.align 2
12.global _fini
13_fini:
14 stmg %r14, %r15, 112(%r15)
15 lgr %r0, %r15
16 aghi %r15, -160
17 stg %r0, 0(%r15)
libc/musl/crt/s390x/crtn.s created+9
...@@ -0,0 +1,9 @@
1.section .init
2.align 2
3 lmg %r14, %r15, 272(%r15)
4 br %r14
5
6.section .fini
7.align 2
8 lmg %r14, %r15, 272(%r15)
9 br %r14
libc/musl/crt/sh/crti.s created+21
...@@ -0,0 +1,21 @@
1.section .init
2.global _init
3.type _init, @function
4_init:
5 add #-4, r15
6 mov.l r12, @-r15
7 mov.l r14, @-r15
8 sts.l pr, @-r15
9 mov r15, r14
10 nop
11
12.section .fini
13.global _fini
14.type _fini, @function
15_fini:
16 add #-4, r15
17 mov.l r12, @-r15
18 mov.l r14, @-r15
19 sts.l pr, @-r15
20 mov r15, r14
21 nop
libc/musl/crt/sh/crtn.s created+13
...@@ -0,0 +1,13 @@
1.section .init
2 lds.l @r15+, pr
3 mov.l @r15+, r14
4 mov.l @r15+, r12
5 rts
6 add #4, r15
7
8.section .fini
9 lds.l @r15+, pr
10 mov.l @r15+, r14
11 mov.l @r15+, r12
12 rts
13 add #4, r15
libc/musl/crt/x32/crti.s created+9
...@@ -0,0 +1,9 @@
1.section .init
2.global _init
3_init:
4 push %rax
5
6.section .fini
7.global _fini
8_fini:
9 push %rax
libc/musl/crt/x32/crtn.s created+7
...@@ -0,0 +1,7 @@
1.section .init
2 pop %rax
3 ret
4
5.section .fini
6 pop %rax
7 ret
libc/musl/crt/x86_64/crti.s created+9
...@@ -0,0 +1,9 @@
1.section .init
2.global _init
3_init:
4 push %rax
5
6.section .fini
7.global _fini
8_fini:
9 push %rax
libc/musl/crt/x86_64/crtn.s created+7
...@@ -0,0 +1,7 @@
1.section .init
2 pop %rax
3 ret
4
5.section .fini
6 pop %rax
7 ret
libc/musl/src/include/features.h created+11
...@@ -0,0 +1,11 @@
1#ifndef FEATURES_H
2#define FEATURES_H
3
4#include_next "features.h"
5
6#define weak __attribute__((__weak__))
7#define hidden __attribute__((__visibility__("hidden")))
8#define weak_alias(old, new) \
9 extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
10
11#endif
libc/musl/src/internal/libc.h created+57
...@@ -0,0 +1,57 @@
1#ifndef LIBC_H
2#define LIBC_H
3
4#include <stdlib.h>
5#include <stdio.h>
6#include <limits.h>
7
8struct __locale_map;
9
10struct __locale_struct {
11 const struct __locale_map *cat[6];
12};
13
14struct tls_module {
15 struct tls_module *next;
16 void *image;
17 size_t len, size, align, offset;
18};
19
20struct __libc {
21 int can_do_threads;
22 int threaded;
23 int secure;
24 volatile int threads_minus_1;
25 size_t *auxv;
26 struct tls_module *tls_head;
27 size_t tls_size, tls_align, tls_cnt;
28 size_t page_size;
29 struct __locale_struct global_locale;
30};
31
32#ifndef PAGE_SIZE
33#define PAGE_SIZE libc.page_size
34#endif
35
36extern hidden struct __libc __libc;
37#define libc __libc
38
39hidden void __init_libc(char **, char *);
40hidden void __init_tls(size_t *);
41hidden void __init_ssp(void *);
42hidden void __libc_start_init(void);
43hidden void __funcs_on_exit(void);
44hidden void __funcs_on_quick_exit(void);
45hidden void __libc_exit_fini(void);
46hidden void __fork_handler(int);
47
48extern hidden size_t __hwcap;
49extern hidden size_t __sysinfo;
50extern char *__progname, *__progname_full;
51
52extern hidden const char __libc_version[];
53
54hidden void __synccall(void (*)(void *), void *);
55hidden int __setxid(int, int, int, int);
56
57#endif
src/codegen.cpp+10-10
...@@ -7945,22 +7945,22 @@ static void detect_libc(CodeGen *g) {...@@ -7945,22 +7945,22 @@ static void detect_libc(CodeGen *g) {
7945 if (g->libc != nullptr || g->libc_link_lib == nullptr)7945 if (g->libc != nullptr || g->libc_link_lib == nullptr)
7946 return;7946 return;
79477947
7948 if (g->zig_target->os == OsLinux && target_abi_is_gnu(g->zig_target->abi)) {7948 if (g->zig_target->os == OsLinux && target_abi_is_gnu(g->zig_target->abi) &&
7949 // we have glibc headers and can build glibc start files from source7949 g->is_static && g->out_type == OutTypeExe)
7950 if (g->is_static && g->out_type == OutTypeExe) {7950 {
7951 fprintf(stderr, "glibc does not support static linking\n");7951 fprintf(stderr, "glibc does not support static linking\n");
7952 exit(1);7952 exit(1);
7953 }7953 }
79547954
7955 Buf libc_include_dir = BUF_INIT;7955 if (target_can_build_libc(g->zig_target)) {
7956 os_path_join(g->zig_lib_dir, buf_create_from_str("libc" OS_SEP "include"), &libc_include_dir);7956 const char *generic_name = target_libc_generic_name(g->zig_target);
79577957
7958 Buf *arch_include_dir = buf_sprintf("%s" OS_SEP "libc" OS_SEP "include" OS_SEP "%s-%s-%s",7958 Buf *arch_include_dir = buf_sprintf("%s" OS_SEP "libc" OS_SEP "include" OS_SEP "%s-%s-%s",
7959 buf_ptr(g->zig_lib_dir), target_arch_name(g->zig_target->arch),7959 buf_ptr(g->zig_lib_dir), target_arch_name(g->zig_target->arch),
7960 target_os_name(g->zig_target->os), target_abi_name(g->zig_target->abi));7960 target_os_name(g->zig_target->os), target_abi_name(g->zig_target->abi));
79617961
7962 Buf *generic_include_dir = buf_sprintf("%s" OS_SEP "libc" OS_SEP "include" OS_SEP "generic-glibc",7962 Buf *generic_include_dir = buf_sprintf("%s" OS_SEP "libc" OS_SEP "include" OS_SEP "generic-%s",
7963 buf_ptr(g->zig_lib_dir));7963 buf_ptr(g->zig_lib_dir), generic_name);
79647964
7965 g->libc_include_dir_len = 2;7965 g->libc_include_dir_len = 2;
7966 g->libc_include_dir_list = allocate<Buf*>(2);7966 g->libc_include_dir_list = allocate<Buf*>(2);
src/link.cpp+137-19
...@@ -53,6 +53,10 @@ static bool target_is_glibc(CodeGen *g) {...@@ -53,6 +53,10 @@ static bool target_is_glibc(CodeGen *g) {
53 return g->zig_target->os == OsLinux && target_abi_is_gnu(g->zig_target->abi);53 return g->zig_target->os == OsLinux && target_abi_is_gnu(g->zig_target->abi);
54}54}
5555
56static bool target_is_musl(CodeGen *g) {
57 return g->zig_target->os == OsLinux && target_abi_is_musl(g->zig_target->abi);
58}
59
56static const char *build_libc_object(CodeGen *parent_gen, const char *name, CFile *c_file) {60static const char *build_libc_object(CodeGen *parent_gen, const char *name, CFile *c_file) {
57 CodeGen *child_gen = create_child_codegen(parent_gen, nullptr, OutTypeObj, nullptr);61 CodeGen *child_gen = create_child_codegen(parent_gen, nullptr, OutTypeObj, nullptr);
58 codegen_set_out_name(child_gen, buf_create_from_str(name));62 codegen_set_out_name(child_gen, buf_create_from_str(name));
...@@ -63,6 +67,14 @@ static const char *build_libc_object(CodeGen *parent_gen, const char *name, CFil...@@ -63,6 +67,14 @@ static const char *build_libc_object(CodeGen *parent_gen, const char *name, CFil
63 return buf_ptr(&child_gen->output_file_path);67 return buf_ptr(&child_gen->output_file_path);
64}68}
6569
70static const char *build_asm_object(CodeGen *parent_gen, const char *name, Buf *file) {
71 CodeGen *child_gen = create_child_codegen(parent_gen, nullptr, OutTypeObj, nullptr);
72 codegen_set_out_name(child_gen, buf_create_from_str(name));
73 codegen_add_assembly(child_gen, file);
74 codegen_build_and_link(child_gen);
75 return buf_ptr(&child_gen->output_file_path);
76}
77
66static const char *path_from_zig_lib(CodeGen *g, const char *dir, const char *subpath) {78static const char *path_from_zig_lib(CodeGen *g, const char *dir, const char *subpath) {
67 Buf *dir1 = buf_alloc();79 Buf *dir1 = buf_alloc();
68 os_path_join(g->zig_lib_dir, buf_create_from_str(dir), dir1);80 os_path_join(g->zig_lib_dir, buf_create_from_str(dir), dir1);
...@@ -368,6 +380,89 @@ static const char *glibc_start_asm_path(CodeGen *parent, const char *file) {...@@ -368,6 +380,89 @@ static const char *glibc_start_asm_path(CodeGen *parent, const char *file) {
368 return buf_ptr(&result);380 return buf_ptr(&result);
369}381}
370382
383static const char *musl_arch_name(const ZigTarget *target) {
384 switch (target->arch) {
385 case ZigLLVM_aarch64:
386 case ZigLLVM_aarch64_be:
387 return "aarch64";
388 case ZigLLVM_arm:
389 case ZigLLVM_armeb:
390 return "arm";
391 case ZigLLVM_mips:
392 case ZigLLVM_mipsel:
393 return "mips";
394 case ZigLLVM_mips64el:
395 case ZigLLVM_mips64:
396 return "mips64";
397 case ZigLLVM_ppc:
398 return "powerpc";
399 case ZigLLVM_ppc64:
400 case ZigLLVM_ppc64le:
401 return "powerpc64";
402 case ZigLLVM_systemz:
403 return "s390x";
404 case ZigLLVM_x86:
405 return "i386";
406 case ZigLLVM_x86_64:
407 return "x86_64";
408 default:
409 zig_unreachable();
410 }
411}
412
413static Buf *musl_start_asm_path(CodeGen *parent, const char *file) {
414 return buf_sprintf("%s" OS_SEP "libc" OS_SEP "musl" OS_SEP "crt" OS_SEP "%s" OS_SEP "%s",
415 buf_ptr(parent->zig_lib_dir), musl_arch_name(parent->zig_target), file);
416}
417
418static void musl_add_cc_args(CodeGen *parent, CFile *c_file) {
419 c_file->args.append("-std=c99");
420 c_file->args.append("-ffreestanding");
421 // Musl adds these args to builds with gcc but clang does not support them.
422 //c_file->args.append("-fexcess-precision=standard");
423 //c_file->args.append("-frounding-math");
424 c_file->args.append("-Wa,--noexecstack");
425 c_file->args.append("-D_XOPEN_SOURCE=700");
426
427 c_file->args.append("-I");
428 c_file->args.append(buf_ptr(buf_sprintf("%s" OS_SEP "libc" OS_SEP "musl" OS_SEP "arch" OS_SEP "%s",
429 buf_ptr(parent->zig_lib_dir), musl_arch_name(parent->zig_target))));
430
431 c_file->args.append("-I");
432 c_file->args.append(buf_ptr(buf_sprintf("%s" OS_SEP "libc" OS_SEP "musl" OS_SEP "arch" OS_SEP "generic",
433 buf_ptr(parent->zig_lib_dir))));
434
435 c_file->args.append("-I");
436 c_file->args.append(buf_ptr(buf_sprintf("%s" OS_SEP "libc" OS_SEP "musl" OS_SEP "src" OS_SEP "internal",
437 buf_ptr(parent->zig_lib_dir))));
438
439 c_file->args.append("-I");
440 c_file->args.append(buf_ptr(buf_sprintf("%s" OS_SEP "libc" OS_SEP "musl" OS_SEP "src" OS_SEP "include",
441 buf_ptr(parent->zig_lib_dir))));
442
443 c_file->args.append("-I");
444 c_file->args.append(buf_ptr(buf_sprintf(
445 "%s" OS_SEP "libc" OS_SEP "include" OS_SEP "%s-%s-%s",
446 buf_ptr(parent->zig_lib_dir),
447 target_arch_name(parent->zig_target->arch),
448 target_os_name(parent->zig_target->os),
449 target_abi_name(parent->zig_target->abi))));
450
451 c_file->args.append("-I");
452 c_file->args.append(buf_ptr(buf_sprintf("%s" OS_SEP "libc" OS_SEP "include" OS_SEP "generic-musl",
453 buf_ptr(parent->zig_lib_dir))));
454
455 c_file->args.append("-Os");
456 c_file->args.append("-fomit-frame-pointer");
457 c_file->args.append("-fno-unwind-tables");
458 c_file->args.append("-fno-asynchronous-unwind-tables");
459 c_file->args.append("-ffunction-sections");
460 c_file->args.append("-fdata-sections");
461
462 c_file->args.append("-fno-stack-protector");
463 c_file->args.append("-DCRT");
464}
465
371static const char *get_libc_crt_file(CodeGen *parent, const char *file) {466static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
372 if (parent->libc == nullptr && target_is_glibc(parent)) {467 if (parent->libc == nullptr && target_is_glibc(parent)) {
373 if (strcmp(file, "crti.o") == 0) {468 if (strcmp(file, "crti.o") == 0) {
...@@ -516,6 +611,25 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) {...@@ -516,6 +611,25 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) {
516 } else {611 } else {
517 zig_unreachable();612 zig_unreachable();
518 }613 }
614 } else if (parent->libc == nullptr && target_is_musl(parent)) {
615 if (strcmp(file, "crti.o") == 0) {
616 return build_asm_object(parent, "crti", musl_start_asm_path(parent, "crti.s"));
617 } else if (strcmp(file, "crtn.o") == 0) {
618 return build_asm_object(parent, "crtn", musl_start_asm_path(parent, "crtn.s"));
619 } else if (strcmp(file, "crt1.o") == 0) {
620 CFile *c_file = allocate<CFile>(1);
621 c_file->source_path = path_from_libc(parent, "musl" OS_SEP "crt" OS_SEP "crt1.c");
622 musl_add_cc_args(parent, c_file);
623 return build_libc_object(parent, "crt1", c_file);
624 } else if (strcmp(file, "Scrt1.o") == 0) {
625 CFile *c_file = allocate<CFile>(1);
626 c_file->source_path = path_from_libc(parent, "musl" OS_SEP "crt" OS_SEP "Scrt1.c");
627 musl_add_cc_args(parent, c_file);
628 c_file->args.append("-fPIC");
629 return build_libc_object(parent, "Scrt1", c_file);
630 } else {
631 zig_unreachable();
632 }
519 } else {633 } else {
520 assert(parent->libc != nullptr);634 assert(parent->libc != nullptr);
521 Buf *out_buf = buf_alloc();635 Buf *out_buf = buf_alloc();
...@@ -768,7 +882,7 @@ static void construct_linker_job_elf(LinkJob *lj) {...@@ -768,7 +882,7 @@ static void construct_linker_job_elf(LinkJob *lj) {
768 // libc is linked specially882 // libc is linked specially
769 continue;883 continue;
770 }884 }
771 if (g->libc == nullptr && target_is_glibc(g)) {885 if (g->libc == nullptr && (target_is_glibc(g) || target_is_musl(g))) {
772 // these libraries are always linked below when targeting glibc886 // these libraries are always linked below when targeting glibc
773 if (buf_eql_str(link_lib->name, "m")) {887 if (buf_eql_str(link_lib->name, "m")) {
774 continue;888 continue;
...@@ -794,24 +908,26 @@ static void construct_linker_job_elf(LinkJob *lj) {...@@ -794,24 +908,26 @@ static void construct_linker_job_elf(LinkJob *lj) {
794908
795 // libc dep909 // libc dep
796 if (g->libc_link_lib != nullptr) {910 if (g->libc_link_lib != nullptr) {
797 if (g->is_static) {911 if (g->libc != nullptr) {
798 lj->args.append("--start-group");912 if (g->is_static) {
799 lj->args.append("-lgcc");913 lj->args.append("--start-group");
800 lj->args.append("-lgcc_eh");914 lj->args.append("-lgcc");
801 lj->args.append("-lc");915 lj->args.append("-lgcc_eh");
802 lj->args.append("-lm");916 lj->args.append("-lc");
803 lj->args.append("--end-group");917 lj->args.append("-lm");
804 } else if (g->libc != nullptr) {918 lj->args.append("--end-group");
805 lj->args.append("-lgcc");919 } else {
806 lj->args.append("--as-needed");920 lj->args.append("-lgcc");
807 lj->args.append("-lgcc_s");921 lj->args.append("--as-needed");
808 lj->args.append("--no-as-needed");922 lj->args.append("-lgcc_s");
809 lj->args.append("-lc");923 lj->args.append("--no-as-needed");
810 lj->args.append("-lm");924 lj->args.append("-lc");
811 lj->args.append("-lgcc");925 lj->args.append("-lm");
812 lj->args.append("--as-needed");926 lj->args.append("-lgcc");
813 lj->args.append("-lgcc_s");927 lj->args.append("--as-needed");
814 lj->args.append("--no-as-needed");928 lj->args.append("-lgcc_s");
929 lj->args.append("--no-as-needed");
930 }
815 } else if (target_is_glibc(g)) {931 } else if (target_is_glibc(g)) {
816 lj->args.append(build_libunwind(g));932 lj->args.append(build_libunwind(g));
817 lj->args.append(build_dummy_so(g, "c", 6));933 lj->args.append(build_dummy_so(g, "c", 6));
...@@ -820,6 +936,8 @@ static void construct_linker_job_elf(LinkJob *lj) {...@@ -820,6 +936,8 @@ static void construct_linker_job_elf(LinkJob *lj) {
820 lj->args.append(build_dummy_so(g, "dl", 2));936 lj->args.append(build_dummy_so(g, "dl", 2));
821 lj->args.append(build_dummy_so(g, "rt", 1));937 lj->args.append(build_dummy_so(g, "rt", 1));
822 lj->args.append(get_libc_crt_file(g, "libc_nonshared.a"));938 lj->args.append(get_libc_crt_file(g, "libc_nonshared.a"));
939 } else if (target_is_musl(g)) {
940 //lj->args.append(build_musl(g)); TODO
823 } else {941 } else {
824 zig_unreachable();942 zig_unreachable();
825 }943 }
src/target.cpp+102
...@@ -1370,3 +1370,105 @@ bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi) {...@@ -1370,3 +1370,105 @@ bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi) {
1370 return false;1370 return false;
1371 }1371 }
1372}1372}
1373
1374bool target_abi_is_musl(ZigLLVM_EnvironmentType abi) {
1375 switch (abi) {
1376 case ZigLLVM_Musl:
1377 case ZigLLVM_MuslEABI:
1378 case ZigLLVM_MuslEABIHF:
1379 return true;
1380 default:
1381 return false;
1382 }
1383}
1384
1385struct AvailableLibC {
1386 ZigLLVM_ArchType arch;
1387 Os os;
1388 ZigLLVM_EnvironmentType abi;
1389};
1390
1391static const AvailableLibC libcs_available[] = {
1392 {ZigLLVM_aarch64_be, OsLinux, ZigLLVM_GNU},
1393 {ZigLLVM_aarch64_be, OsLinux, ZigLLVM_Musl},
1394 {ZigLLVM_aarch64, OsLinux, ZigLLVM_GNU},
1395 {ZigLLVM_aarch64, OsLinux, ZigLLVM_MuslEABI},
1396 {ZigLLVM_armeb, OsLinux, ZigLLVM_GNUEABI},
1397 {ZigLLVM_armeb, OsLinux, ZigLLVM_GNUEABIHF},
1398 {ZigLLVM_armeb, OsLinux, ZigLLVM_MuslEABI},
1399 {ZigLLVM_armeb, OsLinux, ZigLLVM_MuslEABIHF},
1400 {ZigLLVM_arm, OsLinux, ZigLLVM_GNUEABI},
1401 {ZigLLVM_arm, OsLinux, ZigLLVM_GNUEABIHF},
1402 {ZigLLVM_arm, OsLinux, ZigLLVM_MuslEABI},
1403 {ZigLLVM_arm, OsLinux, ZigLLVM_MuslEABIHF},
1404 {ZigLLVM_x86, OsLinux, ZigLLVM_GNU},
1405 {ZigLLVM_x86, OsLinux, ZigLLVM_Musl},
1406 {ZigLLVM_mips64el, OsLinux, ZigLLVM_GNUABI64},
1407 {ZigLLVM_mips64el, OsLinux, ZigLLVM_GNUABIN32},
1408 {ZigLLVM_mips64el, OsLinux, ZigLLVM_Musl},
1409 {ZigLLVM_mips64, OsLinux, ZigLLVM_GNUABI64},
1410 {ZigLLVM_mips64, OsLinux, ZigLLVM_GNUABIN32},
1411 {ZigLLVM_mips64, OsLinux, ZigLLVM_Musl},
1412 {ZigLLVM_mipsel, OsLinux, ZigLLVM_GNU},
1413 {ZigLLVM_mipsel, OsLinux, ZigLLVM_Musl},
1414 {ZigLLVM_mips, OsLinux, ZigLLVM_GNU},
1415 {ZigLLVM_mips, OsLinux, ZigLLVM_Musl},
1416 {ZigLLVM_nios2, OsLinux, ZigLLVM_GNU},
1417 {ZigLLVM_ppc64le, OsLinux, ZigLLVM_GNU},
1418 {ZigLLVM_ppc64le, OsLinux, ZigLLVM_Musl},
1419 {ZigLLVM_ppc64, OsLinux, ZigLLVM_GNU},
1420 {ZigLLVM_ppc64, OsLinux, ZigLLVM_Musl},
1421 {ZigLLVM_ppc, OsLinux, ZigLLVM_GNU},
1422 {ZigLLVM_ppc, OsLinux, ZigLLVM_Musl},
1423 {ZigLLVM_riscv32, OsLinux, ZigLLVM_Musl},
1424 {ZigLLVM_riscv64, OsLinux, ZigLLVM_GNU},
1425 {ZigLLVM_riscv64, OsLinux, ZigLLVM_Musl},
1426 {ZigLLVM_systemz, OsLinux, ZigLLVM_GNU},
1427 {ZigLLVM_systemz, OsLinux, ZigLLVM_Musl},
1428 {ZigLLVM_sparc, OsLinux, ZigLLVM_GNU},
1429 {ZigLLVM_sparcv9, OsLinux, ZigLLVM_GNU},
1430 {ZigLLVM_x86_64, OsLinux, ZigLLVM_GNU},
1431 {ZigLLVM_x86_64, OsLinux, ZigLLVM_GNUX32},
1432 {ZigLLVM_x86_64, OsLinux, ZigLLVM_Musl},
1433};
1434
1435bool target_can_build_libc(const ZigTarget *target) {
1436 for (size_t i = 0; i < array_length(libcs_available); i += 1) {
1437 if (target->arch == libcs_available[i].arch &&
1438 target->os == libcs_available[i].os &&
1439 target->abi == libcs_available[i].abi)
1440 {
1441 return true;
1442 }
1443 }
1444 return false;
1445}
1446
1447const char *target_libc_generic_name(const ZigTarget *target) {
1448 assert(target->os == OsLinux);
1449 switch (target->abi) {
1450 case ZigLLVM_GNU:
1451 case ZigLLVM_GNUABIN32:
1452 case ZigLLVM_GNUABI64:
1453 case ZigLLVM_GNUEABI:
1454 case ZigLLVM_GNUEABIHF:
1455 case ZigLLVM_GNUX32:
1456 return "glibc";
1457 case ZigLLVM_Musl:
1458 case ZigLLVM_MuslEABI:
1459 case ZigLLVM_MuslEABIHF:
1460 return "musl";
1461 case ZigLLVM_CODE16:
1462 case ZigLLVM_EABI:
1463 case ZigLLVM_EABIHF:
1464 case ZigLLVM_Android:
1465 case ZigLLVM_MSVC:
1466 case ZigLLVM_Itanium:
1467 case ZigLLVM_Cygnus:
1468 case ZigLLVM_CoreCLR:
1469 case ZigLLVM_Simulator:
1470 case ZigLLVM_UnknownEnvironment:
1471 zig_unreachable();
1472 }
1473 zig_unreachable();
1474}
src/target.hpp+3
...@@ -157,8 +157,11 @@ bool target_allows_addr_zero(const ZigTarget *target);...@@ -157,8 +157,11 @@ bool target_allows_addr_zero(const ZigTarget *target);
157bool target_has_valgrind_support(const ZigTarget *target);157bool target_has_valgrind_support(const ZigTarget *target);
158bool target_is_darwin(const ZigTarget *target);158bool target_is_darwin(const ZigTarget *target);
159bool target_requires_libc(const ZigTarget *target);159bool target_requires_libc(const ZigTarget *target);
160bool target_can_build_libc(const ZigTarget *target);
161const char *target_libc_generic_name(const ZigTarget *target);
160bool target_supports_fpic(const ZigTarget *target);162bool target_supports_fpic(const ZigTarget *target);
161bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi);163bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi);
164bool target_abi_is_musl(ZigLLVM_EnvironmentType abi);
162165
163uint32_t target_arch_pointer_bit_width(ZigLLVM_ArchType arch);166uint32_t target_arch_pointer_bit_width(ZigLLVM_ArchType arch);
164167