aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r--arch/x86/kernel/setup.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 991b77986d57..0fa60f5f5a16 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -936,8 +936,6 @@ void __init setup_arch(char **cmdline_p)
936 936
937 x86_init.oem.arch_setup(); 937 x86_init.oem.arch_setup();
938 938
939 kernel_randomize_memory();
940
941 iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1; 939 iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
942 setup_memory_map(); 940 setup_memory_map();
943 parse_setup_data(); 941 parse_setup_data();
@@ -1055,6 +1053,12 @@ void __init setup_arch(char **cmdline_p)
1055 1053
1056 max_possible_pfn = max_pfn; 1054 max_possible_pfn = max_pfn;
1057 1055
1056 /*
1057 * Define random base addresses for memory sections after max_pfn is
1058 * defined and before each memory section base is used.
1059 */
1060 kernel_randomize_memory();
1061
1058#ifdef CONFIG_X86_32 1062#ifdef CONFIG_X86_32
1059 /* max_low_pfn get updated here */ 1063 /* max_low_pfn get updated here */
1060 find_low_pfn_range(); 1064 find_low_pfn_range();
@@ -1097,6 +1101,8 @@ void __init setup_arch(char **cmdline_p)
1097 efi_find_mirror(); 1101 efi_find_mirror();
1098 } 1102 }
1099 1103
1104 reserve_bios_regions();
1105
1100 /* 1106 /*
1101 * The EFI specification says that boot service code won't be called 1107 * The EFI specification says that boot service code won't be called
1102 * after ExitBootServices(). This is, in fact, a lie. 1108 * after ExitBootServices(). This is, in fact, a lie.
@@ -1125,7 +1131,15 @@ void __init setup_arch(char **cmdline_p)
1125 1131
1126 early_trap_pf_init(); 1132 early_trap_pf_init();
1127 1133
1128 setup_real_mode(); 1134 /*
1135 * Update mmu_cr4_features (and, indirectly, trampoline_cr4_features)
1136 * with the current CR4 value. This may not be necessary, but
1137 * auditing all the early-boot CR4 manipulation would be needed to
1138 * rule it out.
1139 */
1140 if (boot_cpu_data.cpuid_level >= 0)
1141 /* A CPU has %cr4 if and only if it has CPUID. */
1142 mmu_cr4_features = __read_cr4();
1129 1143
1130 memblock_set_current_limit(get_max_mapped()); 1144 memblock_set_current_limit(get_max_mapped());
1131 1145
@@ -1174,13 +1188,6 @@ void __init setup_arch(char **cmdline_p)
1174 1188
1175 kasan_init(); 1189 kasan_init();
1176 1190
1177 if (boot_cpu_data.cpuid_level >= 0) {
1178 /* A CPU has %cr4 if and only if it has CPUID */
1179 mmu_cr4_features = __read_cr4();
1180 if (trampoline_cr4_features)
1181 *trampoline_cr4_features = mmu_cr4_features;
1182 }
1183
1184#ifdef CONFIG_X86_32 1191#ifdef CONFIG_X86_32
1185 /* sync back kernel address range */ 1192 /* sync back kernel address range */
1186 clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, 1193 clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,