From 482368b1a8e45430672c58c9a42e7d2004367126 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 24 Feb 2000 00:12:35 +0000 Subject: Merge with 2.3.47. Guys, this is buggy as shit. You've been warned. --- arch/i386/mm/init.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'arch/i386/mm') diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 4ef25674f..c3991b056 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c @@ -307,27 +307,30 @@ static void __init pagetable_init(void) pmd_t *pmd; pte_t *pte; int i, j, k; - unsigned long vaddr; - unsigned long end = (unsigned long)__va(max_low_pfn*PAGE_SIZE); + unsigned long vaddr, end; - pgd_base = swapper_pg_dir; + end = (unsigned long)__va(max_low_pfn*PAGE_SIZE) - 1; - vaddr = PAGE_OFFSET; - i = __pgd_offset(vaddr); + i = __pgd_offset(PAGE_OFFSET); + pgd_base = swapper_pg_dir; pgd = pgd_base + i; - for (; (i < PTRS_PER_PGD) && (vaddr <= end); pgd++, i++) { + for (; i < PTRS_PER_PGD; pgd++, i++) { vaddr = i*PGDIR_SIZE; + if (vaddr >= end) + break; #if CONFIG_X86_PAE - pmd = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); + pmd = (pmd_t *) alloc_bootmem_pages(PAGE_SIZE); set_pgd(pgd, __pgd(__pa(pmd) + 0x1)); #else pmd = (pmd_t *)pgd; #endif if (pmd != pmd_offset(pgd, 0)) BUG(); - for (j = 0; (j < PTRS_PER_PMD) && (vaddr <= end); pmd++, j++) { + for (j = 0; j < PTRS_PER_PMD; pmd++, j++) { vaddr = i*PGDIR_SIZE + j*PMD_SIZE; + if (vaddr >= end) + break; if (cpu_has_pse) { unsigned long __pe; @@ -349,10 +352,10 @@ static void __init pagetable_init(void) if (pte != pte_offset(pmd, 0)) BUG(); - for (k = 0; - (k < PTRS_PER_PTE) && (vaddr <= end); - pte++, k++) { + for (k = 0; k < PTRS_PER_PTE; pte++, k++) { vaddr = i*PGDIR_SIZE + j*PMD_SIZE + k*PAGE_SIZE; + if (vaddr >= end) + break; *pte = mk_pte_phys(__pa(vaddr), PAGE_KERNEL); } } -- cgit v1.2.3