xref: /linux/arch/x86/include/asm/vsyscall.h (revision 3ddd2e12c704f22c28efb714817c88ee4e25688a)
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 #else
19 static inline void map_vsyscall(void) {}
20 static inline bool emulate_vsyscall_pf(unsigned long error_code,
21 				       struct pt_regs *regs, unsigned long address)
22 {
23 	return false;
24 }
25 #endif
26 
27 /*
28  * The (legacy) vsyscall page is the long page in the kernel portion
29  * of the address space that has user-accessible permissions.
30  */
31 static inline bool is_vsyscall_vaddr(unsigned long vaddr)
32 {
33 	return unlikely((vaddr & PAGE_MASK) == VSYSCALL_ADDR);
34 }
35 
36 #endif /* _ASM_X86_VSYSCALL_H */
37