xref: /linux/arch/x86/include/asm/vsyscall.h (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21965aae3SH. Peter Anvin #ifndef _ASM_X86_VSYSCALL_H
31965aae3SH. Peter Anvin #define _ASM_X86_VSYSCALL_H
4bb898558SAl Viro 
5bb898558SAl Viro #include <linux/seqlock.h>
6af170c50SDavid Howells #include <uapi/asm/vsyscall.h>
7*ee0e39a6SHou Tao #include <asm/page_types.h>
8bb898558SAl Viro 
91ad83c85SAndy Lutomirski #ifdef CONFIG_X86_VSYSCALL_EMULATION
10bb898558SAl Viro extern void map_vsyscall(void);
1185900ea5SAndy Lutomirski extern void set_vsyscall_pgtable_user_bits(pgd_t *root);
12bb898558SAl Viro 
133ae36655SAndy Lutomirski /*
143ae36655SAndy Lutomirski  * Called on instruction fetch fault in vsyscall page.
153ae36655SAndy Lutomirski  * Returns true if handled.
163ae36655SAndy Lutomirski  */
17918ce325SAndy Lutomirski extern bool emulate_vsyscall(unsigned long error_code,
18918ce325SAndy Lutomirski 			     struct pt_regs *regs, unsigned long address);
191ad83c85SAndy Lutomirski #else
map_vsyscall(void)201ad83c85SAndy Lutomirski static inline void map_vsyscall(void) {}
emulate_vsyscall(unsigned long error_code,struct pt_regs * regs,unsigned long address)21918ce325SAndy Lutomirski static inline bool emulate_vsyscall(unsigned long error_code,
22918ce325SAndy Lutomirski 				    struct pt_regs *regs, unsigned long address)
231ad83c85SAndy Lutomirski {
241ad83c85SAndy Lutomirski 	return false;
251ad83c85SAndy Lutomirski }
261ad83c85SAndy Lutomirski #endif
273ae36655SAndy Lutomirski 
28*ee0e39a6SHou Tao /*
29*ee0e39a6SHou Tao  * The (legacy) vsyscall page is the long page in the kernel portion
30*ee0e39a6SHou Tao  * of the address space that has user-accessible permissions.
31*ee0e39a6SHou Tao  */
is_vsyscall_vaddr(unsigned long vaddr)32*ee0e39a6SHou Tao static inline bool is_vsyscall_vaddr(unsigned long vaddr)
33*ee0e39a6SHou Tao {
34*ee0e39a6SHou Tao 	return unlikely((vaddr & PAGE_MASK) == VSYSCALL_ADDR);
35*ee0e39a6SHou Tao }
36*ee0e39a6SHou Tao 
371965aae3SH. Peter Anvin #endif /* _ASM_X86_VSYSCALL_H */
38