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