This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-m32r / pgalloc.h
1 #ifndef _ASM_M32R_PGALLOC_H
2 #define _ASM_M32R_PGALLOC_H
3
4 /* $Id$ */
5
6 #include <linux/config.h>
7 #include <linux/mm.h>
8
9 #include <asm/io.h>
10 #include <asm/pgtable.h>
11
12 #define pmd_populate_kernel(mm, pmd, pte)       \
13         set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
14
15 static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
16         struct page *pte)
17 {
18         set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte)));
19 }
20
21 /*
22  * Allocate and free page tables.
23  */
24 static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
25 {
26         pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
27
28         if (pgd)
29                 clear_page(pgd);
30
31         return pgd;
32 }
33
34 static __inline__ void pgd_free(pgd_t *pgd)
35 {
36         free_page((unsigned long)pgd);
37 }
38
39 static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
40         unsigned long address)
41 {
42         pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL);
43
44         if (pte)
45                 clear_page(pte);
46
47         return pte;
48 }
49
50 static __inline__ struct page *pte_alloc_one(struct mm_struct *mm,
51         unsigned long address)
52 {
53         struct page *pte = alloc_page(GFP_KERNEL);
54
55         if (pte)
56                 clear_page(page_address(pte));
57
58         return pte;
59 }
60
61 static __inline__ void pte_free_kernel(pte_t *pte)
62 {
63         free_page((unsigned long)pte);
64 }
65
66 static __inline__ void pte_free(struct page *pte)
67 {
68         __free_page(pte);
69 }
70
71 #define __pte_free_tlb(tlb, pte)        pte_free((pte))
72
73 /*
74  * allocating and freeing a pmd is trivial: the 1-entry pmd is
75  * inside the pgd, so has no extra memory associated with it.
76  * (In the PAE case we free the pmds as part of the pgd.)
77  */
78
79 #define pmd_alloc_one(mm, addr)         ({ BUG(); ((pmd_t *)2); })
80 #define pmd_free(x)                     do { } while (0)
81 #define __pmd_free_tlb(tlb, x)          do { } while (0)
82 #define pgd_populate(mm, pmd, pte)      BUG()
83
84 #define check_pgt_cache()       do { } while (0)
85
86 #endif /* _ASM_M32R_PGALLOC_H */
87