aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/pgtable-32.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/mm/pgtable-32.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/mips/mm/pgtable-32.c')
-rw-r--r--arch/mips/mm/pgtable-32.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c
new file mode 100644
index 000000000000..4f07f81e8500
--- /dev/null
+++ b/arch/mips/mm/pgtable-32.c
@@ -0,0 +1,97 @@
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) 2003 by Ralf Baechle
7 */
8#include <linux/config.h>
9#include <linux/init.h>
10#include <linux/mm.h>
11#include <linux/bootmem.h>
12#include <linux/highmem.h>
13#include <asm/pgtable.h>
14
15void pgd_init(unsigned long page)
16{
17 unsigned long *p = (unsigned long *) page;
18 int i;
19
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;
29 }
30}
31
32#ifdef CONFIG_HIGHMEM
33static void __init fixrange_init (unsigned long start, unsigned long end,
34 pgd_t *pgd_base)
35{
36 pgd_t *pgd;
37 pmd_t *pmd;
38 pte_t *pte;
39 int i, j;
40 unsigned long vaddr;
41
42 vaddr = start;
43 i = __pgd_offset(vaddr);
44 j = __pmd_offset(vaddr);
45 pgd = pgd_base + i;
46
47 for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) {
48 pmd = (pmd_t *)pgd;
49 for (; (j < PTRS_PER_PMD) && (vaddr != end); pmd++, j++) {
50 if (pmd_none(*pmd)) {
51 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
52 set_pmd(pmd, __pmd((unsigned long)pte));
53 if (pte != pte_offset_kernel(pmd, 0))
54 BUG();
55 }
56 vaddr += PMD_SIZE;
57 }
58 j = 0;
59 }
60}
61#endif
62
63void __init pagetable_init(void)
64{
65#ifdef CONFIG_HIGHMEM
66 unsigned long vaddr;
67 pgd_t *pgd, *pgd_base;
68 pmd_t *pmd;
69 pte_t *pte;
70#endif
71
72 /* Initialize the entire pgd. */
73 pgd_init((unsigned long)swapper_pg_dir);
74 pgd_init((unsigned long)swapper_pg_dir
75 + sizeof(pgd_t) * USER_PTRS_PER_PGD);
76
77#ifdef CONFIG_HIGHMEM
78 pgd_base = swapper_pg_dir;
79
80 /*
81 * Fixed mappings:
82 */
83 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
84 fixrange_init(vaddr, 0, pgd_base);
85
86 /*
87 * Permanent kmaps:
88 */
89 vaddr = PKMAP_BASE;
90 fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
91
92 pgd = swapper_pg_dir + __pgd_offset(vaddr);
93 pmd = pmd_offset(pgd, vaddr);
94 pte = pte_offset_kernel(pmd, vaddr);
95 pkmap_page_table = pte;
96#endif
97}