[PATCH] i386: iOPL handling for paravirt guests
[wrt350n-kernel.git] / include / asm-i386 / pgalloc.h
blobc8dc2d0141a71f5bdd1e3bfa7e19bfc9e868e917
1 #ifndef _I386_PGALLOC_H
2 #define _I386_PGALLOC_H
4 #include <asm/fixmap.h>
5 #include <linux/threads.h>
6 #include <linux/mm.h> /* for struct page */
8 #ifdef CONFIG_PARAVIRT
9 #include <asm/paravirt.h>
10 #else
11 #define paravirt_alloc_pt(pfn) do { } while (0)
12 #define paravirt_alloc_pd(pfn) do { } while (0)
13 #define paravirt_alloc_pd(pfn) do { } while (0)
14 #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
15 #define paravirt_release_pt(pfn) do { } while (0)
16 #define paravirt_release_pd(pfn) do { } while (0)
17 #endif
19 #define pmd_populate_kernel(mm, pmd, pte) \
20 do { \
21 paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \
22 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
23 } while (0)
25 #define pmd_populate(mm, pmd, pte) \
26 do { \
27 paravirt_alloc_pt(page_to_pfn(pte)); \
28 set_pmd(pmd, __pmd(_PAGE_TABLE + \
29 ((unsigned long long)page_to_pfn(pte) << \
30 (unsigned long long) PAGE_SHIFT))); \
31 } while (0)
34 * Allocate and free page tables.
36 extern pgd_t *pgd_alloc(struct mm_struct *);
37 extern void pgd_free(pgd_t *pgd);
39 extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
40 extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
42 static inline void pte_free_kernel(pte_t *pte)
44 free_page((unsigned long)pte);
47 static inline void pte_free(struct page *pte)
49 __free_page(pte);
53 #define __pte_free_tlb(tlb,pte) \
54 do { \
55 paravirt_release_pt(page_to_pfn(pte)); \
56 tlb_remove_page((tlb),(pte)); \
57 } while (0)
59 #ifdef CONFIG_X86_PAE
61 * In the PAE case we free the pmds as part of the pgd.
63 #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
64 #define pmd_free(x) do { } while (0)
65 #define __pmd_free_tlb(tlb,x) do { } while (0)
66 #define pud_populate(mm, pmd, pte) BUG()
67 #endif
69 #define check_pgt_cache() do { } while (0)
71 #endif /* _I386_PGALLOC_H */