Skip to content

Commit bb4a23c

Browse files
Tong Tiangenpalmer-dabbelt
authored andcommitted
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 <[email protected]> Reviewed-by: Kefeng Wang <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 6880fa6 commit bb4a23c

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

arch/riscv/include/asm/syscall.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ static inline int syscall_get_arch(struct task_struct *task)
8282
#endif
8383
}
8484

85+
asmlinkage long sys_riscv_flush_icache(uintptr_t, uintptr_t, uintptr_t);
8586
#endif /* _ASM_RISCV_SYSCALL_H */

arch/riscv/include/asm/vdso.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@
1616
#ifdef CONFIG_MMU
1717

1818
#include <linux/types.h>
19-
#include <generated/vdso-offsets.h>
19+
/*
20+
* All systems with an MMU have a VDSO, but systems without an MMU don't
21+
* support shared libraries and therefor don't have one.
22+
*/
23+
#ifdef CONFIG_MMU
2024

21-
#ifndef CONFIG_GENERIC_TIME_VSYSCALL
22-
struct vdso_data {
23-
};
24-
#endif
25+
#ifndef __ASSEMBLY__
26+
#include <generated/vdso-offsets.h>
2527

2628
#define VDSO_SYMBOL(base, name) \
2729
(void __user *)((unsigned long)(base) + __vdso_##name##_offset)
2830

2931
#endif /* CONFIG_MMU */
3032

31-
asmlinkage long sys_riscv_flush_icache(uintptr_t, uintptr_t, uintptr_t);
33+
#endif /* !__ASSEMBLY__ */
34+
35+
#endif /* CONFIG_MMU */
3236

3337
#endif /* _ASM_RISCV_VDSO_H */

arch/riscv/kernel/syscall_table.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <linux/linkage.h>
88
#include <linux/syscalls.h>
99
#include <asm-generic/syscalls.h>
10-
#include <asm/vdso.h>
1110
#include <asm/syscall.h>
1211

1312
#undef __SYSCALL

arch/riscv/kernel/vdso.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
#include <linux/binfmts.h>
1313
#include <linux/err.h>
1414
#include <asm/page.h>
15+
#include <asm/vdso.h>
16+
1517
#ifdef CONFIG_GENERIC_TIME_VSYSCALL
1618
#include <vdso/datapage.h>
1719
#else
18-
#include <asm/vdso.h>
20+
struct vdso_data {
21+
};
1922
#endif
2023

2124
extern char vdso_start[], vdso_end[];

0 commit comments

Comments
 (0)