xref: /linux/arch/x86/include/asm/vsyscall.h (revision 53597deca0e38c30e6cd4ba2114fa42d2bcd85bb)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_VSYSCALL_H
3 #define _ASM_X86_VSYSCALL_H
4 
5 #include <linux/seqlock.h>
6 #include <uapi/asm/vsyscall.h>
7 #include <asm/page_types.h>
8 
9 #ifdef CONFIG_X86_VSYSCALL_EMULATION
10 extern void map_vsyscall(void);
11 extern void set_vsyscall_pgtable_user_bits(pgd_t *root);
12 
13 /*
14  * Called on instruction fetch fault in vsyscall page.
15  * Returns true if handled.
16  */
17 bool emulate_vsyscall_pf(unsigned long error_code, struct pt_regs *regs, unsigned long address);
18 bool emulate_vsyscall_gp(struct pt_regs *regs);
19 #else
20 static inline void map_vsyscall(void) {}
21 static inline bool emulate_vsyscall_pf(unsigned long error_code,
22 				       struct pt_regs *regs, unsigned long address)
23 {
24 	return false;
25 }
26 
27 static inline bool emulate_vsyscall_gp(struct pt_regs *regs)
28 {
29 	return false;
30 }
31 #endif
32 
33 /*
34  * The (legacy) vsyscall page is the long page in the kernel portion
35  * of the address space that has user-accessible permissions.
36  */
37 static inline bool is_vsyscall_vaddr(unsigned long vaddr)
38 {
39 	return unlikely((vaddr & PAGE_MASK) == VSYSCALL_ADDR);
40 }
41 
42 #endif /* _ASM_X86_VSYSCALL_H */
43