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 | |
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')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 54 | ||||
-rw-r--r-- | arch/x86/mm/init_64.c | 54 |
2 files changed, 54 insertions, 54 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index eef868c97b89..286c89a991bd 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -847,51 +847,6 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; | |||
847 | 847 | ||
848 | char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss; | 848 | char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss; |
849 | 849 | ||
850 | unsigned long __supported_pte_mask __read_mostly = ~0UL; | ||
851 | EXPORT_SYMBOL_GPL(__supported_pte_mask); | ||
852 | |||
853 | static int do_not_nx __cpuinitdata; | ||
854 | |||
855 | /* noexec=on|off | ||
856 | Control non executable mappings for 64bit processes. | ||
857 | |||
858 | on Enable(default) | ||
859 | off Disable | ||
860 | */ | ||
861 | static int __init nonx_setup(char *str) | ||
862 | { | ||
863 | if (!str) | ||
864 | return -EINVAL; | ||
865 | if (!strncmp(str, "on", 2)) { | ||
866 | __supported_pte_mask |= _PAGE_NX; | ||
867 | do_not_nx = 0; | ||
868 | } else if (!strncmp(str, "off", 3)) { | ||
869 | do_not_nx = 1; | ||
870 | __supported_pte_mask &= ~_PAGE_NX; | ||
871 | } | ||
872 | return 0; | ||
873 | } | ||
874 | early_param("noexec", nonx_setup); | ||
875 | |||
876 | int force_personality32; | ||
877 | |||
878 | /* noexec32=on|off | ||
879 | Control non executable heap for 32bit processes. | ||
880 | To control the stack too use noexec=off | ||
881 | |||
882 | on PROT_READ does not imply PROT_EXEC for 32bit processes (default) | ||
883 | off PROT_READ implies PROT_EXEC | ||
884 | */ | ||
885 | static int __init nonx32_setup(char *str) | ||
886 | { | ||
887 | if (!strcmp(str, "on")) | ||
888 | force_personality32 &= ~READ_IMPLIES_EXEC; | ||
889 | else if (!strcmp(str, "off")) | ||
890 | force_personality32 |= READ_IMPLIES_EXEC; | ||
891 | return 1; | ||
892 | } | ||
893 | __setup("noexec32=", nonx32_setup); | ||
894 | |||
895 | void pda_init(int cpu) | 850 | void pda_init(int cpu) |
896 | { | 851 | { |
897 | struct x8664_pda *pda = cpu_pda(cpu); | 852 | struct x8664_pda *pda = cpu_pda(cpu); |
@@ -957,15 +912,6 @@ void syscall_init(void) | |||
957 | X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL); | 912 | X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL); |
958 | } | 913 | } |
959 | 914 | ||
960 | void __cpuinit check_efer(void) | ||
961 | { | ||
962 | unsigned long efer; | ||
963 | |||
964 | rdmsrl(MSR_EFER, efer); | ||
965 | if (!(efer & EFER_NX) || do_not_nx) | ||
966 | __supported_pte_mask &= ~_PAGE_NX; | ||
967 | } | ||
968 | |||
969 | unsigned long kernel_eflags; | 915 | unsigned long kernel_eflags; |
970 | 916 | ||
971 | /* | 917 | /* |
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. |