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(void *addr
)
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 *) addr
;
30 end
= p
+ PTRS_PER_PGD
;
45 #ifndef __PAGETABLE_PMD_FOLDED
46 void pmd_init(void *addr
)
48 unsigned long *p
, *end
;
49 unsigned long pagetable
= (unsigned long)invalid_pte_table
;
51 p
= (unsigned long *)addr
;
52 end
= p
+ PTRS_PER_PMD
;
66 EXPORT_SYMBOL_GPL(pmd_init
);
69 #ifndef __PAGETABLE_PUD_FOLDED
70 void pud_init(void *addr
)
72 unsigned long *p
, *end
;
73 unsigned long pagetable
= (unsigned long)invalid_pmd_table
;
75 p
= (unsigned long *)addr
;
76 end
= p
+ PTRS_PER_PUD
;
92 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
93 pmd_t
mk_pmd(struct page
*page
, pgprot_t prot
)
97 pmd_val(pmd
) = (page_to_pfn(page
) << PFN_PTE_SHIFT
) | pgprot_val(prot
);
102 void set_pmd_at(struct mm_struct
*mm
, unsigned long addr
,
103 pmd_t
*pmdp
, pmd_t pmd
)
109 void __init
pagetable_init(void)
114 /* Initialize the entire pgd. */
115 pgd_init(swapper_pg_dir
);
116 #ifndef __PAGETABLE_PUD_FOLDED
117 pud_init(invalid_pud_table
);
119 #ifndef __PAGETABLE_PMD_FOLDED
120 pmd_init(invalid_pmd_table
);
122 pgd_base
= swapper_pg_dir
;
126 vaddr
= __fix_to_virt(__end_of_fixed_addresses
- 1) & PMD_MASK
;
127 fixrange_init(vaddr
, vaddr
+ FIXADDR_SIZE
, pgd_base
);