nx-emu: standardize boottime message prefix
[linux-flexiantxendom0-natty.git] / arch / x86 / mm / setup_nx.c
1 #include <linux/sched.h>
2 #include <linux/spinlock.h>
3 #include <linux/errno.h>
4 #include <linux/init.h>
5
6 #include <asm/pgtable.h>
7 #include <asm/proto.h>
8
9 int disable_nx __cpuinitdata;
10
11 /*
12  * noexec = on|off
13  *
14  * Control non-executable mappings for processes.
15  *
16  * on      Enable
17  * off     Disable
18  */
19 static int __init noexec_setup(char *str)
20 {
21         if (!str)
22                 return -EINVAL;
23         if (!strncmp(str, "on", 2)) {
24                 disable_nx = 0;
25         } else if (!strncmp(str, "off", 3)) {
26                 disable_nx = 1;
27         }
28         x86_configure_nx();
29         return 0;
30 }
31 early_param("noexec", noexec_setup);
32
33 void __cpuinit x86_configure_nx(void)
34 {
35         if (cpu_has_nx && !disable_nx)
36                 __supported_pte_mask |= _PAGE_NX;
37         else
38                 __supported_pte_mask &= ~_PAGE_NX;
39 }
40
41 void __init x86_report_nx(void)
42 {
43         if (!cpu_has_nx) {
44 #ifdef CONFIG_X86_32
45                 if (disable_nx)
46                         printk(KERN_INFO "NX (Execute Disable) protection: "
47                                "approximated by x86 segment limits\n");
48                 else
49                         printk(KERN_INFO "NX (Execute Disable) protection: "
50                                "approximation disabled by kernel command "
51                                "line option\n");
52 #else
53                 printk(KERN_NOTICE "Notice: NX (Execute Disable) protection "
54                        "missing in CPU!\n");
55 #endif
56         } else {
57 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
58                 if (disable_nx) {
59                         printk(KERN_INFO "NX (Execute Disable) protection: "
60                                "disabled by kernel command line option\n");
61                 } else {
62                         printk(KERN_INFO "NX (Execute Disable) protection: "
63                                "active\n");
64                 }
65 #else
66                 /* 32bit non-PAE kernel, NX cannot be used */
67                 printk(KERN_NOTICE "Notice: NX (Execute Disable) protection "
68                        "cannot be enabled: non-PAE kernel!\n");
69 #endif
70         }
71 }