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) 1999, 2000 by Silicon Graphics
7 * Copyright (C) 2003 by Ralf Baechle
9 #include <linux/export.h>
10 #include <linux/init.h>
12 #include <asm/fixmap.h>
13 #include <asm/pgalloc.h>
14 #include <asm/tlbflush.h>
16 void pgd_init(unsigned long page
)
18 unsigned long *p
, *end
;
21 #if !defined(__PAGETABLE_PUD_FOLDED)
22 entry
= (unsigned long)invalid_pud_table
;
23 #elif !defined(__PAGETABLE_PMD_FOLDED)
24 entry
= (unsigned long)invalid_pmd_table
;
26 entry
= (unsigned long)invalid_pte_table
;
29 p
= (unsigned long *) page
;
30 end
= p
+ PTRS_PER_PGD
;
45 #ifndef __PAGETABLE_PMD_FOLDED
46 void pmd_init(unsigned long addr
, unsigned long pagetable
)
48 unsigned long *p
, *end
;
50 p
= (unsigned long *) addr
;
51 end
= p
+ PTRS_PER_PMD
;
65 EXPORT_SYMBOL_GPL(pmd_init
);
68 #ifndef __PAGETABLE_PUD_FOLDED
69 void pud_init(unsigned long addr
, unsigned long pagetable
)
71 unsigned long *p
, *end
;
73 p
= (unsigned long *)addr
;
74 end
= p
+ PTRS_PER_PUD
;
90 pmd_t
mk_pmd(struct page
*page
, pgprot_t prot
)
94 pmd_val(pmd
) = (page_to_pfn(page
) << _PFN_SHIFT
) | pgprot_val(prot
);
99 void set_pmd_at(struct mm_struct
*mm
, unsigned long addr
,
100 pmd_t
*pmdp
, pmd_t pmd
)
106 void __init
pagetable_init(void)
111 /* Initialize the entire pgd. */
112 pgd_init((unsigned long)swapper_pg_dir
);
113 #ifndef __PAGETABLE_PUD_FOLDED
114 pud_init((unsigned long)invalid_pud_table
, (unsigned long)invalid_pmd_table
);
116 #ifndef __PAGETABLE_PMD_FOLDED
117 pmd_init((unsigned long)invalid_pmd_table
, (unsigned long)invalid_pte_table
);
119 pgd_base
= swapper_pg_dir
;
123 vaddr
= __fix_to_virt(__end_of_fixed_addresses
- 1) & PMD_MASK
;
124 fixrange_init(vaddr
, vaddr
+ FIXADDR_SIZE
, pgd_base
);