diff options
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r-- | arch/x86/kernel/setup.c | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index b746deb9ebc6..a0d26237d7cf 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -112,8 +112,13 @@ | |||
112 | #define ARCH_SETUP | 112 | #define ARCH_SETUP |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | RESERVE_BRK(dmi_alloc, 65536); | ||
116 | |||
115 | unsigned int boot_cpu_id __read_mostly; | 117 | unsigned int boot_cpu_id __read_mostly; |
116 | 118 | ||
119 | static __initdata unsigned long _brk_start = (unsigned long)__brk_base; | ||
120 | unsigned long _brk_end = (unsigned long)__brk_base; | ||
121 | |||
117 | #ifdef CONFIG_X86_64 | 122 | #ifdef CONFIG_X86_64 |
118 | int default_cpu_present_to_apicid(int mps_cpu) | 123 | int default_cpu_present_to_apicid(int mps_cpu) |
119 | { | 124 | { |
@@ -158,12 +163,6 @@ static struct resource bss_resource = { | |||
158 | 163 | ||
159 | 164 | ||
160 | #ifdef CONFIG_X86_32 | 165 | #ifdef CONFIG_X86_32 |
161 | /* This value is set up by the early boot code to point to the value | ||
162 | immediately after the boot time page tables. It contains a *physical* | ||
163 | address, and must not be in the .bss segment! */ | ||
164 | unsigned long init_pg_tables_start __initdata = ~0UL; | ||
165 | unsigned long init_pg_tables_end __initdata = ~0UL; | ||
166 | |||
167 | static struct resource video_ram_resource = { | 166 | static struct resource video_ram_resource = { |
168 | .name = "Video RAM area", | 167 | .name = "Video RAM area", |
169 | .start = 0xa0000, | 168 | .start = 0xa0000, |
@@ -202,7 +201,9 @@ struct ist_info ist_info; | |||
202 | #endif | 201 | #endif |
203 | 202 | ||
204 | #else | 203 | #else |
205 | struct cpuinfo_x86 boot_cpu_data __read_mostly; | 204 | struct cpuinfo_x86 boot_cpu_data __read_mostly = { |
205 | .x86_phys_bits = MAX_PHYSMEM_BITS, | ||
206 | }; | ||
206 | EXPORT_SYMBOL(boot_cpu_data); | 207 | EXPORT_SYMBOL(boot_cpu_data); |
207 | #endif | 208 | #endif |
208 | 209 | ||
@@ -217,12 +218,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE; | |||
217 | int bootloader_type; | 218 | int bootloader_type; |
218 | 219 | ||
219 | /* | 220 | /* |
220 | * Early DMI memory | ||
221 | */ | ||
222 | int dmi_alloc_index; | ||
223 | char dmi_alloc_data[DMI_MAX_DATA]; | ||
224 | |||
225 | /* | ||
226 | * Setup options | 221 | * Setup options |
227 | */ | 222 | */ |
228 | struct screen_info screen_info; | 223 | struct screen_info screen_info; |
@@ -267,6 +262,35 @@ static inline void copy_edd(void) | |||
267 | } | 262 | } |
268 | #endif | 263 | #endif |
269 | 264 | ||
265 | void * __init extend_brk(size_t size, size_t align) | ||
266 | { | ||
267 | size_t mask = align - 1; | ||
268 | void *ret; | ||
269 | |||
270 | BUG_ON(_brk_start == 0); | ||
271 | BUG_ON(align & mask); | ||
272 | |||
273 | _brk_end = (_brk_end + mask) & ~mask; | ||
274 | BUG_ON((char *)(_brk_end + size) > __brk_limit); | ||
275 | |||
276 | ret = (void *)_brk_end; | ||
277 | _brk_end += size; | ||
278 | |||
279 | memset(ret, 0, size); | ||
280 | |||
281 | return ret; | ||
282 | } | ||
283 | |||
284 | static void __init reserve_brk(void) | ||
285 | { | ||
286 | if (_brk_end > _brk_start) | ||
287 | reserve_early(__pa(_brk_start), __pa(_brk_end), "BRK"); | ||
288 | |||
289 | /* Mark brk area as locked down and no longer taking any | ||
290 | new allocations */ | ||
291 | _brk_start = 0; | ||
292 | } | ||
293 | |||
270 | #ifdef CONFIG_BLK_DEV_INITRD | 294 | #ifdef CONFIG_BLK_DEV_INITRD |
271 | 295 | ||
272 | #ifdef CONFIG_X86_32 | 296 | #ifdef CONFIG_X86_32 |
@@ -715,11 +739,7 @@ void __init setup_arch(char **cmdline_p) | |||
715 | init_mm.start_code = (unsigned long) _text; | 739 | init_mm.start_code = (unsigned long) _text; |
716 | init_mm.end_code = (unsigned long) _etext; | 740 | init_mm.end_code = (unsigned long) _etext; |
717 | init_mm.end_data = (unsigned long) _edata; | 741 | init_mm.end_data = (unsigned long) _edata; |
718 | #ifdef CONFIG_X86_32 | 742 | init_mm.brk = _brk_end; |
719 | init_mm.brk = init_pg_tables_end + PAGE_OFFSET; | ||
720 | #else | ||
721 | init_mm.brk = (unsigned long) &_end; | ||
722 | #endif | ||
723 | 743 | ||
724 | code_resource.start = virt_to_phys(_text); | 744 | code_resource.start = virt_to_phys(_text); |
725 | code_resource.end = virt_to_phys(_etext)-1; | 745 | code_resource.end = virt_to_phys(_etext)-1; |
@@ -840,6 +860,8 @@ void __init setup_arch(char **cmdline_p) | |||
840 | setup_bios_corruption_check(); | 860 | setup_bios_corruption_check(); |
841 | #endif | 861 | #endif |
842 | 862 | ||
863 | reserve_brk(); | ||
864 | |||
843 | /* max_pfn_mapped is updated here */ | 865 | /* max_pfn_mapped is updated here */ |
844 | max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT); | 866 | max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT); |
845 | max_pfn_mapped = max_low_pfn_mapped; | 867 | max_pfn_mapped = max_low_pfn_mapped; |