summaryrefslogtreecommitdiffstats
path: root/arch/riscv/include/asm/vdso.h
diff options
context:
space:
mode:
authorPalmer Dabbelt2017-07-11 03:07:09 +0200
committerPalmer Dabbelt2017-09-27 00:26:48 +0200
commite2c0cdfba7f69925afc92b20cd9835d81e11a4f1 (patch)
tree2c501638321da451423b385652183d60da02db5c /arch/riscv/include/asm/vdso.h
parentRISC-V: Paging and MMU (diff)
downloadkernel-qcow2-linux-e2c0cdfba7f69925afc92b20cd9835d81e11a4f1.tar.gz
kernel-qcow2-linux-e2c0cdfba7f69925afc92b20cd9835d81e11a4f1.tar.xz
kernel-qcow2-linux-e2c0cdfba7f69925afc92b20cd9835d81e11a4f1.zip
RISC-V: User-facing API
This patch contains code that is in some way visible to the user: including via system calls, the VDSO, module loading and signal handling. It also contains some generic code that is ABI visible. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Diffstat (limited to 'arch/riscv/include/asm/vdso.h')
-rw-r--r--arch/riscv/include/asm/vdso.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/vdso.h b/arch/riscv/include/asm/vdso.h
new file mode 100644
index 000000000000..602f61257553
--- /dev/null
+++ b/arch/riscv/include/asm/vdso.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 ARM Limited
+ * Copyright (C) 2014 Regents of the University of California
+ * Copyright (C) 2017 SiFive
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _ASM_RISCV_VDSO_H
+#define _ASM_RISCV_VDSO_H
+
+#include <linux/types.h>
+
+struct vdso_data {
+};
+
+/*
+ * The VDSO symbols are mapped into Linux so we can just use regular symbol
+ * addressing to get their offsets in userspace. The symbols are mapped at an
+ * offset of 0, but since the linker must support setting weak undefined
+ * symbols to the absolute address 0 it also happens to support other low
+ * addresses even when the code model suggests those low addresses would not
+ * otherwise be availiable.
+ */
+#define VDSO_SYMBOL(base, name) \
+({ \
+ extern const char __vdso_##name[]; \
+ (void __user *)((unsigned long)(base) + __vdso_##name); \
+})
+
+#endif /* _ASM_RISCV_VDSO_H */