aboutsummaryrefslogtreecommitdiff
path: root/linux-headers/include/asm
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@eecs.berkeley.edu>2014-09-11 13:37:51 -0700
committerAndrew Waterman <waterman@eecs.berkeley.edu>2014-09-11 13:37:51 -0700
commit82b6ccde8f4e3d48d1c358275271e49881e56cf7 (patch)
treec5dbfa5dec2c28185f77e98124f483f79a9e6734 /linux-headers/include/asm
parent7ce82261f5b2ca8ba4835b0a73124ca25fbdd2db (diff)
downloadriscv-gnu-toolchain-82b6ccde8f4e3d48d1c358275271e49881e56cf7.zip
riscv-gnu-toolchain-82b6ccde8f4e3d48d1c358275271e49881e56cf7.tar.gz
riscv-gnu-toolchain-82b6ccde8f4e3d48d1c358275271e49881e56cf7.tar.bz2
glibc: initial port of glibc 2.20
Diffstat (limited to 'linux-headers/include/asm')
-rw-r--r--linux-headers/include/asm/asm-offsets.h1
-rw-r--r--linux-headers/include/asm/auxvec.h1
-rw-r--r--linux-headers/include/asm/bitsperlong.h21
-rw-r--r--linux-headers/include/asm/byteorder.h12
-rw-r--r--linux-headers/include/asm/csr.h125
-rw-r--r--linux-headers/include/asm/errno.h1
-rw-r--r--linux-headers/include/asm/fcntl.h1
-rw-r--r--linux-headers/include/asm/ioctl.h1
-rw-r--r--linux-headers/include/asm/ioctls.h1
-rw-r--r--linux-headers/include/asm/ipcbuf.h1
-rw-r--r--linux-headers/include/asm/mman.h1
-rw-r--r--linux-headers/include/asm/msgbuf.h1
-rw-r--r--linux-headers/include/asm/param.h1
-rw-r--r--linux-headers/include/asm/poll.h1
-rw-r--r--linux-headers/include/asm/posix_types.h1
-rw-r--r--linux-headers/include/asm/ptrace.h76
-rw-r--r--linux-headers/include/asm/resource.h1
-rw-r--r--linux-headers/include/asm/sembuf.h1
-rw-r--r--linux-headers/include/asm/setup.h7
-rw-r--r--linux-headers/include/asm/shmbuf.h1
-rw-r--r--linux-headers/include/asm/sigcontext.h21
-rw-r--r--linux-headers/include/asm/siginfo.h1
-rw-r--r--linux-headers/include/asm/signal.h1
-rw-r--r--linux-headers/include/asm/socket.h1
-rw-r--r--linux-headers/include/asm/sockios.h1
-rw-r--r--linux-headers/include/asm/stat.h1
-rw-r--r--linux-headers/include/asm/statfs.h1
-rw-r--r--linux-headers/include/asm/swab.h1
-rw-r--r--linux-headers/include/asm/termbits.h1
-rw-r--r--linux-headers/include/asm/termios.h1
-rw-r--r--linux-headers/include/asm/types.h1
-rw-r--r--linux-headers/include/asm/unistd.h29
-rw-r--r--linux-headers/include/asm/user.h19
-rw-r--r--linux-headers/include/asm/vdso.h15
34 files changed, 350 insertions, 0 deletions
diff --git a/linux-headers/include/asm/asm-offsets.h b/linux-headers/include/asm/asm-offsets.h
new file mode 100644
index 0000000..d370ee3
--- /dev/null
+++ b/linux-headers/include/asm/asm-offsets.h
@@ -0,0 +1 @@
+#include <generated/asm-offsets.h>
diff --git a/linux-headers/include/asm/auxvec.h b/linux-headers/include/asm/auxvec.h
new file mode 100644
index 0000000..41fa68b
--- /dev/null
+++ b/linux-headers/include/asm/auxvec.h
@@ -0,0 +1 @@
+#include <asm-generic/auxvec.h>
diff --git a/linux-headers/include/asm/bitsperlong.h b/linux-headers/include/asm/bitsperlong.h
new file mode 100644
index 0000000..f67718d
--- /dev/null
+++ b/linux-headers/include/asm/bitsperlong.h
@@ -0,0 +1,21 @@
+#ifndef __ASM_RISCV_BITS_PER_LONG
+#define __ASM_RISCV_BITS_PER_LONG
+
+/*
+ * There seems to be no way of detecting this automatically from user
+ * space, so 64 bit architectures should override this in their
+ * bitsperlong.h. In particular, an architecture that supports
+ * both 32 and 64 bit user space must not rely on CONFIG_64BIT
+ * to decide it, but rather check a compiler provided macro.
+ */
+#ifndef __BITS_PER_LONG
+#if _RISCV_SIM == _ABI64
+#define __BITS_PER_LONG 64
+#elif _RISCV_SIM == _ABI32
+#define __BITS_PER_LONG 32
+#else
+#error Unknown word length
+#endif
+#endif /* __BITS_PER_LONG */
+
+#endif /* __ASM_RISCV_BITS_PER_LONG */
diff --git a/linux-headers/include/asm/byteorder.h b/linux-headers/include/asm/byteorder.h
new file mode 100644
index 0000000..994a61a
--- /dev/null
+++ b/linux-headers/include/asm/byteorder.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_RISCV_BYTEORDER_H
+#define _ASM_RISCV_BYTEORDER_H
+
+#if defined(__RISCVEL__)
+#include <linux/byteorder/little_endian.h>
+#elif defined(__RISCVEB__)
+#include <linux/byteorder/big_endian.h>
+#else
+#error "Unknown endianness"
+#endif
+
+#endif /* _ASM_RISCV_BYTEORDER_H */
diff --git a/linux-headers/include/asm/csr.h b/linux-headers/include/asm/csr.h
new file mode 100644
index 0000000..5042bea
--- /dev/null
+++ b/linux-headers/include/asm/csr.h
@@ -0,0 +1,125 @@
+#ifndef _ASM_RISCV_CSR_H
+#define _ASM_RISCV_CSR_H
+
+#include <linux/const.h>
+
+/* Status register flags */
+#define SR_S _AC(0x00000001,UL) /* Supervisor */
+#define SR_PS _AC(0x00000002,UL) /* Previous supervisor */
+#define SR_EI _AC(0x00000004,UL) /* Enable interrupts */
+#define SR_PEI _AC(0x00000008,UL) /* Previous EI */
+#define SR_EF _AC(0x00000010,UL) /* Enable floating-point */
+#define SR_U64 _AC(0x00000020,UL) /* RV64 user mode */
+#define SR_S64 _AC(0x00000040,UL) /* RV64 supervisor mode */
+#define SR_VM _AC(0x00000080,UL) /* Enable virtual memory */
+#define SR_IM _AC(0x00FF0000,UL) /* Interrupt mask */
+#define SR_IP _AC(0xFF000000,UL) /* Pending interrupts */
+
+#define SR_IM_SHIFT 16
+#define SR_IM_MASK(n) ((_AC(1,UL)) << ((n) + SR_IM_SHIFT))
+
+#define EXC_INST_MISALIGNED 0
+#define EXC_INST_ACCESS 1
+#define EXC_SYSCALL 6
+#define EXC_LOAD_MISALIGNED 8
+#define EXC_STORE_MISALIGNED 9
+#define EXC_LOAD_ACCESS 10
+#define EXC_STORE_ACCESS 11
+
+#ifndef __ASSEMBLY__
+
+#define CSR_ZIMM(val) \
+ (__builtin_constant_p(val) && ((unsigned long)(val) < 0x20))
+
+#define csr_swap(csr,val) \
+({ \
+ typeof(val) __v = (val); \
+ if (CSR_ZIMM(__v)) { \
+ __asm__ __volatile__ ( \
+ "csrrw %0, " #csr ", %1" \
+ : "=r" (__v) : "i" (__v)); \
+ } else { \
+ __asm__ __volatile__ ( \
+ "csrrw %0, " #csr ", %1" \
+ : "=r" (__v) : "r" (__v)); \
+ } \
+ __v; \
+})
+
+#define csr_read(csr) \
+({ \
+ register unsigned long __v; \
+ __asm__ __volatile__ ( \
+ "csrr %0, " #csr : "=r" (__v)); \
+ __v; \
+})
+
+#define csr_write(csr,val) \
+({ \
+ typeof(val) __v = (val); \
+ if (CSR_ZIMM(__v)) { \
+ __asm__ __volatile__ ( \
+ "csrw " #csr ", %0" : : "i" (__v)); \
+ } else { \
+ __asm__ __volatile__ ( \
+ "csrw " #csr ", %0" : : "r" (__v)); \
+ } \
+})
+
+#define csr_read_set(csr,val) \
+({ \
+ typeof(val) __v = (val); \
+ if (CSR_ZIMM(val)) { \
+ __asm__ __volatile__ ( \
+ "csrrs %0, " #csr ", %1" \
+ : "=r" (__v) : "i" (__v)); \
+ } else { \
+ __asm__ __volatile__ ( \
+ "csrrs %0, " #csr ", %1" \
+ : "=r" (__v) : "r" (__v)); \
+ } \
+ __v; \
+})
+
+#define csr_set(csr,val) \
+({ \
+ typeof(val) __v = (val); \
+ if (CSR_ZIMM(__v)) { \
+ __asm__ __volatile__ ( \
+ "csrs " #csr ", %0" : : "i" (__v)); \
+ } else { \
+ __asm__ __volatile__ ( \
+ "csrs " #csr ", %0" : : "r" (__v)); \
+ } \
+})
+
+#define csr_read_clear(csr,val) \
+({ \
+ typeof(val) __v = (val); \
+ if (CSR_ZIMM(__v)) { \
+ __asm__ __volatile__ ( \
+ "csrrc %0, " #csr ", %1" \
+ : "=r" (__v) : "i" (__v)); \
+ } else { \
+ __asm__ __volatile__ ( \
+ "csrrc %0, " #csr ", %1" \
+ : "=r" (__v) : "r" (__v)); \
+ } \
+ __v; \
+})
+
+#define csr_clear(csr,val) \
+({ \
+ typeof(val) __v = (val); \
+ if (CSR_ZIMM(__v)) { \
+ __asm__ __volatile__ ( \
+ "csrc " #csr ", %0" : : "i" (__v)); \
+ } else { \
+ __asm__ __volatile__ ( \
+ "csrc " #csr ", %0" : : "r" (__v)); \
+ } \
+})
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_RISCV_CSR_H */
diff --git a/linux-headers/include/asm/errno.h b/linux-headers/include/asm/errno.h
new file mode 100644
index 0000000..4c82b50
--- /dev/null
+++ b/linux-headers/include/asm/errno.h
@@ -0,0 +1 @@
+#include <asm-generic/errno.h>
diff --git a/linux-headers/include/asm/fcntl.h b/linux-headers/include/asm/fcntl.h
new file mode 100644
index 0000000..46ab12d
--- /dev/null
+++ b/linux-headers/include/asm/fcntl.h
@@ -0,0 +1 @@
+#include <asm-generic/fcntl.h>
diff --git a/linux-headers/include/asm/ioctl.h b/linux-headers/include/asm/ioctl.h
new file mode 100644
index 0000000..b279fe0
--- /dev/null
+++ b/linux-headers/include/asm/ioctl.h
@@ -0,0 +1 @@
+#include <asm-generic/ioctl.h>
diff --git a/linux-headers/include/asm/ioctls.h b/linux-headers/include/asm/ioctls.h
new file mode 100644
index 0000000..ec34c76
--- /dev/null
+++ b/linux-headers/include/asm/ioctls.h
@@ -0,0 +1 @@
+#include <asm-generic/ioctls.h>
diff --git a/linux-headers/include/asm/ipcbuf.h b/linux-headers/include/asm/ipcbuf.h
new file mode 100644
index 0000000..84c7e51
--- /dev/null
+++ b/linux-headers/include/asm/ipcbuf.h
@@ -0,0 +1 @@
+#include <asm-generic/ipcbuf.h>
diff --git a/linux-headers/include/asm/mman.h b/linux-headers/include/asm/mman.h
new file mode 100644
index 0000000..8eebf89
--- /dev/null
+++ b/linux-headers/include/asm/mman.h
@@ -0,0 +1 @@
+#include <asm-generic/mman.h>
diff --git a/linux-headers/include/asm/msgbuf.h b/linux-headers/include/asm/msgbuf.h
new file mode 100644
index 0000000..809134c
--- /dev/null
+++ b/linux-headers/include/asm/msgbuf.h
@@ -0,0 +1 @@
+#include <asm-generic/msgbuf.h>
diff --git a/linux-headers/include/asm/param.h b/linux-headers/include/asm/param.h
new file mode 100644
index 0000000..965d454
--- /dev/null
+++ b/linux-headers/include/asm/param.h
@@ -0,0 +1 @@
+#include <asm-generic/param.h>
diff --git a/linux-headers/include/asm/poll.h b/linux-headers/include/asm/poll.h
new file mode 100644
index 0000000..c98509d
--- /dev/null
+++ b/linux-headers/include/asm/poll.h
@@ -0,0 +1 @@
+#include <asm-generic/poll.h>
diff --git a/linux-headers/include/asm/posix_types.h b/linux-headers/include/asm/posix_types.h
new file mode 100644
index 0000000..22cae62
--- /dev/null
+++ b/linux-headers/include/asm/posix_types.h
@@ -0,0 +1 @@
+#include <asm-generic/posix_types.h>
diff --git a/linux-headers/include/asm/ptrace.h b/linux-headers/include/asm/ptrace.h
new file mode 100644
index 0000000..054d8bf
--- /dev/null
+++ b/linux-headers/include/asm/ptrace.h
@@ -0,0 +1,76 @@
+#ifndef _ASM_RISCV_PTRACE_H
+#define _ASM_RISCV_PTRACE_H
+
+#include <asm/csr.h>
+
+#ifndef __ASSEMBLY__
+
+typedef struct pt_regs {
+ unsigned long zero;
+ unsigned long ra;
+ unsigned long s[12];
+ unsigned long sp;
+ unsigned long tp;
+ unsigned long v[2];
+ unsigned long a[8];
+ unsigned long t[5];
+ unsigned long gp;
+ /* PCRs */
+ unsigned long status;
+ unsigned long epc;
+ unsigned long badvaddr;
+ unsigned long cause;
+ /* For restarting system calls */
+ unsigned long syscallno;
+} pt_regs;
+
+#define user_mode(regs) (((regs)->status & SR_PS) == 0)
+
+
+/* Helpers for working with the instruction pointer */
+#define GET_IP(regs) ((regs)->epc)
+#define SET_IP(regs, val) (GET_IP(regs) = (val))
+
+static __inline__ unsigned long instruction_pointer(struct pt_regs *regs)
+{
+ return GET_IP(regs);
+}
+static __inline__ void instruction_pointer_set(struct pt_regs *regs,
+ unsigned long val)
+{
+ SET_IP(regs, val);
+}
+
+#define profile_pc(regs) instruction_pointer(regs)
+
+/* Helpers for working with the user stack pointer */
+#define GET_USP(regs) ((regs)->sp)
+#define SET_USP(regs, val) (GET_USP(regs) = (val))
+
+static __inline__ unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+ return GET_USP(regs);
+}
+static __inline__ void user_stack_pointer_set(struct pt_regs *regs,
+ unsigned long val)
+{
+ SET_USP(regs, val);
+}
+
+/* Helpers for working with the frame pointer */
+#define GET_FP(regs) ((regs)->s[0])
+#define SET_FP(regs, val) (GET_FP(regs) = (val))
+
+static __inline__ unsigned long frame_pointer(struct pt_regs *regs)
+{
+ return GET_FP(regs);
+}
+static __inline__ void frame_pointer_set(struct pt_regs *regs,
+ unsigned long val)
+{
+ SET_FP(regs, val);
+}
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_RISCV_PTRACE_H */
diff --git a/linux-headers/include/asm/resource.h b/linux-headers/include/asm/resource.h
new file mode 100644
index 0000000..04bc4db
--- /dev/null
+++ b/linux-headers/include/asm/resource.h
@@ -0,0 +1 @@
+#include <asm-generic/resource.h>
diff --git a/linux-headers/include/asm/sembuf.h b/linux-headers/include/asm/sembuf.h
new file mode 100644
index 0000000..7673b83
--- /dev/null
+++ b/linux-headers/include/asm/sembuf.h
@@ -0,0 +1 @@
+#include <asm-generic/sembuf.h>
diff --git a/linux-headers/include/asm/setup.h b/linux-headers/include/asm/setup.h
new file mode 100644
index 0000000..8ee375d
--- /dev/null
+++ b/linux-headers/include/asm/setup.h
@@ -0,0 +1,7 @@
+#ifndef _ASM_RISCV_SETUP_H
+#define _ASM_RISCV_SETUP_H
+
+
+#include <asm-generic/setup.h>
+
+#endif /* _ASM_RISCV_SETUP_H */
diff --git a/linux-headers/include/asm/shmbuf.h b/linux-headers/include/asm/shmbuf.h
new file mode 100644
index 0000000..83c05fc
--- /dev/null
+++ b/linux-headers/include/asm/shmbuf.h
@@ -0,0 +1 @@
+#include <asm-generic/shmbuf.h>
diff --git a/linux-headers/include/asm/sigcontext.h b/linux-headers/include/asm/sigcontext.h
new file mode 100644
index 0000000..6d89223
--- /dev/null
+++ b/linux-headers/include/asm/sigcontext.h
@@ -0,0 +1,21 @@
+#ifndef __ASM_RISCV_SIGCONTEXT_H
+#define __ASM_RISCV_SIGCONTEXT_H
+
+/* This struct is saved by setup_frame in signal.c, to keep the current
+ * context while a signal handler is executed. It is restored by sys_sigreturn.
+ */
+
+struct sigcontext {
+ unsigned long zero;
+ unsigned long ra;
+ unsigned long s[12];
+ unsigned long sp;
+ unsigned long tp;
+ unsigned long v[2];
+ unsigned long a[8];
+ unsigned long t[5];
+ unsigned long gp;
+ unsigned long epc;
+};
+
+#endif /* __ASM_RISCV_SIGCONTEXT_H */
diff --git a/linux-headers/include/asm/siginfo.h b/linux-headers/include/asm/siginfo.h
new file mode 100644
index 0000000..0815d29
--- /dev/null
+++ b/linux-headers/include/asm/siginfo.h
@@ -0,0 +1 @@
+#include <asm-generic/siginfo.h>
diff --git a/linux-headers/include/asm/signal.h b/linux-headers/include/asm/signal.h
new file mode 100644
index 0000000..7b1573c
--- /dev/null
+++ b/linux-headers/include/asm/signal.h
@@ -0,0 +1 @@
+#include <asm-generic/signal.h>
diff --git a/linux-headers/include/asm/socket.h b/linux-headers/include/asm/socket.h
new file mode 100644
index 0000000..6b71384
--- /dev/null
+++ b/linux-headers/include/asm/socket.h
@@ -0,0 +1 @@
+#include <asm-generic/socket.h>
diff --git a/linux-headers/include/asm/sockios.h b/linux-headers/include/asm/sockios.h
new file mode 100644
index 0000000..def6d47
--- /dev/null
+++ b/linux-headers/include/asm/sockios.h
@@ -0,0 +1 @@
+#include <asm-generic/sockios.h>
diff --git a/linux-headers/include/asm/stat.h b/linux-headers/include/asm/stat.h
new file mode 100644
index 0000000..3dc90fa
--- /dev/null
+++ b/linux-headers/include/asm/stat.h
@@ -0,0 +1 @@
+#include <asm-generic/stat.h>
diff --git a/linux-headers/include/asm/statfs.h b/linux-headers/include/asm/statfs.h
new file mode 100644
index 0000000..0b91fe1
--- /dev/null
+++ b/linux-headers/include/asm/statfs.h
@@ -0,0 +1 @@
+#include <asm-generic/statfs.h>
diff --git a/linux-headers/include/asm/swab.h b/linux-headers/include/asm/swab.h
new file mode 100644
index 0000000..7847e56
--- /dev/null
+++ b/linux-headers/include/asm/swab.h
@@ -0,0 +1 @@
+#include <asm-generic/swab.h>
diff --git a/linux-headers/include/asm/termbits.h b/linux-headers/include/asm/termbits.h
new file mode 100644
index 0000000..3935b10
--- /dev/null
+++ b/linux-headers/include/asm/termbits.h
@@ -0,0 +1 @@
+#include <asm-generic/termbits.h>
diff --git a/linux-headers/include/asm/termios.h b/linux-headers/include/asm/termios.h
new file mode 100644
index 0000000..280d78a
--- /dev/null
+++ b/linux-headers/include/asm/termios.h
@@ -0,0 +1 @@
+#include <asm-generic/termios.h>
diff --git a/linux-headers/include/asm/types.h b/linux-headers/include/asm/types.h
new file mode 100644
index 0000000..b9e79bc
--- /dev/null
+++ b/linux-headers/include/asm/types.h
@@ -0,0 +1 @@
+#include <asm-generic/types.h>
diff --git a/linux-headers/include/asm/unistd.h b/linux-headers/include/asm/unistd.h
new file mode 100644
index 0000000..a216ab3
--- /dev/null
+++ b/linux-headers/include/asm/unistd.h
@@ -0,0 +1,29 @@
+#if !defined(_ASM_RISCV_UNISTD_H) || defined(__SYSCALL)
+#define _ASM_RISCV_UNISTD_H
+
+#define __ARCH_HAVE_MMU
+#define __ARCH_WANT_SYSCALL_NO_AT
+#define __ARCH_WANT_SYSCALL_DEPRECATED
+#define __ARCH_WANT_SYSCALL_OFF_T
+#define __ARCH_WANT_SYSCALL_NO_FLAGS
+
+#define __ARCH_WANT_SYS_EXECVE
+#define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_SYS_VFORK
+#define __ARCH_WANT_SYS_FORK
+
+#include <asm-generic/unistd.h>
+
+#define __NR_sysriscv __NR_arch_specific_syscall
+#ifdef CONFIG_RV_SYSRISCV_ATOMIC
+__SYSCALL(__NR_sysriscv, sys_sysriscv)
+#endif
+
+#define __NR_ipc 1080
+#undef __NR_syscalls
+#define __NR_syscalls (__NR_ipc + 1)
+
+#define RISCV_ATOMIC_CMPXCHG 1
+#define RISCV_ATOMIC_CMPXCHG64 2
+
+#endif /* _ASM_RISCV_UNISTD_H */
diff --git a/linux-headers/include/asm/user.h b/linux-headers/include/asm/user.h
new file mode 100644
index 0000000..e1a8ee2
--- /dev/null
+++ b/linux-headers/include/asm/user.h
@@ -0,0 +1,19 @@
+#ifndef _ASM_RISCV_USER_H
+#define _ASM_RISCV_USER_H
+
+/* Mirror pt_regs from ptrace.h */
+
+typedef struct user_regs_struct {
+ unsigned long zero;
+ unsigned long ra;
+ unsigned long s[12];
+ unsigned long sp;
+ unsigned long tp;
+ unsigned long v[2];
+ unsigned long a[8];
+ unsigned long t[5];
+ unsigned long gp;
+ unsigned long status;
+} user_regs_struct;
+
+#endif /* _ASM_RISCV_USER_H */
diff --git a/linux-headers/include/asm/vdso.h b/linux-headers/include/asm/vdso.h
new file mode 100644
index 0000000..b5ca21c
--- /dev/null
+++ b/linux-headers/include/asm/vdso.h
@@ -0,0 +1,15 @@
+#ifndef _ASM_RISCV_VDSO_H
+#define _ASM_RISCV_VDSO_H
+
+#include <linux/types.h>
+
+struct vdso_data {
+};
+
+#define VDSO_SYMBOL(base, name) \
+({ \
+ extern const char __vdso_##name[]; \
+ (void *)((unsigned long)(base) + __vdso_##name); \
+})
+
+#endif /* _ASM_RISCV_VDSO_H */