diff options
Diffstat (limited to 'arch/x86/mm/init_32.c')
-rw-r--r-- | arch/x86/mm/init_32.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index c483f4242079..800e1d94c1b5 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -67,7 +67,7 @@ static unsigned long __meminitdata table_top; | |||
67 | 67 | ||
68 | static int __initdata after_init_bootmem; | 68 | static int __initdata after_init_bootmem; |
69 | 69 | ||
70 | static __init void *alloc_low_page(unsigned long *phys) | 70 | static __init void *alloc_low_page(void) |
71 | { | 71 | { |
72 | unsigned long pfn = table_end++; | 72 | unsigned long pfn = table_end++; |
73 | void *adr; | 73 | void *adr; |
@@ -77,7 +77,6 @@ static __init void *alloc_low_page(unsigned long *phys) | |||
77 | 77 | ||
78 | adr = __va(pfn * PAGE_SIZE); | 78 | adr = __va(pfn * PAGE_SIZE); |
79 | memset(adr, 0, PAGE_SIZE); | 79 | memset(adr, 0, PAGE_SIZE); |
80 | *phys = pfn * PAGE_SIZE; | ||
81 | return adr; | 80 | return adr; |
82 | } | 81 | } |
83 | 82 | ||
@@ -92,16 +91,17 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd) | |||
92 | pmd_t *pmd_table; | 91 | pmd_t *pmd_table; |
93 | 92 | ||
94 | #ifdef CONFIG_X86_PAE | 93 | #ifdef CONFIG_X86_PAE |
95 | unsigned long phys; | ||
96 | if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { | 94 | if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { |
97 | if (after_init_bootmem) | 95 | if (after_init_bootmem) |
98 | pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE); | 96 | pmd_table = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE); |
99 | else | 97 | else |
100 | pmd_table = (pmd_t *)alloc_low_page(&phys); | 98 | pmd_table = (pmd_t *)alloc_low_page(); |
101 | paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT); | 99 | paravirt_alloc_pmd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT); |
102 | set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); | 100 | set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); |
103 | pud = pud_offset(pgd, 0); | 101 | pud = pud_offset(pgd, 0); |
104 | BUG_ON(pmd_table != pmd_offset(pud, 0)); | 102 | BUG_ON(pmd_table != pmd_offset(pud, 0)); |
103 | |||
104 | return pmd_table; | ||
105 | } | 105 | } |
106 | #endif | 106 | #endif |
107 | pud = pud_offset(pgd, 0); | 107 | pud = pud_offset(pgd, 0); |
@@ -126,10 +126,8 @@ static pte_t * __init one_page_table_init(pmd_t *pmd) | |||
126 | if (!page_table) | 126 | if (!page_table) |
127 | page_table = | 127 | page_table = |
128 | (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); | 128 | (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); |
129 | } else { | 129 | } else |
130 | unsigned long phys; | 130 | page_table = (pte_t *)alloc_low_page(); |
131 | page_table = (pte_t *)alloc_low_page(&phys); | ||
132 | } | ||
133 | 131 | ||
134 | paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT); | 132 | paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT); |
135 | set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); | 133 | set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); |
@@ -969,8 +967,6 @@ void __init mem_init(void) | |||
969 | int codesize, reservedpages, datasize, initsize; | 967 | int codesize, reservedpages, datasize, initsize; |
970 | int tmp; | 968 | int tmp; |
971 | 969 | ||
972 | start_periodic_check_for_corruption(); | ||
973 | |||
974 | #ifdef CONFIG_FLATMEM | 970 | #ifdef CONFIG_FLATMEM |
975 | BUG_ON(!mem_map); | 971 | BUG_ON(!mem_map); |
976 | #endif | 972 | #endif |
@@ -1040,11 +1036,25 @@ void __init mem_init(void) | |||
1040 | (unsigned long)&_text, (unsigned long)&_etext, | 1036 | (unsigned long)&_text, (unsigned long)&_etext, |
1041 | ((unsigned long)&_etext - (unsigned long)&_text) >> 10); | 1037 | ((unsigned long)&_etext - (unsigned long)&_text) >> 10); |
1042 | 1038 | ||
1039 | /* | ||
1040 | * Check boundaries twice: Some fundamental inconsistencies can | ||
1041 | * be detected at build time already. | ||
1042 | */ | ||
1043 | #define __FIXADDR_TOP (-PAGE_SIZE) | ||
1044 | #ifdef CONFIG_HIGHMEM | ||
1045 | BUILD_BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START); | ||
1046 | BUILD_BUG_ON(VMALLOC_END > PKMAP_BASE); | ||
1047 | #endif | ||
1048 | #define high_memory (-128UL << 20) | ||
1049 | BUILD_BUG_ON(VMALLOC_START >= VMALLOC_END); | ||
1050 | #undef high_memory | ||
1051 | #undef __FIXADDR_TOP | ||
1052 | |||
1043 | #ifdef CONFIG_HIGHMEM | 1053 | #ifdef CONFIG_HIGHMEM |
1044 | BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START); | 1054 | BUG_ON(PKMAP_BASE + LAST_PKMAP*PAGE_SIZE > FIXADDR_START); |
1045 | BUG_ON(VMALLOC_END > PKMAP_BASE); | 1055 | BUG_ON(VMALLOC_END > PKMAP_BASE); |
1046 | #endif | 1056 | #endif |
1047 | BUG_ON(VMALLOC_START > VMALLOC_END); | 1057 | BUG_ON(VMALLOC_START >= VMALLOC_END); |
1048 | BUG_ON((unsigned long)high_memory > VMALLOC_START); | 1058 | BUG_ON((unsigned long)high_memory > VMALLOC_START); |
1049 | 1059 | ||
1050 | if (boot_cpu_data.wp_works_ok < 0) | 1060 | if (boot_cpu_data.wp_works_ok < 0) |