1
2
3
4#ifndef _ASMNDS32_PGALLOC_H
5#define _ASMNDS32_PGALLOC_H
6
7#include <asm/processor.h>
8#include <asm/cacheflush.h>
9#include <asm/tlbflush.h>
10#include <asm/proc-fns.h>
11
12
13
14
15#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
16#define pmd_free(mm, pmd) do { } while (0)
17#define pgd_populate(mm, pmd, pte) BUG()
18#define pmd_pgtable(pmd) pmd_page(pmd)
19
20extern pgd_t *pgd_alloc(struct mm_struct *mm);
21extern void pgd_free(struct mm_struct *mm, pgd_t * pgd);
22
23#define check_pgt_cache() do { } while (0)
24
25static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
26 unsigned long addr)
27{
28 pte_t *pte;
29
30 pte =
31 (pte_t *) __get_free_page(GFP_KERNEL | __GFP_RETRY_MAYFAIL |
32 __GFP_ZERO);
33
34 return pte;
35}
36
37static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr)
38{
39 pgtable_t pte;
40
41 pte = alloc_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_ZERO, 0);
42 if (pte)
43 cpu_dcache_wb_page((unsigned long)page_address(pte));
44
45 return pte;
46}
47
48
49
50
51static inline void pte_free_kernel(struct mm_struct *mm, pte_t * pte)
52{
53 if (pte) {
54 free_page((unsigned long)pte);
55 }
56}
57
58static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
59{
60 __free_page(pte);
61}
62
63
64
65
66
67
68
69static inline void
70pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmdp, pte_t * ptep)
71{
72 unsigned long pte_ptr = (unsigned long)ptep;
73 unsigned long pmdval;
74
75 BUG_ON(mm != &init_mm);
76
77
78
79
80
81 pmdval = __pa(pte_ptr) | _PAGE_KERNEL_TABLE;
82 set_pmd(pmdp, __pmd(pmdval));
83}
84
85static inline void
86pmd_populate(struct mm_struct *mm, pmd_t * pmdp, pgtable_t ptep)
87{
88 unsigned long pmdval;
89
90 BUG_ON(mm == &init_mm);
91
92 pmdval = page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE;
93 set_pmd(pmdp, __pmd(pmdval));
94}
95
96#endif
97