2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2003 by Ralf Baechle
8 #include <linux/init.h>
10 #include <linux/bootmem.h>
11 #include <linux/highmem.h>
12 #include <asm/fixmap.h>
13 #include <asm/pgtable.h>
15 void pgd_init(unsigned long page)
17 unsigned long *p = (unsigned long *) page;
20 for (i = 0; i < USER_PTRS_PER_PGD; i+=8) {
21 p[i + 0] = (unsigned long) invalid_pte_table;
22 p[i + 1] = (unsigned long) invalid_pte_table;
23 p[i + 2] = (unsigned long) invalid_pte_table;
24 p[i + 3] = (unsigned long) invalid_pte_table;
25 p[i + 4] = (unsigned long) invalid_pte_table;
26 p[i + 5] = (unsigned long) invalid_pte_table;
27 p[i + 6] = (unsigned long) invalid_pte_table;
28 p[i + 7] = (unsigned long) invalid_pte_table;
32 void __init pagetable_init(void)
36 pgd_t *pgd, *pgd_base;
42 /* Initialize the entire pgd. */
43 pgd_init((unsigned long)swapper_pg_dir);
44 pgd_init((unsigned long)swapper_pg_dir
45 + sizeof(pgd_t) * USER_PTRS_PER_PGD);
48 pgd_base = swapper_pg_dir;
53 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
54 fixrange_init(vaddr, 0, pgd_base);
60 fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
62 pgd = swapper_pg_dir + __pgd_offset(vaddr);
63 pud = pud_offset(pgd, vaddr);
64 pmd = pmd_offset(pud, vaddr);
65 pte = pte_offset_kernel(pmd, vaddr);
66 pkmap_page_table = pte;