diff options
-rw-r--r-- | arch/x86/mm/init_32.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 3c76d194fd2c..e6e34c7dcabf 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -165,16 +165,25 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) | |||
165 | pmd = one_md_table_init(pgd); | 165 | pmd = one_md_table_init(pgd); |
166 | if (pfn >= max_low_pfn) | 166 | if (pfn >= max_low_pfn) |
167 | continue; | 167 | continue; |
168 | for (pmd_idx = 0; pmd_idx < PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_idx++) { | 168 | for (pmd_idx = 0; |
169 | pmd_idx < PTRS_PER_PMD && pfn < max_low_pfn; | ||
170 | pmd++, pmd_idx++) { | ||
169 | unsigned int address = pfn * PAGE_SIZE + PAGE_OFFSET; | 171 | unsigned int address = pfn * PAGE_SIZE + PAGE_OFFSET; |
170 | 172 | ||
171 | /* Map with big pages if possible, otherwise create normal page tables. */ | 173 | /* Map with big pages if possible, otherwise |
174 | create normal page tables. */ | ||
172 | if (cpu_has_pse) { | 175 | if (cpu_has_pse) { |
173 | unsigned int address2 = (pfn + PTRS_PER_PTE - 1) * PAGE_SIZE + PAGE_OFFSET + PAGE_SIZE-1; | 176 | unsigned int address2; |
174 | if (is_kernel_text(address) || is_kernel_text(address2)) | 177 | pgprot_t prot = PAGE_KERNEL_LARGE; |
175 | set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE_EXEC)); | 178 | |
176 | else | 179 | address2 = (pfn + PTRS_PER_PTE - 1) * PAGE_SIZE + |
177 | set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE)); | 180 | PAGE_OFFSET + PAGE_SIZE-1; |
181 | |||
182 | if (is_kernel_text(address) || | ||
183 | is_kernel_text(address2)) | ||
184 | prot = PAGE_KERNEL_LARGE_EXEC; | ||
185 | |||
186 | set_pmd(pmd, pfn_pmd(pfn, prot)); | ||
178 | 187 | ||
179 | pfn += PTRS_PER_PTE; | 188 | pfn += PTRS_PER_PTE; |
180 | } else { | 189 | } else { |
@@ -183,10 +192,12 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base) | |||
183 | for (pte_ofs = 0; | 192 | for (pte_ofs = 0; |
184 | pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; | 193 | pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; |
185 | pte++, pfn++, pte_ofs++, address += PAGE_SIZE) { | 194 | pte++, pfn++, pte_ofs++, address += PAGE_SIZE) { |
195 | pgprot_t prot = PAGE_KERNEL; | ||
196 | |||
186 | if (is_kernel_text(address)) | 197 | if (is_kernel_text(address)) |
187 | set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC)); | 198 | prot = PAGE_KERNEL_EXEC; |
188 | else | 199 | |
189 | set_pte(pte, pfn_pte(pfn, PAGE_KERNEL)); | 200 | set_pte(pte, pfn_pte(pfn, prot)); |
190 | } | 201 | } |
191 | } | 202 | } |
192 | } | 203 | } |