diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-09-05 03:58:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-05 04:23:47 -0400 |
commit | bd220a24a9263eaa70d5e6821383085950b5a13c (patch) | |
tree | bd91a5d7c46567b807cbbd07f822a4a11a2b01bd /arch/x86/mm/init_64.c | |
parent | f5017cfa3591d8eaf5c792e40ff30f18e498b68c (diff) |
x86: move nonx_setup etc from common.c to init_64.c
like 32 bit put it in init_32.c
Signed-off-by: Yinghai <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r-- | arch/x86/mm/init_64.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index d3746efb060d..9c750d6307b0 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -88,6 +88,60 @@ early_param("gbpages", parse_direct_gbpages_on); | |||
88 | 88 | ||
89 | int after_bootmem; | 89 | int after_bootmem; |
90 | 90 | ||
91 | unsigned long __supported_pte_mask __read_mostly = ~0UL; | ||
92 | EXPORT_SYMBOL_GPL(__supported_pte_mask); | ||
93 | |||
94 | static int do_not_nx __cpuinitdata; | ||
95 | |||
96 | /* noexec=on|off | ||
97 | Control non executable mappings for 64bit processes. | ||
98 | |||
99 | on Enable(default) | ||
100 | off Disable | ||
101 | */ | ||
102 | static int __init nonx_setup(char *str) | ||
103 | { | ||
104 | if (!str) | ||
105 | return -EINVAL; | ||
106 | if (!strncmp(str, "on", 2)) { | ||
107 | __supported_pte_mask |= _PAGE_NX; | ||
108 | do_not_nx = 0; | ||
109 | } else if (!strncmp(str, "off", 3)) { | ||
110 | do_not_nx = 1; | ||
111 | __supported_pte_mask &= ~_PAGE_NX; | ||
112 | } | ||
113 | return 0; | ||
114 | } | ||
115 | early_param("noexec", nonx_setup); | ||
116 | |||
117 | void __cpuinit check_efer(void) | ||
118 | { | ||
119 | unsigned long efer; | ||
120 | |||
121 | rdmsrl(MSR_EFER, efer); | ||
122 | if (!(efer & EFER_NX) || do_not_nx) | ||
123 | __supported_pte_mask &= ~_PAGE_NX; | ||
124 | } | ||
125 | |||
126 | int force_personality32; | ||
127 | |||
128 | /* noexec32=on|off | ||
129 | Control non executable heap for 32bit processes. | ||
130 | To control the stack too use noexec=off | ||
131 | |||
132 | on PROT_READ does not imply PROT_EXEC for 32bit processes (default) | ||
133 | off PROT_READ implies PROT_EXEC | ||
134 | */ | ||
135 | static int __init nonx32_setup(char *str) | ||
136 | { | ||
137 | if (!strcmp(str, "on")) | ||
138 | force_personality32 &= ~READ_IMPLIES_EXEC; | ||
139 | else if (!strcmp(str, "off")) | ||
140 | force_personality32 |= READ_IMPLIES_EXEC; | ||
141 | return 1; | ||
142 | } | ||
143 | __setup("noexec32=", nonx32_setup); | ||
144 | |||
91 | /* | 145 | /* |
92 | * NOTE: This function is marked __ref because it calls __init function | 146 | * NOTE: This function is marked __ref because it calls __init function |
93 | * (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. | 147 | * (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. |