Skip to content

Commit d96a64f

Browse files
committed
Add many missing musl c files
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 0bc6ec4 commit d96a64f

File tree

443 files changed

+22703
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+22703
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
15+
typedef unsigned short fexcept_t;
16+
17+
typedef 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)
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
static __inline void outb(unsigned char __val, unsigned short __port)
2+
{
3+
__asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
4+
}
5+
6+
static __inline void outw(unsigned short __val, unsigned short __port)
7+
{
8+
__asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
9+
}
10+
11+
static __inline void outl(unsigned int __val, unsigned short __port)
12+
{
13+
__asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
14+
}
15+
16+
static __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+
23+
static __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+
30+
static __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+
37+
static __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+
44+
static __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+
51+
static __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+
58+
static __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+
65+
static __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+
72+
static __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+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define MAP_32BIT 0x40
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define _POSIX_V6_LP64_OFF64 1
2+
#define _POSIX_V7_LP64_OFF64 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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" )
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef _BYTESWAP_H
2+
#define _BYTESWAP_H
3+
4+
#include <features.h>
5+
#include <stdint.h>
6+
7+
static __inline uint16_t __bswap_16(uint16_t __x)
8+
{
9+
return __x<<8 | __x>>8;
10+
}
11+
12+
static __inline uint32_t __bswap_32(uint32_t __x)
13+
{
14+
return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
15+
}
16+
17+
static __inline uint64_t __bswap_64(uint64_t __x)
18+
{
19+
return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
20+
}
21+
22+
#define bswap_16(x) __bswap_16(x)
23+
#define bswap_32(x) __bswap_32(x)
24+
#define bswap_64(x) __bswap_64(x)
25+
26+
#endif
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
#ifndef _COMPLEX_H
2+
#define _COMPLEX_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#define complex _Complex
9+
#ifdef __GNUC__
10+
#define _Complex_I (__extension__ (0.0f+1.0fi))
11+
#else
12+
#define _Complex_I (0.0f+1.0fi)
13+
#endif
14+
#define I _Complex_I
15+
16+
double complex cacos(double complex);
17+
float complex cacosf(float complex);
18+
long double complex cacosl(long double complex);
19+
20+
double complex casin(double complex);
21+
float complex casinf(float complex);
22+
long double complex casinl(long double complex);
23+
24+
double complex catan(double complex);
25+
float complex catanf(float complex);
26+
long double complex catanl(long double complex);
27+
28+
double complex ccos(double complex);
29+
float complex ccosf(float complex);
30+
long double complex ccosl(long double complex);
31+
32+
double complex csin(double complex);
33+
float complex csinf(float complex);
34+
long double complex csinl(long double complex);
35+
36+
double complex ctan(double complex);
37+
float complex ctanf(float complex);
38+
long double complex ctanl(long double complex);
39+
40+
double complex cacosh(double complex);
41+
float complex cacoshf(float complex);
42+
long double complex cacoshl(long double complex);
43+
44+
double complex casinh(double complex);
45+
float complex casinhf(float complex);
46+
long double complex casinhl(long double complex);
47+
48+
double complex catanh(double complex);
49+
float complex catanhf(float complex);
50+
long double complex catanhl(long double complex);
51+
52+
double complex ccosh(double complex);
53+
float complex ccoshf(float complex);
54+
long double complex ccoshl(long double complex);
55+
56+
double complex csinh(double complex);
57+
float complex csinhf(float complex);
58+
long double complex csinhl(long double complex);
59+
60+
double complex ctanh(double complex);
61+
float complex ctanhf(float complex);
62+
long double complex ctanhl(long double complex);
63+
64+
double complex cexp(double complex);
65+
float complex cexpf(float complex);
66+
long double complex cexpl(long double complex);
67+
68+
double complex clog(double complex);
69+
float complex clogf(float complex);
70+
long double complex clogl(long double complex);
71+
72+
double cabs(double complex);
73+
float cabsf(float complex);
74+
long double cabsl(long double complex);
75+
76+
double complex cpow(double complex, double complex);
77+
float complex cpowf(float complex, float complex);
78+
long double complex cpowl(long double complex, long double complex);
79+
80+
double complex csqrt(double complex);
81+
float complex csqrtf(float complex);
82+
long double complex csqrtl(long double complex);
83+
84+
double carg(double complex);
85+
float cargf(float complex);
86+
long double cargl(long double complex);
87+
88+
double cimag(double complex);
89+
float cimagf(float complex);
90+
long double cimagl(long double complex);
91+
92+
double complex conj(double complex);
93+
float complex conjf(float complex);
94+
long double complex conjl(long double complex);
95+
96+
double complex cproj(double complex);
97+
float complex cprojf(float complex);
98+
long double complex cprojl(long double complex);
99+
100+
double creal(double complex);
101+
float crealf(float complex);
102+
long double creall(long double complex);
103+
104+
#ifndef __cplusplus
105+
#define __CIMAG(x, t) \
106+
(+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
107+
108+
#define creal(x) ((double)(x))
109+
#define crealf(x) ((float)(x))
110+
#define creall(x) ((long double)(x))
111+
112+
#define cimag(x) __CIMAG(x, double)
113+
#define cimagf(x) __CIMAG(x, float)
114+
#define cimagl(x) __CIMAG(x, long double)
115+
#endif
116+
117+
#if __STDC_VERSION__ >= 201112L
118+
#if defined(_Imaginary_I)
119+
#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y))
120+
#elif defined(__clang__)
121+
#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) })
122+
#else
123+
#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y)))
124+
#endif
125+
#define CMPLX(x, y) __CMPLX(x, y, double)
126+
#define CMPLXF(x, y) __CMPLX(x, y, float)
127+
#define CMPLXL(x, y) __CMPLX(x, y, long double)
128+
#endif
129+
130+
#ifdef __cplusplus
131+
}
132+
#endif
133+
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef _FENV_H
2+
#define _FENV_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include <bits/fenv.h>
9+
10+
int feclearexcept(int);
11+
int fegetexceptflag(fexcept_t *, int);
12+
int feraiseexcept(int);
13+
int fesetexceptflag(const fexcept_t *, int);
14+
int fetestexcept(int);
15+
16+
int fegetround(void);
17+
int fesetround(int);
18+
19+
int fegetenv(fenv_t *);
20+
int feholdexcept(fenv_t *);
21+
int fesetenv(const fenv_t *);
22+
int feupdateenv(const fenv_t *);
23+
24+
#ifdef __cplusplus
25+
}
26+
#endif
27+
#endif
28+

0 commit comments

Comments
 (0)