From ecd9d2d6a2805e88eae428d1cc5656ee4d69d866 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 30 Sep 2022 21:35:16 +0000 Subject: Regenerate the v5.19 kernel headers to include riscv. Kernel headers coming from the same source as the previous commit: Git: https://android.googlesource.com/kernel/common/ Branch: android-mainline Tag: android-mainline-5.19 Signed-off-by: Mao Han Signed-off-by: Xia Lifang Signed-off-by: Chen Guoyin Signed-off-by: Wang Chen Signed-off-by: Lu Xufan Test: NA Change-Id: Iec6299f42a3599dfcb0f0df0cd9762ee2731a6b0 --- original/uapi/asm-riscv/asm/auxvec.h | 37 +++++++ original/uapi/asm-riscv/asm/bitsperlong.h | 14 +++ original/uapi/asm-riscv/asm/bpf_perf_event.h | 9 ++ original/uapi/asm-riscv/asm/byteorder.h | 12 +++ original/uapi/asm-riscv/asm/elf.h | 98 ++++++++++++++++++ original/uapi/asm-riscv/asm/errno.h | 1 + original/uapi/asm-riscv/asm/fcntl.h | 1 + original/uapi/asm-riscv/asm/hwcap.h | 25 +++++ original/uapi/asm-riscv/asm/ioctl.h | 1 + original/uapi/asm-riscv/asm/ioctls.h | 1 + original/uapi/asm-riscv/asm/ipcbuf.h | 1 + original/uapi/asm-riscv/asm/kvm.h | 148 +++++++++++++++++++++++++++ original/uapi/asm-riscv/asm/mman.h | 1 + original/uapi/asm-riscv/asm/msgbuf.h | 1 + original/uapi/asm-riscv/asm/param.h | 1 + original/uapi/asm-riscv/asm/perf_regs.h | 42 ++++++++ original/uapi/asm-riscv/asm/poll.h | 1 + original/uapi/asm-riscv/asm/posix_types.h | 1 + original/uapi/asm-riscv/asm/ptrace.h | 82 +++++++++++++++ original/uapi/asm-riscv/asm/resource.h | 1 + original/uapi/asm-riscv/asm/sembuf.h | 1 + original/uapi/asm-riscv/asm/setup.h | 1 + original/uapi/asm-riscv/asm/shmbuf.h | 1 + original/uapi/asm-riscv/asm/sigcontext.h | 22 ++++ original/uapi/asm-riscv/asm/siginfo.h | 1 + original/uapi/asm-riscv/asm/signal.h | 1 + original/uapi/asm-riscv/asm/socket.h | 1 + original/uapi/asm-riscv/asm/sockios.h | 1 + original/uapi/asm-riscv/asm/stat.h | 1 + original/uapi/asm-riscv/asm/statfs.h | 1 + original/uapi/asm-riscv/asm/swab.h | 1 + original/uapi/asm-riscv/asm/termbits.h | 1 + original/uapi/asm-riscv/asm/termios.h | 1 + original/uapi/asm-riscv/asm/types.h | 1 + original/uapi/asm-riscv/asm/ucontext.h | 34 ++++++ original/uapi/asm-riscv/asm/unistd.h | 45 ++++++++ 36 files changed, 592 insertions(+) create mode 100644 original/uapi/asm-riscv/asm/auxvec.h create mode 100644 original/uapi/asm-riscv/asm/bitsperlong.h create mode 100644 original/uapi/asm-riscv/asm/bpf_perf_event.h create mode 100644 original/uapi/asm-riscv/asm/byteorder.h create mode 100644 original/uapi/asm-riscv/asm/elf.h create mode 100644 original/uapi/asm-riscv/asm/errno.h create mode 100644 original/uapi/asm-riscv/asm/fcntl.h create mode 100644 original/uapi/asm-riscv/asm/hwcap.h create mode 100644 original/uapi/asm-riscv/asm/ioctl.h create mode 100644 original/uapi/asm-riscv/asm/ioctls.h create mode 100644 original/uapi/asm-riscv/asm/ipcbuf.h create mode 100644 original/uapi/asm-riscv/asm/kvm.h create mode 100644 original/uapi/asm-riscv/asm/mman.h create mode 100644 original/uapi/asm-riscv/asm/msgbuf.h create mode 100644 original/uapi/asm-riscv/asm/param.h create mode 100644 original/uapi/asm-riscv/asm/perf_regs.h create mode 100644 original/uapi/asm-riscv/asm/poll.h create mode 100644 original/uapi/asm-riscv/asm/posix_types.h create mode 100644 original/uapi/asm-riscv/asm/ptrace.h create mode 100644 original/uapi/asm-riscv/asm/resource.h create mode 100644 original/uapi/asm-riscv/asm/sembuf.h create mode 100644 original/uapi/asm-riscv/asm/setup.h create mode 100644 original/uapi/asm-riscv/asm/shmbuf.h create mode 100644 original/uapi/asm-riscv/asm/sigcontext.h create mode 100644 original/uapi/asm-riscv/asm/siginfo.h create mode 100644 original/uapi/asm-riscv/asm/signal.h create mode 100644 original/uapi/asm-riscv/asm/socket.h create mode 100644 original/uapi/asm-riscv/asm/sockios.h create mode 100644 original/uapi/asm-riscv/asm/stat.h create mode 100644 original/uapi/asm-riscv/asm/statfs.h create mode 100644 original/uapi/asm-riscv/asm/swab.h create mode 100644 original/uapi/asm-riscv/asm/termbits.h create mode 100644 original/uapi/asm-riscv/asm/termios.h create mode 100644 original/uapi/asm-riscv/asm/types.h create mode 100644 original/uapi/asm-riscv/asm/ucontext.h create mode 100644 original/uapi/asm-riscv/asm/unistd.h diff --git a/original/uapi/asm-riscv/asm/auxvec.h b/original/uapi/asm-riscv/asm/auxvec.h new file mode 100644 index 0000000..32c73ba --- /dev/null +++ b/original/uapi/asm-riscv/asm/auxvec.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2015 Regents of the University of California + */ + +#ifndef _UAPI_ASM_RISCV_AUXVEC_H +#define _UAPI_ASM_RISCV_AUXVEC_H + +/* vDSO location */ +#define AT_SYSINFO_EHDR 33 + +/* + * The set of entries below represent more extensive information + * about the caches, in the form of two entry per cache type, + * one entry containing the cache size in bytes, and the other + * containing the cache line size in bytes in the bottom 16 bits + * and the cache associativity in the next 16 bits. + * + * The associativity is such that if N is the 16-bit value, the + * cache is N way set associative. A value if 0xffff means fully + * associative, a value of 1 means directly mapped. + * + * For all these fields, a value of 0 means that the information + * is not known. + */ +#define AT_L1I_CACHESIZE 40 +#define AT_L1I_CACHEGEOMETRY 41 +#define AT_L1D_CACHESIZE 42 +#define AT_L1D_CACHEGEOMETRY 43 +#define AT_L2_CACHESIZE 44 +#define AT_L2_CACHEGEOMETRY 45 + +/* entries in ARCH_DLINFO */ +#define AT_VECTOR_SIZE_ARCH 7 + +#endif /* _UAPI_ASM_RISCV_AUXVEC_H */ diff --git a/original/uapi/asm-riscv/asm/bitsperlong.h b/original/uapi/asm-riscv/asm/bitsperlong.h new file mode 100644 index 0000000..7d0b32e --- /dev/null +++ b/original/uapi/asm-riscv/asm/bitsperlong.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2015 Regents of the University of California + */ + +#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H +#define _UAPI_ASM_RISCV_BITSPERLONG_H + +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8) + +#include + +#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */ diff --git a/original/uapi/asm-riscv/asm/bpf_perf_event.h b/original/uapi/asm-riscv/asm/bpf_perf_event.h new file mode 100644 index 0000000..6cb1c28 --- /dev/null +++ b/original/uapi/asm-riscv/asm/bpf_perf_event.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ +#define _UAPI__ASM_BPF_PERF_EVENT_H__ + +#include + +typedef struct user_regs_struct bpf_user_pt_regs_t; + +#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */ diff --git a/original/uapi/asm-riscv/asm/byteorder.h b/original/uapi/asm-riscv/asm/byteorder.h new file mode 100644 index 0000000..f671e16 --- /dev/null +++ b/original/uapi/asm-riscv/asm/byteorder.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2015 Regents of the University of California + */ + +#ifndef _UAPI_ASM_RISCV_BYTEORDER_H +#define _UAPI_ASM_RISCV_BYTEORDER_H + +#include + +#endif /* _UAPI_ASM_RISCV_BYTEORDER_H */ diff --git a/original/uapi/asm-riscv/asm/elf.h b/original/uapi/asm-riscv/asm/elf.h new file mode 100644 index 0000000..d696d66 --- /dev/null +++ b/original/uapi/asm-riscv/asm/elf.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2003 Matjaz Breskvar + * Copyright (C) 2010-2011 Jonas Bonn + * Copyright (C) 2012 Regents of the University of California + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef _UAPI_ASM_RISCV_ELF_H +#define _UAPI_ASM_RISCV_ELF_H + +#include + +/* ELF register definitions */ +typedef unsigned long elf_greg_t; +typedef struct user_regs_struct elf_gregset_t; +#define ELF_NGREG (sizeof(elf_gregset_t) / sizeof(elf_greg_t)) + +/* We don't support f without d, or q. */ +typedef __u64 elf_fpreg_t; +typedef union __riscv_fp_state elf_fpregset_t; +#define ELF_NFPREG (sizeof(struct __riscv_d_ext_state) / sizeof(elf_fpreg_t)) + +#if __riscv_xlen == 64 +#define ELF_RISCV_R_SYM(r_info) ELF64_R_SYM(r_info) +#define ELF_RISCV_R_TYPE(r_info) ELF64_R_TYPE(r_info) +#else +#define ELF_RISCV_R_SYM(r_info) ELF32_R_SYM(r_info) +#define ELF_RISCV_R_TYPE(r_info) ELF32_R_TYPE(r_info) +#endif + +/* + * RISC-V relocation types + */ + +/* Relocation types used by the dynamic linker */ +#define R_RISCV_NONE 0 +#define R_RISCV_32 1 +#define R_RISCV_64 2 +#define R_RISCV_RELATIVE 3 +#define R_RISCV_COPY 4 +#define R_RISCV_JUMP_SLOT 5 +#define R_RISCV_TLS_DTPMOD32 6 +#define R_RISCV_TLS_DTPMOD64 7 +#define R_RISCV_TLS_DTPREL32 8 +#define R_RISCV_TLS_DTPREL64 9 +#define R_RISCV_TLS_TPREL32 10 +#define R_RISCV_TLS_TPREL64 11 + +/* Relocation types not used by the dynamic linker */ +#define R_RISCV_BRANCH 16 +#define R_RISCV_JAL 17 +#define R_RISCV_CALL 18 +#define R_RISCV_CALL_PLT 19 +#define R_RISCV_GOT_HI20 20 +#define R_RISCV_TLS_GOT_HI20 21 +#define R_RISCV_TLS_GD_HI20 22 +#define R_RISCV_PCREL_HI20 23 +#define R_RISCV_PCREL_LO12_I 24 +#define R_RISCV_PCREL_LO12_S 25 +#define R_RISCV_HI20 26 +#define R_RISCV_LO12_I 27 +#define R_RISCV_LO12_S 28 +#define R_RISCV_TPREL_HI20 29 +#define R_RISCV_TPREL_LO12_I 30 +#define R_RISCV_TPREL_LO12_S 31 +#define R_RISCV_TPREL_ADD 32 +#define R_RISCV_ADD8 33 +#define R_RISCV_ADD16 34 +#define R_RISCV_ADD32 35 +#define R_RISCV_ADD64 36 +#define R_RISCV_SUB8 37 +#define R_RISCV_SUB16 38 +#define R_RISCV_SUB32 39 +#define R_RISCV_SUB64 40 +#define R_RISCV_GNU_VTINHERIT 41 +#define R_RISCV_GNU_VTENTRY 42 +#define R_RISCV_ALIGN 43 +#define R_RISCV_RVC_BRANCH 44 +#define R_RISCV_RVC_JUMP 45 +#define R_RISCV_LUI 46 +#define R_RISCV_GPREL_I 47 +#define R_RISCV_GPREL_S 48 +#define R_RISCV_TPREL_I 49 +#define R_RISCV_TPREL_S 50 +#define R_RISCV_RELAX 51 +#define R_RISCV_SUB6 52 +#define R_RISCV_SET6 53 +#define R_RISCV_SET8 54 +#define R_RISCV_SET16 55 +#define R_RISCV_SET32 56 +#define R_RISCV_32_PCREL 57 + + +#endif /* _UAPI_ASM_RISCV_ELF_H */ diff --git a/original/uapi/asm-riscv/asm/errno.h b/original/uapi/asm-riscv/asm/errno.h new file mode 100644 index 0000000..4c82b50 --- /dev/null +++ b/original/uapi/asm-riscv/asm/errno.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/fcntl.h b/original/uapi/asm-riscv/asm/fcntl.h new file mode 100644 index 0000000..46ab12d --- /dev/null +++ b/original/uapi/asm-riscv/asm/fcntl.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/hwcap.h b/original/uapi/asm-riscv/asm/hwcap.h new file mode 100644 index 0000000..46dc3f5 --- /dev/null +++ b/original/uapi/asm-riscv/asm/hwcap.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copied from arch/arm64/include/asm/hwcap.h + * + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2017 SiFive + */ +#ifndef _UAPI_ASM_RISCV_HWCAP_H +#define _UAPI_ASM_RISCV_HWCAP_H + +/* + * Linux saves the floating-point registers according to the ISA Linux is + * executing on, as opposed to the ISA the user program is compiled for. This + * is necessary for a handful of esoteric use cases: for example, userspace + * threading libraries must be able to examine the actual machine state in + * order to fully reconstruct the state of a thread. + */ +#define COMPAT_HWCAP_ISA_I (1 << ('I' - 'A')) +#define COMPAT_HWCAP_ISA_M (1 << ('M' - 'A')) +#define COMPAT_HWCAP_ISA_A (1 << ('A' - 'A')) +#define COMPAT_HWCAP_ISA_F (1 << ('F' - 'A')) +#define COMPAT_HWCAP_ISA_D (1 << ('D' - 'A')) +#define COMPAT_HWCAP_ISA_C (1 << ('C' - 'A')) + +#endif /* _UAPI_ASM_RISCV_HWCAP_H */ diff --git a/original/uapi/asm-riscv/asm/ioctl.h b/original/uapi/asm-riscv/asm/ioctl.h new file mode 100644 index 0000000..b279fe0 --- /dev/null +++ b/original/uapi/asm-riscv/asm/ioctl.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/ioctls.h b/original/uapi/asm-riscv/asm/ioctls.h new file mode 100644 index 0000000..ec34c76 --- /dev/null +++ b/original/uapi/asm-riscv/asm/ioctls.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/ipcbuf.h b/original/uapi/asm-riscv/asm/ipcbuf.h new file mode 100644 index 0000000..84c7e51 --- /dev/null +++ b/original/uapi/asm-riscv/asm/ipcbuf.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/kvm.h b/original/uapi/asm-riscv/asm/kvm.h new file mode 100644 index 0000000..6119368 --- /dev/null +++ b/original/uapi/asm-riscv/asm/kvm.h @@ -0,0 +1,148 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (C) 2019 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#ifndef __LINUX_KVM_RISCV_H +#define __LINUX_KVM_RISCV_H + +#ifndef __ASSEMBLY__ + +#include +#include + +#define __KVM_HAVE_READONLY_MEM + +#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 + +#define KVM_INTERRUPT_SET -1U +#define KVM_INTERRUPT_UNSET -2U + +/* for KVM_GET_REGS and KVM_SET_REGS */ +struct kvm_regs { +}; + +/* for KVM_GET_FPU and KVM_SET_FPU */ +struct kvm_fpu { +}; + +/* KVM Debug exit structure */ +struct kvm_debug_exit_arch { +}; + +/* for KVM_SET_GUEST_DEBUG */ +struct kvm_guest_debug_arch { +}; + +/* definition of registers in kvm_run */ +struct kvm_sync_regs { +}; + +/* for KVM_GET_SREGS and KVM_SET_SREGS */ +struct kvm_sregs { +}; + +/* CONFIG registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ +struct kvm_riscv_config { + unsigned long isa; +}; + +/* CORE registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ +struct kvm_riscv_core { + struct user_regs_struct regs; + unsigned long mode; +}; + +/* Possible privilege modes for kvm_riscv_core */ +#define KVM_RISCV_MODE_S 1 +#define KVM_RISCV_MODE_U 0 + +/* CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ +struct kvm_riscv_csr { + unsigned long sstatus; + unsigned long sie; + unsigned long stvec; + unsigned long sscratch; + unsigned long sepc; + unsigned long scause; + unsigned long stval; + unsigned long sip; + unsigned long satp; + unsigned long scounteren; +}; + +/* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ +struct kvm_riscv_timer { + __u64 frequency; + __u64 time; + __u64 compare; + __u64 state; +}; + +/* + * ISA extension IDs specific to KVM. This is not the same as the host ISA + * extension IDs as that is internal to the host and should not be exposed + * to the guest. This should always be contiguous to keep the mapping simple + * in KVM implementation. + */ +enum KVM_RISCV_ISA_EXT_ID { + KVM_RISCV_ISA_EXT_A = 0, + KVM_RISCV_ISA_EXT_C, + KVM_RISCV_ISA_EXT_D, + KVM_RISCV_ISA_EXT_F, + KVM_RISCV_ISA_EXT_H, + KVM_RISCV_ISA_EXT_I, + KVM_RISCV_ISA_EXT_M, + KVM_RISCV_ISA_EXT_MAX, +}; + +/* Possible states for kvm_riscv_timer */ +#define KVM_RISCV_TIMER_STATE_OFF 0 +#define KVM_RISCV_TIMER_STATE_ON 1 + +#define KVM_REG_SIZE(id) \ + (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) + +/* If you need to interpret the index values, here is the key: */ +#define KVM_REG_RISCV_TYPE_MASK 0x00000000FF000000 +#define KVM_REG_RISCV_TYPE_SHIFT 24 + +/* Config registers are mapped as type 1 */ +#define KVM_REG_RISCV_CONFIG (0x01 << KVM_REG_RISCV_TYPE_SHIFT) +#define KVM_REG_RISCV_CONFIG_REG(name) \ + (offsetof(struct kvm_riscv_config, name) / sizeof(unsigned long)) + +/* Core registers are mapped as type 2 */ +#define KVM_REG_RISCV_CORE (0x02 << KVM_REG_RISCV_TYPE_SHIFT) +#define KVM_REG_RISCV_CORE_REG(name) \ + (offsetof(struct kvm_riscv_core, name) / sizeof(unsigned long)) + +/* Control and status registers are mapped as type 3 */ +#define KVM_REG_RISCV_CSR (0x03 << KVM_REG_RISCV_TYPE_SHIFT) +#define KVM_REG_RISCV_CSR_REG(name) \ + (offsetof(struct kvm_riscv_csr, name) / sizeof(unsigned long)) + +/* Timer registers are mapped as type 4 */ +#define KVM_REG_RISCV_TIMER (0x04 << KVM_REG_RISCV_TYPE_SHIFT) +#define KVM_REG_RISCV_TIMER_REG(name) \ + (offsetof(struct kvm_riscv_timer, name) / sizeof(__u64)) + +/* F extension registers are mapped as type 5 */ +#define KVM_REG_RISCV_FP_F (0x05 << KVM_REG_RISCV_TYPE_SHIFT) +#define KVM_REG_RISCV_FP_F_REG(name) \ + (offsetof(struct __riscv_f_ext_state, name) / sizeof(__u32)) + +/* D extension registers are mapped as type 6 */ +#define KVM_REG_RISCV_FP_D (0x06 << KVM_REG_RISCV_TYPE_SHIFT) +#define KVM_REG_RISCV_FP_D_REG(name) \ + (offsetof(struct __riscv_d_ext_state, name) / sizeof(__u64)) + +/* ISA Extension registers are mapped as type 7 */ +#define KVM_REG_RISCV_ISA_EXT (0x07 << KVM_REG_RISCV_TYPE_SHIFT) + +#endif + +#endif /* __LINUX_KVM_RISCV_H */ diff --git a/original/uapi/asm-riscv/asm/mman.h b/original/uapi/asm-riscv/asm/mman.h new file mode 100644 index 0000000..8eebf89 --- /dev/null +++ b/original/uapi/asm-riscv/asm/mman.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/msgbuf.h b/original/uapi/asm-riscv/asm/msgbuf.h new file mode 100644 index 0000000..809134c --- /dev/null +++ b/original/uapi/asm-riscv/asm/msgbuf.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/param.h b/original/uapi/asm-riscv/asm/param.h new file mode 100644 index 0000000..965d454 --- /dev/null +++ b/original/uapi/asm-riscv/asm/param.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/perf_regs.h b/original/uapi/asm-riscv/asm/perf_regs.h new file mode 100644 index 0000000..196f964 --- /dev/null +++ b/original/uapi/asm-riscv/asm/perf_regs.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. */ + +#ifndef _ASM_RISCV_PERF_REGS_H +#define _ASM_RISCV_PERF_REGS_H + +enum perf_event_riscv_regs { + PERF_REG_RISCV_PC, + PERF_REG_RISCV_RA, + PERF_REG_RISCV_SP, + PERF_REG_RISCV_GP, + PERF_REG_RISCV_TP, + PERF_REG_RISCV_T0, + PERF_REG_RISCV_T1, + PERF_REG_RISCV_T2, + PERF_REG_RISCV_S0, + PERF_REG_RISCV_S1, + PERF_REG_RISCV_A0, + PERF_REG_RISCV_A1, + PERF_REG_RISCV_A2, + PERF_REG_RISCV_A3, + PERF_REG_RISCV_A4, + PERF_REG_RISCV_A5, + PERF_REG_RISCV_A6, + PERF_REG_RISCV_A7, + PERF_REG_RISCV_S2, + PERF_REG_RISCV_S3, + PERF_REG_RISCV_S4, + PERF_REG_RISCV_S5, + PERF_REG_RISCV_S6, + PERF_REG_RISCV_S7, + PERF_REG_RISCV_S8, + PERF_REG_RISCV_S9, + PERF_REG_RISCV_S10, + PERF_REG_RISCV_S11, + PERF_REG_RISCV_T3, + PERF_REG_RISCV_T4, + PERF_REG_RISCV_T5, + PERF_REG_RISCV_T6, + PERF_REG_RISCV_MAX, +}; +#endif /* _ASM_RISCV_PERF_REGS_H */ diff --git a/original/uapi/asm-riscv/asm/poll.h b/original/uapi/asm-riscv/asm/poll.h new file mode 100644 index 0000000..c98509d --- /dev/null +++ b/original/uapi/asm-riscv/asm/poll.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/posix_types.h b/original/uapi/asm-riscv/asm/posix_types.h new file mode 100644 index 0000000..22cae62 --- /dev/null +++ b/original/uapi/asm-riscv/asm/posix_types.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/ptrace.h b/original/uapi/asm-riscv/asm/ptrace.h new file mode 100644 index 0000000..882547f --- /dev/null +++ b/original/uapi/asm-riscv/asm/ptrace.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 Regents of the University of California + */ + +#ifndef _UAPI_ASM_RISCV_PTRACE_H +#define _UAPI_ASM_RISCV_PTRACE_H + +#ifndef __ASSEMBLY__ + +#include + +/* + * User-mode register state for core dumps, ptrace, sigcontext + * + * This decouples struct pt_regs from the userspace ABI. + * struct user_regs_struct must form a prefix of struct pt_regs. + */ +struct user_regs_struct { + unsigned long pc; + unsigned long ra; + unsigned long sp; + unsigned long gp; + unsigned long tp; + unsigned long t0; + unsigned long t1; + unsigned long t2; + unsigned long s0; + unsigned long s1; + unsigned long a0; + unsigned long a1; + unsigned long a2; + unsigned long a3; + unsigned long a4; + unsigned long a5; + unsigned long a6; + unsigned long a7; + unsigned long s2; + unsigned long s3; + unsigned long s4; + unsigned long s5; + unsigned long s6; + unsigned long s7; + unsigned long s8; + unsigned long s9; + unsigned long s10; + unsigned long s11; + unsigned long t3; + unsigned long t4; + unsigned long t5; + unsigned long t6; +}; + +struct __riscv_f_ext_state { + __u32 f[32]; + __u32 fcsr; +}; + +struct __riscv_d_ext_state { + __u64 f[32]; + __u32 fcsr; +}; + +struct __riscv_q_ext_state { + __u64 f[64] __attribute__((aligned(16))); + __u32 fcsr; + /* + * Reserved for expansion of sigcontext structure. Currently zeroed + * upon signal, and must be zero upon sigreturn. + */ + __u32 reserved[3]; +}; + +union __riscv_fp_state { + struct __riscv_f_ext_state f; + struct __riscv_d_ext_state d; + struct __riscv_q_ext_state q; +}; + +#endif /* __ASSEMBLY__ */ + +#endif /* _UAPI_ASM_RISCV_PTRACE_H */ diff --git a/original/uapi/asm-riscv/asm/resource.h b/original/uapi/asm-riscv/asm/resource.h new file mode 100644 index 0000000..04bc4db --- /dev/null +++ b/original/uapi/asm-riscv/asm/resource.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/sembuf.h b/original/uapi/asm-riscv/asm/sembuf.h new file mode 100644 index 0000000..7673b83 --- /dev/null +++ b/original/uapi/asm-riscv/asm/sembuf.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/setup.h b/original/uapi/asm-riscv/asm/setup.h new file mode 100644 index 0000000..552df83 --- /dev/null +++ b/original/uapi/asm-riscv/asm/setup.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/shmbuf.h b/original/uapi/asm-riscv/asm/shmbuf.h new file mode 100644 index 0000000..83c05fc --- /dev/null +++ b/original/uapi/asm-riscv/asm/shmbuf.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/sigcontext.h b/original/uapi/asm-riscv/asm/sigcontext.h new file mode 100644 index 0000000..84f2dfc --- /dev/null +++ b/original/uapi/asm-riscv/asm/sigcontext.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 Regents of the University of California + */ + +#ifndef _UAPI_ASM_RISCV_SIGCONTEXT_H +#define _UAPI_ASM_RISCV_SIGCONTEXT_H + +#include + +/* + * Signal context structure + * + * This contains the context saved before a signal handler is invoked; + * it is restored by sys_sigreturn / sys_rt_sigreturn. + */ +struct sigcontext { + struct user_regs_struct sc_regs; + union __riscv_fp_state sc_fpregs; +}; + +#endif /* _UAPI_ASM_RISCV_SIGCONTEXT_H */ diff --git a/original/uapi/asm-riscv/asm/siginfo.h b/original/uapi/asm-riscv/asm/siginfo.h new file mode 100644 index 0000000..0815d29 --- /dev/null +++ b/original/uapi/asm-riscv/asm/siginfo.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/signal.h b/original/uapi/asm-riscv/asm/signal.h new file mode 100644 index 0000000..7b1573c --- /dev/null +++ b/original/uapi/asm-riscv/asm/signal.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/socket.h b/original/uapi/asm-riscv/asm/socket.h new file mode 100644 index 0000000..6b71384 --- /dev/null +++ b/original/uapi/asm-riscv/asm/socket.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/sockios.h b/original/uapi/asm-riscv/asm/sockios.h new file mode 100644 index 0000000..def6d47 --- /dev/null +++ b/original/uapi/asm-riscv/asm/sockios.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/stat.h b/original/uapi/asm-riscv/asm/stat.h new file mode 100644 index 0000000..3dc90fa --- /dev/null +++ b/original/uapi/asm-riscv/asm/stat.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/statfs.h b/original/uapi/asm-riscv/asm/statfs.h new file mode 100644 index 0000000..0b91fe1 --- /dev/null +++ b/original/uapi/asm-riscv/asm/statfs.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/swab.h b/original/uapi/asm-riscv/asm/swab.h new file mode 100644 index 0000000..7847e56 --- /dev/null +++ b/original/uapi/asm-riscv/asm/swab.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/termbits.h b/original/uapi/asm-riscv/asm/termbits.h new file mode 100644 index 0000000..3935b10 --- /dev/null +++ b/original/uapi/asm-riscv/asm/termbits.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/termios.h b/original/uapi/asm-riscv/asm/termios.h new file mode 100644 index 0000000..280d78a --- /dev/null +++ b/original/uapi/asm-riscv/asm/termios.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/types.h b/original/uapi/asm-riscv/asm/types.h new file mode 100644 index 0000000..b9e79bc --- /dev/null +++ b/original/uapi/asm-riscv/asm/types.h @@ -0,0 +1 @@ +#include diff --git a/original/uapi/asm-riscv/asm/ucontext.h b/original/uapi/asm-riscv/asm/ucontext.h new file mode 100644 index 0000000..44eb993 --- /dev/null +++ b/original/uapi/asm-riscv/asm/ucontext.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2017 SiFive, Inc. + * + * This file was copied from arch/arm64/include/uapi/asm/ucontext.h + */ +#ifndef _UAPI_ASM_RISCV_UCONTEXT_H +#define _UAPI_ASM_RISCV_UCONTEXT_H + +#include + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + /* There's some padding here to allow sigset_t to be expanded in the + * future. Though this is unlikely, other architectures put uc_sigmask + * at the end of this structure and explicitly state it can be + * expanded, so we didn't want to box ourselves in here. */ + __u8 __unused[1024 / 8 - sizeof(sigset_t)]; + /* We can't put uc_sigmask at the end of this structure because we need + * to be able to expand sigcontext in the future. For example, the + * vector ISA extension will almost certainly add ISA state. We want + * to ensure all user-visible ISA state can be saved and restored via a + * ucontext, so we're putting this at the end in order to allow for + * infinite extensibility. Since we know this will be extended and we + * assume sigset_t won't be extended an extreme amount, we're + * prioritizing this. */ + struct sigcontext uc_mcontext; +}; + +#endif /* _UAPI_ASM_RISCV_UCONTEXT_H */ diff --git a/original/uapi/asm-riscv/asm/unistd.h b/original/uapi/asm-riscv/asm/unistd.h new file mode 100644 index 0000000..73d7cdd --- /dev/null +++ b/original/uapi/asm-riscv/asm/unistd.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (C) 2018 David Abdurachmanov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if defined(__LP64__) && !defined(__SYSCALL_COMPAT) +#define __ARCH_WANT_NEW_STAT +#define __ARCH_WANT_SET_GET_RLIMIT +#endif /* __LP64__ */ + +#define __ARCH_WANT_SYS_CLONE3 +#define __ARCH_WANT_MEMFD_SECRET + +#include + +/* + * Allows the instruction cache to be flushed from userspace. Despite RISC-V + * having a direct 'fence.i' instruction available to userspace (which we + * can't trap!), that's not actually viable when running on Linux because the + * kernel might schedule a process on another hart. There is no way for + * userspace to handle this without invoking the kernel (as it doesn't know the + * thread->hart mappings), so we've defined a RISC-V specific system call to + * flush the instruction cache. + * + * __NR_riscv_flush_icache is defined to flush the instruction cache over an + * address range, with the flush applying to either all threads or just the + * caller. We don't currently do anything with the address range, that's just + * in there for forwards compatibility. + */ +#ifndef __NR_riscv_flush_icache +#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) +#endif +__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache) -- cgit v1.2.3