vserver 1.9.5.x5
[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|__GFP_ZERO);
27
28         return pgd;
29 }
30
31 static __inline__ void pgd_free(pgd_t *pgd)
32 {
33         free_page((unsigned long)pgd);
34 }
35
36 static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
37         unsigned long address)
38 {
39         pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
40
41         return pte;
42 }
43
44 static __inline__ struct page *pte_alloc_one(struct mm_struct *mm,
45         unsigned long address)
46 {
47         struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO);
48
49
50         return pte;
51 }
52
53 static __inline__ void pte_free_kernel(pte_t *pte)
54 {
55         free_page((unsigned long)pte);
56 }
57
58 static __inline__ void pte_free(struct page *pte)
59 {
60         __free_page(pte);
61 }
62
63 #define __pte_free_tlb(tlb, pte)        pte_free((pte))
64
65 /*
66  * allocating and freeing a pmd is trivial: the 1-entry pmd is
67  * inside the pgd, so has no extra memory associated with it.
68  * (In the PAE case we free the pmds as part of the pgd.)
69  */
70
71 #define pmd_alloc_one(mm, addr)         ({ BUG(); ((pmd_t *)2); })
72 #define pmd_free(x)                     do { } while (0)
73 #define __pmd_free_tlb(tlb, x)          do { } while (0)
74 #define pgd_populate(mm, pmd, pte)      BUG()
75
76 #define check_pgt_cache()       do { } while (0)
77
78 #endif /* _ASM_M32R_PGALLOC_H */
79