aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68k/motorola_pgalloc.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-m68k/motorola_pgalloc.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-m68k/motorola_pgalloc.h')
-rw-r--r--include/asm-m68k/motorola_pgalloc.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h
new file mode 100644
index 000000000000..5158412cd54d
--- /dev/null
+++ b/include/asm-m68k/motorola_pgalloc.h
@@ -0,0 +1,107 @@
1#ifndef _MOTOROLA_PGALLOC_H
2#define _MOTOROLA_PGALLOC_H
3
4#include <asm/tlb.h>
5#include <asm/tlbflush.h>
6
7extern pmd_t *get_pointer_table(void);
8extern int free_pointer_table(pmd_t *);
9
10
11static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
12{
13 pte_t *pte;
14
15 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
16 if (pte) {
17 __flush_page_to_ram(pte);
18 flush_tlb_kernel_page(pte);
19 nocache_page(pte);
20 }
21
22 return pte;
23}
24
25static inline void pte_free_kernel(pte_t *pte)
26{
27 cache_page(pte);
28 free_page((unsigned long) pte);
29}
30
31static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
32{
33 struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
34 pte_t *pte;
35
36 if(!page)
37 return NULL;
38
39 pte = kmap(page);
40 if (pte) {
41 __flush_page_to_ram(pte);
42 flush_tlb_kernel_page(pte);
43 nocache_page(pte);
44 }
45 kunmap(pte);
46
47 return page;
48}
49
50static inline void pte_free(struct page *page)
51{
52 cache_page(kmap(page));
53 kunmap(page);
54 __free_page(page);
55}
56
57static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *page)
58{
59 cache_page(kmap(page));
60 kunmap(page);
61 __free_page(page);
62}
63
64
65static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
66{
67 return get_pointer_table();
68}
69
70static inline int pmd_free(pmd_t *pmd)
71{
72 return free_pointer_table(pmd);
73}
74
75static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
76{
77 return free_pointer_table(pmd);
78}
79
80
81static inline void pgd_free(pgd_t *pgd)
82{
83 pmd_free((pmd_t *)pgd);
84}
85
86static inline pgd_t *pgd_alloc(struct mm_struct *mm)
87{
88 return (pgd_t *)get_pointer_table();
89}
90
91
92static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
93{
94 pmd_set(pmd, pte);
95}
96
97static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
98{
99 pmd_set(pmd, page_address(page));
100}
101
102static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
103{
104 pgd_set(pgd, pmd);
105}
106
107#endif /* _MOTOROLA_PGALLOC_H */