ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-i386 / pgalloc.h
1 #ifndef _I386_PGALLOC_H
2 #define _I386_PGALLOC_H
3
4 #include <linux/config.h>
5 #include <asm/processor.h>
6 #include <asm/fixmap.h>
7 #include <linux/threads.h>
8 #include <linux/mm.h>           /* for struct page */
9
10 #define pmd_populate_kernel(mm, pmd, pte) \
11                 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
12
13 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
14 {
15         set_pmd(pmd, __pmd(_PAGE_TABLE +
16                 ((unsigned long long)page_to_pfn(pte) <<
17                         (unsigned long long) PAGE_SHIFT)));
18 }
19 /*
20  * Allocate and free page tables.
21  */
22
23 extern pgd_t *pgd_alloc(struct mm_struct *);
24 extern void pgd_free(pgd_t *pgd);
25
26 extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
27 extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
28
29 static inline void pte_free_kernel(pte_t *pte)
30 {
31         free_page((unsigned long)pte);
32 }
33
34 static inline void pte_free(struct page *pte)
35 {
36         __free_page(pte);
37 }
38
39
40 #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
41
42 /*
43  * allocating and freeing a pmd is trivial: the 1-entry pmd is
44  * inside the pgd, so has no extra memory associated with it.
45  * (In the PAE case we free the pmds as part of the pgd.)
46  */
47
48 #define pmd_alloc_one(mm, addr)         ({ BUG(); ((pmd_t *)2); })
49 #define pmd_free(x)                     do { } while (0)
50 #define __pmd_free_tlb(tlb,x)           do { } while (0)
51 #define pgd_populate(mm, pmd, pte)      BUG()
52
53 #define check_pgt_cache()       do { } while (0)
54
55 #endif /* _I386_PGALLOC_H */