riscv/vdso: Refactor asm/vdso.h

The asm/vdso.h will be included in vdso.lds.S in the next patch, the
following cleanup is needed to avoid syntax error:

 1.the declaration of sys_riscv_flush_icache() is moved into asm/syscall.h.
 2.the definition of struct vdso_data is moved into kernel/vdso.c.
 2.the definition of VDSO_SYMBOL is placed under "#ifndef __ASSEMBLY__".

Also remove the redundant linux/types.h include.

Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
Tong Tiangen 2021-09-01 02:46:19 +00:00 committed by Palmer Dabbelt
parent 6880fa6c56
commit bb4a23c994
No known key found for this signature in database
GPG Key ID: 2E1319F35FBB1889
4 changed files with 15 additions and 8 deletions

View File

@ -82,4 +82,5 @@ static inline int syscall_get_arch(struct task_struct *task)
#endif #endif
} }
asmlinkage long sys_riscv_flush_icache(uintptr_t, uintptr_t, uintptr_t);
#endif /* _ASM_RISCV_SYSCALL_H */ #endif /* _ASM_RISCV_SYSCALL_H */

View File

@ -16,18 +16,22 @@
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
#include <linux/types.h> #include <linux/types.h>
#include <generated/vdso-offsets.h> /*
* All systems with an MMU have a VDSO, but systems without an MMU don't
* support shared libraries and therefor don't have one.
*/
#ifdef CONFIG_MMU
#ifndef CONFIG_GENERIC_TIME_VSYSCALL #ifndef __ASSEMBLY__
struct vdso_data { #include <generated/vdso-offsets.h>
};
#endif
#define VDSO_SYMBOL(base, name) \ #define VDSO_SYMBOL(base, name) \
(void __user *)((unsigned long)(base) + __vdso_##name##_offset) (void __user *)((unsigned long)(base) + __vdso_##name##_offset)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
asmlinkage long sys_riscv_flush_icache(uintptr_t, uintptr_t, uintptr_t); #endif /* !__ASSEMBLY__ */
#endif /* CONFIG_MMU */
#endif /* _ASM_RISCV_VDSO_H */ #endif /* _ASM_RISCV_VDSO_H */

View File

@ -7,7 +7,6 @@
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <asm-generic/syscalls.h> #include <asm-generic/syscalls.h>
#include <asm/vdso.h>
#include <asm/syscall.h> #include <asm/syscall.h>
#undef __SYSCALL #undef __SYSCALL

View File

@ -12,10 +12,13 @@
#include <linux/binfmts.h> #include <linux/binfmts.h>
#include <linux/err.h> #include <linux/err.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/vdso.h>
#ifdef CONFIG_GENERIC_TIME_VSYSCALL #ifdef CONFIG_GENERIC_TIME_VSYSCALL
#include <vdso/datapage.h> #include <vdso/datapage.h>
#else #else
#include <asm/vdso.h> struct vdso_data {
};
#endif #endif
extern char vdso_start[], vdso_end[]; extern char vdso_start[], vdso_end[];