Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _I386_PGALLOC_H |
| 2 | #define _I386_PGALLOC_H |
| 3 | |
| 4 | #include <linux/config.h> |
| 5 | #include <asm/fixmap.h> |
| 6 | #include <linux/threads.h> |
| 7 | #include <linux/mm.h> /* for struct page */ |
| 8 | |
| 9 | #define pmd_populate_kernel(mm, pmd, pte) \ |
| 10 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) |
| 11 | |
| 12 | #define pmd_populate(mm, pmd, pte) \ |
| 13 | set_pmd(pmd, __pmd(_PAGE_TABLE + \ |
| 14 | ((unsigned long long)page_to_pfn(pte) << \ |
| 15 | (unsigned long long) PAGE_SHIFT))) |
| 16 | /* |
| 17 | * Allocate and free page tables. |
| 18 | */ |
| 19 | extern pgd_t *pgd_alloc(struct mm_struct *); |
| 20 | extern void pgd_free(pgd_t *pgd); |
| 21 | |
| 22 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); |
| 23 | extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); |
| 24 | |
| 25 | static inline void pte_free_kernel(pte_t *pte) |
| 26 | { |
| 27 | free_page((unsigned long)pte); |
| 28 | } |
| 29 | |
| 30 | static inline void pte_free(struct page *pte) |
| 31 | { |
| 32 | __free_page(pte); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) |
| 37 | |
| 38 | #ifdef CONFIG_X86_PAE |
| 39 | /* |
| 40 | * In the PAE case we free the pmds as part of the pgd. |
| 41 | */ |
| 42 | #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) |
| 43 | #define pmd_free(x) do { } while (0) |
| 44 | #define __pmd_free_tlb(tlb,x) do { } while (0) |
| 45 | #define pud_populate(mm, pmd, pte) BUG() |
| 46 | #endif |
| 47 | |
| 48 | #define check_pgt_cache() do { } while (0) |
| 49 | |
| 50 | #endif /* _I386_PGALLOC_H */ |