Merge branch 'linux-2.6' into for-linus
[linux-2.6] / arch / mips / mm / pgtable-64.c
1 /*
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
4  * for more details.
5  *
6  * Copyright (C) 1999, 2000 by Silicon Graphics
7  * Copyright (C) 2003 by Ralf Baechle
8  */
9 #include <linux/init.h>
10 #include <linux/mm.h>
11 #include <asm/fixmap.h>
12 #include <asm/pgtable.h>
13
14 void pgd_init(unsigned long page)
15 {
16         unsigned long *p, *end;
17
18         p = (unsigned long *) page;
19         end = p + PTRS_PER_PGD;
20
21         while (p < end) {
22                 p[0] = (unsigned long) invalid_pmd_table;
23                 p[1] = (unsigned long) invalid_pmd_table;
24                 p[2] = (unsigned long) invalid_pmd_table;
25                 p[3] = (unsigned long) invalid_pmd_table;
26                 p[4] = (unsigned long) invalid_pmd_table;
27                 p[5] = (unsigned long) invalid_pmd_table;
28                 p[6] = (unsigned long) invalid_pmd_table;
29                 p[7] = (unsigned long) invalid_pmd_table;
30                 p += 8;
31         }
32 }
33
34 void pmd_init(unsigned long addr, unsigned long pagetable)
35 {
36         unsigned long *p, *end;
37
38         p = (unsigned long *) addr;
39         end = p + PTRS_PER_PMD;
40
41         while (p < end) {
42                 p[0] = (unsigned long)pagetable;
43                 p[1] = (unsigned long)pagetable;
44                 p[2] = (unsigned long)pagetable;
45                 p[3] = (unsigned long)pagetable;
46                 p[4] = (unsigned long)pagetable;
47                 p[5] = (unsigned long)pagetable;
48                 p[6] = (unsigned long)pagetable;
49                 p[7] = (unsigned long)pagetable;
50                 p += 8;
51         }
52 }
53
54 void __init pagetable_init(void)
55 {
56         unsigned long vaddr;
57         pgd_t *pgd_base;
58
59         /* Initialize the entire pgd.  */
60         pgd_init((unsigned long)swapper_pg_dir);
61 #ifdef MODULE_START
62         pgd_init((unsigned long)module_pg_dir);
63 #endif
64         pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table);
65
66         pgd_base = swapper_pg_dir;
67         /*
68          * Fixed mappings:
69          */
70         vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
71         fixrange_init(vaddr, 0, pgd_base);
72 }