11965aae3SH. Peter Anvin #ifndef _ASM_X86_VDSO_H 21965aae3SH. Peter Anvin #define _ASM_X86_VDSO_H 3bb898558SAl Viro 4*9e6f450fSAndy Lutomirski #include <asm/page_types.h> 5*9e6f450fSAndy Lutomirski #include <linux/linkage.h> 6*9e6f450fSAndy Lutomirski 7*9e6f450fSAndy Lutomirski #ifdef __ASSEMBLER__ 8*9e6f450fSAndy Lutomirski 9*9e6f450fSAndy Lutomirski #define DEFINE_VDSO_IMAGE(symname, filename) \ 10*9e6f450fSAndy Lutomirski __PAGE_ALIGNED_DATA ; \ 11*9e6f450fSAndy Lutomirski .globl symname##_start, symname##_end ; \ 12*9e6f450fSAndy Lutomirski .align PAGE_SIZE ; \ 13*9e6f450fSAndy Lutomirski symname##_start: ; \ 14*9e6f450fSAndy Lutomirski .incbin filename ; \ 15*9e6f450fSAndy Lutomirski symname##_end: ; \ 16*9e6f450fSAndy Lutomirski .align PAGE_SIZE /* extra data here leaks to userspace. */ ; \ 17*9e6f450fSAndy Lutomirski \ 18*9e6f450fSAndy Lutomirski .previous ; \ 19*9e6f450fSAndy Lutomirski \ 20*9e6f450fSAndy Lutomirski .globl symname##_pages ; \ 21*9e6f450fSAndy Lutomirski .bss ; \ 22*9e6f450fSAndy Lutomirski .align 8 ; \ 23*9e6f450fSAndy Lutomirski .type symname##_pages, @object ; \ 24*9e6f450fSAndy Lutomirski symname##_pages: ; \ 25*9e6f450fSAndy Lutomirski .zero (symname##_end - symname##_start + PAGE_SIZE - 1) / PAGE_SIZE * (BITS_PER_LONG / 8) ; \ 26*9e6f450fSAndy Lutomirski .size symname##_pages, .-symname##_pages 27*9e6f450fSAndy Lutomirski 28*9e6f450fSAndy Lutomirski #else 29*9e6f450fSAndy Lutomirski 30*9e6f450fSAndy Lutomirski #define DECLARE_VDSO_IMAGE(symname) \ 31*9e6f450fSAndy Lutomirski extern char symname##_start[], symname##_end[]; \ 32*9e6f450fSAndy Lutomirski extern struct page *symname##_pages[] 33*9e6f450fSAndy Lutomirski 34bb898558SAl Viro #if defined CONFIG_X86_32 || defined CONFIG_COMPAT 357a59ed41SStefani Seibold 367a59ed41SStefani Seibold #include <asm/vdso32.h> 377a59ed41SStefani Seibold 38*9e6f450fSAndy Lutomirski DECLARE_VDSO_IMAGE(vdso32_int80); 39*9e6f450fSAndy Lutomirski #ifdef CONFIG_COMPAT 40*9e6f450fSAndy Lutomirski DECLARE_VDSO_IMAGE(vdso32_syscall); 41*9e6f450fSAndy Lutomirski #endif 42*9e6f450fSAndy Lutomirski DECLARE_VDSO_IMAGE(vdso32_sysenter); 43*9e6f450fSAndy Lutomirski 447a59ed41SStefani Seibold extern const char VDSO32_PRELINK[]; 457a59ed41SStefani Seibold 46bb898558SAl Viro /* 47bb898558SAl Viro * Given a pointer to the vDSO image, find the pointer to VDSO32_name 48bb898558SAl Viro * as that symbol is defined in the vDSO sources or linker script. 49bb898558SAl Viro */ 50bb898558SAl Viro #define VDSO32_SYMBOL(base, name) \ 51bb898558SAl Viro ({ \ 52bb898558SAl Viro extern const char VDSO32_##name[]; \ 53b0b49f26SAndy Lutomirski (void __user *)(VDSO32_##name + (unsigned long)(base)); \ 54bb898558SAl Viro }) 55bb898558SAl Viro #endif 56bb898558SAl Viro 57bb898558SAl Viro /* 58bb898558SAl Viro * These symbols are defined with the addresses in the vsyscall page. 59bb898558SAl Viro * See vsyscall-sigreturn.S. 60bb898558SAl Viro */ 61bb898558SAl Viro extern void __user __kernel_sigreturn; 62bb898558SAl Viro extern void __user __kernel_rt_sigreturn; 63bb898558SAl Viro 64b4b541a6SAndy Lutomirski void __init patch_vdso32(void *vdso, size_t len); 65b4b541a6SAndy Lutomirski 66*9e6f450fSAndy Lutomirski #endif /* __ASSEMBLER__ */ 67*9e6f450fSAndy Lutomirski 681965aae3SH. Peter Anvin #endif /* _ASM_X86_VDSO_H */ 69