Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 361159
Collapse All | Expand All

(-)a/arch/x86/kernel/head64.c (+3 lines)
Lines 77-82 void __init x86_64_start_kernel(char * real_mode_data) Link Here
77
	/* Make NULL pointers segfault */
77
	/* Make NULL pointers segfault */
78
	zap_identity_mappings();
78
	zap_identity_mappings();
79
79
80
	/* Cleanup the over mapped high alias */
81
	cleanup_highmap();
82
80
	max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT;
83
	max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT;
81
84
82
	for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) {
85
	for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) {
(-)a/arch/x86/kernel/setup.c (-5 lines)
Lines 297-305 static void __init init_gbpages(void) Link Here
297
static inline void init_gbpages(void)
297
static inline void init_gbpages(void)
298
{
298
{
299
}
299
}
300
static void __init cleanup_highmap(void)
301
{
302
}
303
#endif
300
#endif
304
301
305
static void __init reserve_brk(void)
302
static void __init reserve_brk(void)
Lines 925-932 void __init setup_arch(char **cmdline_p) Link Here
925
	 */
922
	 */
926
	reserve_brk();
923
	reserve_brk();
927
924
928
	cleanup_highmap();
929
930
	memblock.current_limit = get_max_mapped();
925
	memblock.current_limit = get_max_mapped();
931
	memblock_x86_fill();
926
	memblock_x86_fill();
932
927
(-)a/arch/x86/mm/init.c (+19 lines)
Lines 279-284 unsigned long __init_refok init_memory_mapping(unsigned long start, Link Here
279
	load_cr3(swapper_pg_dir);
279
	load_cr3(swapper_pg_dir);
280
#endif
280
#endif
281
281
282
#ifdef CONFIG_X86_64
283
	if (!after_bootmem && !start) {
284
		pud_t *pud;
285
		pmd_t *pmd;
286
287
		mmu_cr4_features = read_cr4();
288
289
		/*
290
		 * _brk_end cannot change anymore, but it and _end may be
291
		 * located on different 2M pages. cleanup_highmap(), however,
292
		 * can only consider _end when it runs, so destroy any
293
		 * mappings beyond _brk_end here.
294
		 */
295
		pud = pud_offset(pgd_offset_k(_brk_end), _brk_end);
296
		pmd = pmd_offset(pud, _brk_end - 1);
297
		while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1))
298
			pmd_clear(pmd);
299
	}
300
#endif
282
	__flush_tlb_all();
301
	__flush_tlb_all();
283
302
284
	if (!after_bootmem && e820_table_end > e820_table_start)
303
	if (!after_bootmem && e820_table_end > e820_table_start)
(-)a/arch/x86/mm/init_64.c (-6 / +5 lines)
Lines 51-57 Link Here
51
#include <asm/numa.h>
51
#include <asm/numa.h>
52
#include <asm/cacheflush.h>
52
#include <asm/cacheflush.h>
53
#include <asm/init.h>
53
#include <asm/init.h>
54
#include <asm/setup.h>
55
54
56
static int __init parse_direct_gbpages_off(char *arg)
55
static int __init parse_direct_gbpages_off(char *arg)
57
{
56
{
Lines 294-311 void __init init_extra_mapping_uc(unsigned long phys, unsigned long size) Link Here
294
 * to the compile time generated pmds. This results in invalid pmds up
293
 * to the compile time generated pmds. This results in invalid pmds up
295
 * to the point where we hit the physaddr 0 mapping.
294
 * to the point where we hit the physaddr 0 mapping.
296
 *
295
 *
297
 * We limit the mappings to the region from _text to _brk_end.  _brk_end
296
 * We limit the mappings to the region from _text to _end.  _end is
298
 * is rounded up to the 2MB boundary. This catches the invalid pmds as
297
 * rounded up to the 2MB boundary. This catches the invalid pmds as
299
 * well, as they are located before _text:
298
 * well, as they are located before _text:
300
 */
299
 */
301
void __init cleanup_highmap(void)
300
void __init cleanup_highmap(void)
302
{
301
{
303
	unsigned long vaddr = __START_KERNEL_map;
302
	unsigned long vaddr = __START_KERNEL_map;
304
	unsigned long vaddr_end = __START_KERNEL_map + (max_pfn_mapped << PAGE_SHIFT);
303
	unsigned long end = roundup((unsigned long)_end, PMD_SIZE) - 1;
305
	unsigned long end = roundup((unsigned long)_brk_end, PMD_SIZE) - 1;
306
	pmd_t *pmd = level2_kernel_pgt;
304
	pmd_t *pmd = level2_kernel_pgt;
305
	pmd_t *last_pmd = pmd + PTRS_PER_PMD;
307
306
308
	for (; vaddr + PMD_SIZE - 1 < vaddr_end; pmd++, vaddr += PMD_SIZE) {
307
	for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) {
309
		if (pmd_none(*pmd))
308
		if (pmd_none(*pmd))
310
			continue;
309
			continue;
311
		if (vaddr < (unsigned long) _text || vaddr > end)
310
		if (vaddr < (unsigned long) _text || vaddr > end)

Return to bug 361159