ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-um / pgalloc.h
1 /* 
2  * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3  * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
4  * Licensed under the GPL
5  */
6
7 #ifndef __UM_PGALLOC_H
8 #define __UM_PGALLOC_H
9
10 #include "linux/mm.h"
11 #include "asm/fixmap.h"
12
13 #define pmd_populate_kernel(mm, pmd, pte) \
14                 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
15
16 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 
17                                 struct page *pte)
18 {
19         set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte)));
20 }
21
22 extern pgd_t *pgd_alloc(struct mm_struct *);
23 extern void pgd_free(pgd_t *pgd);
24
25 extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
26 extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
27
28 static inline void pte_free_kernel(pte_t *pte)
29 {
30         free_page((unsigned long) pte);
31 }
32
33 static inline void pte_free(struct page *pte)
34 {
35         __free_page(pte);
36 }
37
38 #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
39
40 /*
41  * allocating and freeing a pmd is trivial: the 1-entry pmd is
42  * inside the pgd, so has no extra memory associated with it.
43  */
44
45 #define pmd_alloc_one(mm, addr)         ({ BUG(); ((pmd_t *)2); })
46 #define pmd_free(x)                     do { } while (0)
47 #define __pmd_free_tlb(tlb,x)           do { } while (0)
48 #define pgd_populate(mm, pmd, pte)      BUG()
49
50 #define check_pgt_cache()       do { } while (0)
51
52 #endif
53
54 /*
55  * Overrides for Emacs so that we follow Linus's tabbing style.
56  * Emacs will notice this stuff at the end of the file and automatically
57  * adjust the settings for this buffer only.  This must remain at the end
58  * of the file.
59  * ---------------------------------------------------------------------------
60  * Local variables:
61  * c-file-style: "linux"
62  * End:
63  */