diff options
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r-- | arch/x86/kernel/setup.c | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index f28c56e6bf94..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, |
@@ -219,12 +218,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE; | |||
219 | int bootloader_type; | 218 | int bootloader_type; |
220 | 219 | ||
221 | /* | 220 | /* |
222 | * Early DMI memory | ||
223 | */ | ||
224 | int dmi_alloc_index; | ||
225 | char dmi_alloc_data[DMI_MAX_DATA]; | ||
226 | |||
227 | /* | ||
228 | * Setup options | 221 | * Setup options |
229 | */ | 222 | */ |
230 | struct screen_info screen_info; | 223 | struct screen_info screen_info; |
@@ -269,6 +262,35 @@ static inline void copy_edd(void) | |||
269 | } | 262 | } |
270 | #endif | 263 | #endif |
271 | 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 | |||
272 | #ifdef CONFIG_BLK_DEV_INITRD | 294 | #ifdef CONFIG_BLK_DEV_INITRD |
273 | 295 | ||
274 | #ifdef CONFIG_X86_32 | 296 | #ifdef CONFIG_X86_32 |
@@ -717,11 +739,7 @@ void __init setup_arch(char **cmdline_p) | |||
717 | init_mm.start_code = (unsigned long) _text; | 739 | init_mm.start_code = (unsigned long) _text; |
718 | init_mm.end_code = (unsigned long) _etext; | 740 | init_mm.end_code = (unsigned long) _etext; |
719 | init_mm.end_data = (unsigned long) _edata; | 741 | init_mm.end_data = (unsigned long) _edata; |
720 | #ifdef CONFIG_X86_32 | 742 | init_mm.brk = _brk_end; |
721 | init_mm.brk = init_pg_tables_end + PAGE_OFFSET; | ||
722 | #else | ||
723 | init_mm.brk = (unsigned long) &_end; | ||
724 | #endif | ||
725 | 743 | ||
726 | code_resource.start = virt_to_phys(_text); | 744 | code_resource.start = virt_to_phys(_text); |
727 | code_resource.end = virt_to_phys(_etext)-1; | 745 | code_resource.end = virt_to_phys(_etext)-1; |
@@ -842,6 +860,8 @@ void __init setup_arch(char **cmdline_p) | |||
842 | setup_bios_corruption_check(); | 860 | setup_bios_corruption_check(); |
843 | #endif | 861 | #endif |
844 | 862 | ||
863 | reserve_brk(); | ||
864 | |||
845 | /* max_pfn_mapped is updated here */ | 865 | /* max_pfn_mapped is updated here */ |
846 | 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); |
847 | max_pfn_mapped = max_low_pfn_mapped; | 867 | max_pfn_mapped = max_low_pfn_mapped; |