diff options
Diffstat (limited to 'lib/mlibc/options/glibc/include/sys')
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/dir.h | 8 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/endian.h | 0 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/errno.h | 1 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/io.h | 108 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/ioctl.h | 44 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/kd.h | 17 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/mtio.h | 103 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/personality.h | 58 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/procfs.h | 54 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/reg.h | 36 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/signal.h | 1 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/timeb.h | 14 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/timex.h | 78 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/ucontext.h | 14 | ||||
-rw-r--r-- | lib/mlibc/options/glibc/include/sys/user.h | 49 |
15 files changed, 585 insertions, 0 deletions
diff --git a/lib/mlibc/options/glibc/include/sys/dir.h b/lib/mlibc/options/glibc/include/sys/dir.h new file mode 100644 index 0000000..eff112c --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/dir.h @@ -0,0 +1,8 @@ +#ifndef _SYS_DIR_H +#define _SYS_DIR_H + +#include <dirent.h> + +#define direct dirent + +#endif diff --git a/lib/mlibc/options/glibc/include/sys/endian.h b/lib/mlibc/options/glibc/include/sys/endian.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/endian.h diff --git a/lib/mlibc/options/glibc/include/sys/errno.h b/lib/mlibc/options/glibc/include/sys/errno.h new file mode 100644 index 0000000..339f4fc --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/errno.h @@ -0,0 +1 @@ +#include <errno.h> diff --git a/lib/mlibc/options/glibc/include/sys/io.h b/lib/mlibc/options/glibc/include/sys/io.h new file mode 100644 index 0000000..311b25f --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/io.h @@ -0,0 +1,108 @@ +#ifndef _SYS_IO_H +#define _SYS_IO_H + +#include <bits/inline-definition.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __MLIBC_ABI_ONLY + +int ioperm(unsigned long int from, unsigned long int num, int turn_on); + +__attribute__((deprecated)) int iopl(int level); + +#endif /* !__MLIBC_ABI_ONLY */ + +#ifdef __x86_64__ +__MLIBC_INLINE_DEFINITION unsigned char inb(unsigned short int port) { + unsigned char _v; + __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port)); + return _v; +} + +__MLIBC_INLINE_DEFINITION unsigned char inb_p(unsigned short int port) { + unsigned char _v; + __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (port)); + return _v; +} + +__MLIBC_INLINE_DEFINITION unsigned short int inw(unsigned short int port) { + unsigned short _v; + __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (port)); + return _v; +} + +__MLIBC_INLINE_DEFINITION unsigned short int inw_p(unsigned short int port) { + unsigned short int _v; + __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (port)); + return _v; +} + +__MLIBC_INLINE_DEFINITION unsigned int inl(unsigned short int port) { + unsigned int _v; + __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (port)); + return _v; +} + +__MLIBC_INLINE_DEFINITION unsigned int inl_p(unsigned short int port) { + unsigned int _v; + __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (port)); + return _v; +} + +__MLIBC_INLINE_DEFINITION void outb(unsigned char value, unsigned short int port) { + __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port)); +} + +__MLIBC_INLINE_DEFINITION void outb_p(unsigned char value, unsigned short int port) { + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (value), "Nd" (port)); +} + +__MLIBC_INLINE_DEFINITION void outw(unsigned short int value, unsigned short int port) { + __asm__ __volatile__ ("outw %w0,%w1": :"a" (value), "Nd" (port)); +} + +__MLIBC_INLINE_DEFINITION void outw_p(unsigned short int value, unsigned short int port) { + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (value), "Nd" (port)); +} + +__MLIBC_INLINE_DEFINITION void outl(unsigned int value, unsigned short int port) { + __asm__ __volatile__ ("outl %0,%w1": :"a" (value), "Nd" (port)); +} + +__MLIBC_INLINE_DEFINITION void outl_p(unsigned int value, unsigned short int port) { + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (value), "Nd" (port)); +} + +__MLIBC_INLINE_DEFINITION void insb(unsigned short int port, void *addr, unsigned long int count) { + __asm__ __volatile__ ("cld ; rep ; insb":"=D" (addr), "=c" (count) :"d" (port), "0" (addr), "1" (count)); +} + +__MLIBC_INLINE_DEFINITION void insw(unsigned short int port, void *addr, unsigned long int count) { + __asm__ __volatile__ ("cld ; rep ; insw":"=D" (addr), "=c" (count) :"d" (port), "0" (addr), "1" (count)); +} + +__MLIBC_INLINE_DEFINITION void insl(unsigned short int port, void *addr, unsigned long int count) { + __asm__ __volatile__ ("cld ; rep ; insl":"=D" (addr), "=c" (count) :"d" (port), "0" (addr), "1" (count)); +} + +__MLIBC_INLINE_DEFINITION void outsb(unsigned short int port, const void *addr, unsigned long int count) { + __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (addr), "=c" (count) :"d" (port), "0" (addr), "1" (count)); +} + +__MLIBC_INLINE_DEFINITION void outsw(unsigned short int port, const void *addr, unsigned long int count) { + __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (addr), "=c" (count) :"d" (port), "0" (addr), "1" (count)); +} + +__MLIBC_INLINE_DEFINITION void outsl(unsigned short int port, const void *addr, unsigned long int count) { + __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (addr), "=c" (count) :"d" (port), "0" (addr), "1" (count)); +} +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_IO_H */ diff --git a/lib/mlibc/options/glibc/include/sys/ioctl.h b/lib/mlibc/options/glibc/include/sys/ioctl.h new file mode 100644 index 0000000..6121446 --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/ioctl.h @@ -0,0 +1,44 @@ +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#include <mlibc-config.h> +#include <abi-bits/ioctls.h> + +// On Linux, sys/ioctl.h includes the termios ioctls. +#if __MLIBC_LINUX_OPTION +# include <asm/ioctls.h> +# include <bits/winsize.h> +# include <sys/ttydefaults.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __MLIBC_ABI_ONLY + +int ioctl(int fd, unsigned long request, ...); + +#endif /* !__MLIBC_ABI_ONLY */ + +#define FIONREAD 0x541B +#define FIONBIO 0x5421 +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 + +#define SIOCGIFNAME 0x8910 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCGIFINDEX 0x8933 + +#define SIOCPROTOPRIVATE 0x89E0 +#define SIOCDEVPRIVATE 0x89F0 + +#ifdef __cplusplus +} +#endif + +#endif // _SYS_IOCTL_H diff --git a/lib/mlibc/options/glibc/include/sys/kd.h b/lib/mlibc/options/glibc/include/sys/kd.h new file mode 100644 index 0000000..285c694 --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/kd.h @@ -0,0 +1,17 @@ +#ifndef _SYS_KD_H +#define _SYS_KD_H + +/* Make sure the <linux/types.h> header is not loaded. */ +#ifndef _LINUX_TYPES_H +# define _LINUX_TYPES_H 1 +# define __undef_LINUX_TYPES_H +#endif + +#include <linux/kd.h> + +#ifdef __undef_LINUX_TYPES_H +# undef _LINUX_TYPES_H +# undef __undef_LINUX_TYPES_H +#endif + +#endif /* _SYS_KD_H */ diff --git a/lib/mlibc/options/glibc/include/sys/mtio.h b/lib/mlibc/options/glibc/include/sys/mtio.h new file mode 100644 index 0000000..c2f9d98 --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/mtio.h @@ -0,0 +1,103 @@ +#ifndef _SYS_MTIO_H +#define _SYS_MTIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <mlibc-config.h> + +struct mtop { + short int mt_op; + int mt_count; +}; + +struct mtget { + long int mt_type; + long int mt_resid; + long int mt_dsreg; + long int mt_gstat; + long int mt_erreg; + int mt_fileno; + int mt_blkno; +}; + +struct mtpos { + long int mt_blkno; +}; + +struct mtconfiginfo { + long int mt_type; + long int ifc_type; + unsigned short int irqnr; + unsigned short int dmanr; + unsigned short int port; + + unsigned long int debug; + + unsigned have_dens:1; + unsigned have_bsf:1; + unsigned have_fsr:1; + unsigned have_bsr:1; + unsigned have_eod:1; + unsigned have_seek:1; + unsigned have_tell:1; + unsigned have_ras1:1; + unsigned have_ras2:1; + unsigned have_ras3:1; + unsigned have_qfa:1; + + unsigned pad1:5; + char reserved[10]; +}; + +#define MTRESET 0 +#define MTFSF 1 +#define MTBSF 2 +#define MTFSR 3 +#define MTBSR 4 +#define MTWEOF 5 +#define MTREW 6 +#define MTOFFL 7 +#define MTNOP 8 +#define MTRETEN 9 +#define MTBSFM 10 +#define MTFSFM 11 +#define MTEOM 12 +#define MTERASE 13 +#define MTRAS1 14 +#define MTRAS2 15 +#define MTRAS3 16 +#define MTSETBLK 20 +#define MTSETDENSITY 21 +#define MTSEEK 22 +#define MTTELL 23 +#define MTSETDRVBUFFER 24 +#define MTFSS 25 +#define MTBSS 26 +#define MTWSM 27 +#define MTLOCK 28 +#define MTUNLOCK 29 +#define MTLOAD 30 +#define MTUNLOAD 31 +#define MTCOMPRESSION 32 +#define MTSETPART 33 +#define MTMKPART 34 + +#define GMT_WR_PROT(x) ((x) & 0x04000000) + +#if __MLIBC_LINUX_OPTION +#include <asm/ioctl.h> + +#define MTIOCTOP _IOR('m', 1, struct mtop) +#define MTIOCGET _IOR('m', 2, struct mtget) +#define MTIOCPOS _IOR('m', 3, struct mtpos) +#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) +#define MTIOCSETCONFIG _IOR('m', 5, struct mtconfiginfo) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_MTIO_H */ diff --git a/lib/mlibc/options/glibc/include/sys/personality.h b/lib/mlibc/options/glibc/include/sys/personality.h new file mode 100644 index 0000000..04563a0 --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/personality.h @@ -0,0 +1,58 @@ +#ifndef _SYS_PERSONALITY_H +#define _SYS_PERSONALITY_H + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + UNAME26 = 0x0020000, + ADDR_NO_RANDOMIZE = 0x0040000, + FDPIC_FUNCPTRS = 0x0080000, + MMAP_PAGE_ZERO = 0x0100000, + ADDR_COMPAT_LAYOUT = 0x0200000, + READ_IMPLIES_EXEC = 0x0400000, + ADDR_LIMIT_32BIT = 0x0800000, + SHORT_INODE = 0x1000000, + WHOLE_SECONDS = 0x2000000, + STICKY_TIMEOUTS = 0x4000000, + ADDR_LIMIT_3GB = 0x8000000, +}; + +enum { + PER_LINUX = 0x0000, + PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, + PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, + PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, + PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, + PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, + PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, + PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, + PER_BSD = 0x0006, + PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, + PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, + PER_LINUX32 = 0x0008, + PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, + PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, + PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, + PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, + PER_RISCOS = 0x000c, + PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, + PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, + PER_OSF4 = 0x000f, + PER_HPUX = 0x0010, + PER_MASK = 0x00ff, +}; + +#ifndef __MLIBC_ABI_ONLY + +int personality(unsigned long persona); + +#endif /* !__MLIBC_ABI_ONLY */ + +#ifdef __cplusplus +} +#endif + +#endif // _SYS_PERSONALITY_H diff --git a/lib/mlibc/options/glibc/include/sys/procfs.h b/lib/mlibc/options/glibc/include/sys/procfs.h new file mode 100644 index 0000000..b13a81d --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/procfs.h @@ -0,0 +1,54 @@ +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H + +#include <sys/user.h> +#include <sys/time.h> +#include <abi-bits/pid_t.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned long long elf_greg_t; + +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef struct user_fpregs_struct elf_fpregset_t; +typedef struct user_regs_struct prgregset_t; +typedef struct user_fpregs_struct prfpregset_t; + +#define ELF_PRARGSZ 80 + +struct elf_siginfo { + int si_signo; + int si_code; + int si_errno; +}; + +struct elf_prstatus { + struct elf_siginfo pr_info; + short int pr_cursig; + unsigned long int pr_sigpend; + unsigned long int pr_sighold; + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct timeval pr_utime; + struct timeval pr_stime; + struct timeval pr_cutime; + struct timeval pr_cstime; + elf_gregset_t pr_reg; + int pr_fpvalid; +}; + +typedef pid_t lwpid_t; +typedef void *psaddr_t; +typedef struct elf_prstatus prstatus_t; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/mlibc/options/glibc/include/sys/reg.h b/lib/mlibc/options/glibc/include/sys/reg.h new file mode 100644 index 0000000..c6e3429 --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/reg.h @@ -0,0 +1,36 @@ +#ifndef _SYS_REG_H +#define _SYS_REG_H + +#ifdef __x86_64__ +#define R15 0 +#define R14 1 +#define R13 2 +#define R12 3 +#define RBP 4 +#define RBX 5 +#define R11 6 +#define R10 7 +#define R9 8 +#define R8 9 +#define RAX 10 +#define RCX 11 +#define RDX 12 +#define RSI 13 +#define RDI 14 +#define ORIG_RAX 15 +#define RIP 16 +#define CS 17 +#define EFLAGS 18 +#define RSP 19 +#define SS 20 +#define FS_BASE 21 +#define GS_BASE 22 +#define DS 23 +#define ES 24 +#define FS 25 +#define GS 26 +#else +#error "Add architecture specific code here" +#endif + +#endif diff --git a/lib/mlibc/options/glibc/include/sys/signal.h b/lib/mlibc/options/glibc/include/sys/signal.h new file mode 100644 index 0000000..2e602da --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/signal.h @@ -0,0 +1 @@ +#include <signal.h> diff --git a/lib/mlibc/options/glibc/include/sys/timeb.h b/lib/mlibc/options/glibc/include/sys/timeb.h new file mode 100644 index 0000000..d27173b --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/timeb.h @@ -0,0 +1,14 @@ +#ifndef _SYS_TIMEB_H +#define _SYS_TIMEB_H + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif // _SYS_TIMEB_H diff --git a/lib/mlibc/options/glibc/include/sys/timex.h b/lib/mlibc/options/glibc/include/sys/timex.h new file mode 100644 index 0000000..97153ad --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/timex.h @@ -0,0 +1,78 @@ +#ifndef _SYS_TIMEX_H +#define _SYS_TIMEX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <abi-bits/clockid_t.h> +#include <bits/posix/timeval.h> + +struct timex { + int modes; + long offset; + long freq; + long maxerror; + long esterror; + int status; + long constant; + long precision; + long tolerance; + struct timeval time; + long tick; + long ppsfreq; + long jitter; + int shift; + long stabil; + long jitcnt; + long calcnt; + long errcnt; + long stbcnt; + int tai; + int __padding[11]; +}; + +#define ADJ_OFFSET 0x0001 +#define ADJ_FREQUENCY 0x0002 +#define ADJ_MAXERROR 0x0004 +#define ADJ_ESTERROR 0x0008 +#define ADJ_STATUS 0x0010 +#define ADJ_TIMECONST 0x0020 +#define ADJ_TAI 0x0080 +#define ADJ_SETOFFSET 0x0100 +#define ADJ_MICRO 0x1000 +#define ADJ_NANO 0x2000 +#define ADJ_TICK 0x4000 +#define ADJ_OFFSET_SINGLESHOT 0x8001 +#define ADJ_OFFSET_SS_READ 0xa001 + +#define STA_PLL 0x0001 +#define STA_PPSFREQ 0x0002 +#define STA_PPSTIME 0x0004 +#define STA_FLL 0x0008 +#define STA_INS 0x0010 +#define STA_DEL 0x0020 +#define STA_UNSYNC 0x0040 +#define STA_FREQHOLD 0x0080 +#define STA_PPSSIGNAL 0x0100 +#define STA_PPSJITTER 0x0200 +#define STA_PPSWANDER 0x0400 +#define STA_PPSERROR 0x0800 +#define STA_CLOCKERR 0x1000 +#define STA_NANO 0x2000 +#define STA_MODE 0x4000 +#define STA_CLK 0x8000 + +#ifndef __MLIBC_ABI_ONLY + +int adjtimex(struct timex *); +int clock_adjtime(clockid_t clk_id, struct timex *buf); +int ntp_adjtime(struct timex *); + +#endif /* !__MLIBC_ABI_ONLY */ + +#ifdef __cplusplus +} +#endif + +#endif // _SYS_TIMEX_H diff --git a/lib/mlibc/options/glibc/include/sys/ucontext.h b/lib/mlibc/options/glibc/include/sys/ucontext.h new file mode 100644 index 0000000..b4798ee --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/ucontext.h @@ -0,0 +1,14 @@ +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif // _SYS_UCONTEXT_H diff --git a/lib/mlibc/options/glibc/include/sys/user.h b/lib/mlibc/options/glibc/include/sys/user.h new file mode 100644 index 0000000..9a07ac6 --- /dev/null +++ b/lib/mlibc/options/glibc/include/sys/user.h @@ -0,0 +1,49 @@ +#ifndef _SYS_USER_H +#define _SYS_USER_H + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct user_fpregs_struct { + uint16_t cwd, swd, ftw, fop; + uint64_t rip, rdp; + uint32_t mxcsr, mxcr_mask; + uint32_t st_space[32], xmm_space[64], padding[24]; +} elf_fpregset_t; + +struct user_regs_struct { + unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8; + unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip; + unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs; +}; + +struct user { + struct user_regs_struct regs; + int u_fpvalid; + struct user_fpregs_struct i387; + unsigned long u_tsize; + unsigned long u_dsize; + unsigned long u_ssize; + unsigned long start_code; + unsigned long start_stack; + long signal; + int reserved; + struct user_regs_struct *u_ar0; + struct user_fpregs_struct *u_fpstate; + unsigned long magic; + char u_comm[32]; + unsigned long u_debugreg[8]; +}; + +#ifdef __cplusplus +} +#endif + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE - 1)) + +#endif |