xref: /linux/arch/um/include/asm/pgalloc.h (revision b8d312aa075f33282565467662c4628dae0a2aff)
1 /*
2  * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3  * Copyright 2003 PathScale, Inc.
4  * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
5  * Licensed under the GPL
6  */
7 
8 #ifndef __UM_PGALLOC_H
9 #define __UM_PGALLOC_H
10 
11 #include <linux/mm.h>
12 
13 #include <asm-generic/pgalloc.h>	/* for pte_{alloc,free}_one */
14 
15 #define pmd_populate_kernel(mm, pmd, pte) \
16 	set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
17 
18 #define pmd_populate(mm, pmd, pte) 				\
19 	set_pmd(pmd, __pmd(_PAGE_TABLE +			\
20 		((unsigned long long)page_to_pfn(pte) <<	\
21 			(unsigned long long) PAGE_SHIFT)))
22 #define pmd_pgtable(pmd) pmd_page(pmd)
23 
24 /*
25  * Allocate and free page tables.
26  */
27 extern pgd_t *pgd_alloc(struct mm_struct *);
28 extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
29 
30 #define __pte_free_tlb(tlb,pte, address)		\
31 do {							\
32 	pgtable_page_dtor(pte);				\
33 	tlb_remove_page((tlb),(pte));			\
34 } while (0)
35 
36 #ifdef CONFIG_3_LEVEL_PGTABLES
37 
38 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
39 {
40 	free_page((unsigned long)pmd);
41 }
42 
43 #define __pmd_free_tlb(tlb,x, address)   tlb_remove_page((tlb),virt_to_page(x))
44 #endif
45 
46 #define check_pgt_cache()	do { } while (0)
47 
48 #endif
49 
50