aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/ia32/syscall32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/ia32/syscall32.c')
-rw-r--r--arch/x86/ia32/syscall32.c90
1 files changed, 0 insertions, 90 deletions
diff --git a/arch/x86/ia32/syscall32.c b/arch/x86/ia32/syscall32.c
deleted file mode 100644
index 98ff99f5b59a..000000000000
--- a/arch/x86/ia32/syscall32.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Copyright 2002,2003 Andi Kleen, SuSE Labs
3 *
4 * vsyscall handling for 32bit processes. Map a stub page into it on
5 * demand because 32bit cannot reach the kernel's fixmaps
6 */
7#include <linux/mm.h>
8#include <linux/string.h>
9#include <linux/kernel.h>
10#include <linux/gfp.h>
11#include <linux/init.h>
12#include <linux/stringify.h>
13#include <linux/security.h>
14#include <asm/proto.h>
15#include <asm/tlbflush.h>
16#include <asm/ia32_unistd.h>
17#include <asm/vsyscall32.h>
18
19extern unsigned char syscall32_syscall[], syscall32_syscall_end[];
20extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[];
21extern int sysctl_vsyscall32;
22
23static struct page *syscall32_pages[1];
24static int use_sysenter = -1;
25
26struct linux_binprm;
27
28/* Setup a VMA at program startup for the vsyscall page */
29int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
30{
31 struct mm_struct *mm = current->mm;
32 int ret;
33
34 down_write(&mm->mmap_sem);
35 /*
36 * MAYWRITE to allow gdb to COW and set breakpoints
37 *
38 * Make sure the vDSO gets into every core dump.
39 * Dumping its contents makes post-mortem fully interpretable later
40 * without matching up the same kernel and hardware config to see
41 * what PC values meant.
42 */
43 /* Could randomize here */
44 ret = install_special_mapping(mm, VSYSCALL32_BASE, PAGE_SIZE,
45 VM_READ|VM_EXEC|
46 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
47 VM_ALWAYSDUMP,
48 syscall32_pages);
49 if (ret == 0) {
50 current->mm->context.vdso = (void __user *)VSYSCALL32_BASE;
51 current_thread_info()->sysenter_return = VSYSCALL32_SYSEXIT;
52 }
53 up_write(&mm->mmap_sem);
54 return ret;
55}
56
57static int __init init_syscall32(void)
58{
59 char *syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);
60
61 if (!syscall32_page)
62 panic("Cannot allocate syscall32 page");
63 syscall32_pages[0] = virt_to_page(syscall32_page);
64 if (use_sysenter > 0) {
65 memcpy(syscall32_page, syscall32_sysenter,
66 syscall32_sysenter_end - syscall32_sysenter);
67 } else {
68 memcpy(syscall32_page, syscall32_syscall,
69 syscall32_syscall_end - syscall32_syscall);
70 }
71 return 0;
72}
73__initcall(init_syscall32);
74
75/* May not be __init: called during resume */
76void syscall32_cpu_init(void)
77{
78 if (use_sysenter < 0)
79 use_sysenter = (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL);
80
81 /*
82 * Load these always in case some future AMD CPU supports
83 * SYSENTER from compat mode too.
84 */
85 checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
86 checking_wrmsrl(MSR_IA32_SYSENTER_ESP, 0ULL);
87 checking_wrmsrl(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
88
89 wrmsrl(MSR_CSTAR, ia32_cstar_target);
90}