diff options
Diffstat (limited to 'arch/x86/include/asm/pgtable_64.h')
-rw-r--r-- | arch/x86/include/asm/pgtable_64.h | 113 |
1 files changed, 2 insertions, 111 deletions
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index ba09289acca..6b87bc6d501 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _ASM_X86_PGTABLE_64_H | 2 | #define _ASM_X86_PGTABLE_64_H |
3 | 3 | ||
4 | #include <linux/const.h> | 4 | #include <linux/const.h> |
5 | #include <asm/pgtable_64_types.h> | ||
6 | |||
5 | #ifndef __ASSEMBLY__ | 7 | #ifndef __ASSEMBLY__ |
6 | 8 | ||
7 | /* | 9 | /* |
@@ -11,7 +13,6 @@ | |||
11 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
12 | #include <linux/bitops.h> | 14 | #include <linux/bitops.h> |
13 | #include <linux/threads.h> | 15 | #include <linux/threads.h> |
14 | #include <asm/pda.h> | ||
15 | 16 | ||
16 | extern pud_t level3_kernel_pgt[512]; | 17 | extern pud_t level3_kernel_pgt[512]; |
17 | extern pud_t level3_ident_pgt[512]; | 18 | extern pud_t level3_ident_pgt[512]; |
@@ -26,32 +27,6 @@ extern void paging_init(void); | |||
26 | 27 | ||
27 | #endif /* !__ASSEMBLY__ */ | 28 | #endif /* !__ASSEMBLY__ */ |
28 | 29 | ||
29 | #define SHARED_KERNEL_PMD 0 | ||
30 | |||
31 | /* | ||
32 | * PGDIR_SHIFT determines what a top-level page table entry can map | ||
33 | */ | ||
34 | #define PGDIR_SHIFT 39 | ||
35 | #define PTRS_PER_PGD 512 | ||
36 | |||
37 | /* | ||
38 | * 3rd level page | ||
39 | */ | ||
40 | #define PUD_SHIFT 30 | ||
41 | #define PTRS_PER_PUD 512 | ||
42 | |||
43 | /* | ||
44 | * PMD_SHIFT determines the size of the area a middle-level | ||
45 | * page table can map | ||
46 | */ | ||
47 | #define PMD_SHIFT 21 | ||
48 | #define PTRS_PER_PMD 512 | ||
49 | |||
50 | /* | ||
51 | * entries per page directory level | ||
52 | */ | ||
53 | #define PTRS_PER_PTE 512 | ||
54 | |||
55 | #ifndef __ASSEMBLY__ | 30 | #ifndef __ASSEMBLY__ |
56 | 31 | ||
57 | #define pte_ERROR(e) \ | 32 | #define pte_ERROR(e) \ |
@@ -67,9 +42,6 @@ extern void paging_init(void); | |||
67 | printk("%s:%d: bad pgd %p(%016lx).\n", \ | 42 | printk("%s:%d: bad pgd %p(%016lx).\n", \ |
68 | __FILE__, __LINE__, &(e), pgd_val(e)) | 43 | __FILE__, __LINE__, &(e), pgd_val(e)) |
69 | 44 | ||
70 | #define pgd_none(x) (!pgd_val(x)) | ||
71 | #define pud_none(x) (!pud_val(x)) | ||
72 | |||
73 | struct mm_struct; | 45 | struct mm_struct; |
74 | 46 | ||
75 | void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte); | 47 | void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte); |
@@ -134,48 +106,6 @@ static inline void native_pgd_clear(pgd_t *pgd) | |||
134 | native_set_pgd(pgd, native_make_pgd(0)); | 106 | native_set_pgd(pgd, native_make_pgd(0)); |
135 | } | 107 | } |
136 | 108 | ||
137 | #define pte_same(a, b) ((a).pte == (b).pte) | ||
138 | |||
139 | #endif /* !__ASSEMBLY__ */ | ||
140 | |||
141 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT) | ||
142 | #define PMD_MASK (~(PMD_SIZE - 1)) | ||
143 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT) | ||
144 | #define PUD_MASK (~(PUD_SIZE - 1)) | ||
145 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) | ||
146 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) | ||
147 | |||
148 | |||
149 | #define MAXMEM _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL) | ||
150 | #define VMALLOC_START _AC(0xffffc20000000000, UL) | ||
151 | #define VMALLOC_END _AC(0xffffe1ffffffffff, UL) | ||
152 | #define VMEMMAP_START _AC(0xffffe20000000000, UL) | ||
153 | #define MODULES_VADDR _AC(0xffffffffa0000000, UL) | ||
154 | #define MODULES_END _AC(0xffffffffff000000, UL) | ||
155 | #define MODULES_LEN (MODULES_END - MODULES_VADDR) | ||
156 | |||
157 | #ifndef __ASSEMBLY__ | ||
158 | |||
159 | static inline int pgd_bad(pgd_t pgd) | ||
160 | { | ||
161 | return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; | ||
162 | } | ||
163 | |||
164 | static inline int pud_bad(pud_t pud) | ||
165 | { | ||
166 | return (pud_val(pud) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; | ||
167 | } | ||
168 | |||
169 | static inline int pmd_bad(pmd_t pmd) | ||
170 | { | ||
171 | return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; | ||
172 | } | ||
173 | |||
174 | #define pte_none(x) (!pte_val((x))) | ||
175 | #define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE)) | ||
176 | |||
177 | #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */ | ||
178 | |||
179 | /* | 109 | /* |
180 | * Conversion functions: convert a page and protection to a page entry, | 110 | * Conversion functions: convert a page and protection to a page entry, |
181 | * and a page entry and page directory to the page they refer to. | 111 | * and a page entry and page directory to the page they refer to. |
@@ -184,41 +114,12 @@ static inline int pmd_bad(pmd_t pmd) | |||
184 | /* | 114 | /* |
185 | * Level 4 access. | 115 | * Level 4 access. |
186 | */ | 116 | */ |
187 | #define pgd_page_vaddr(pgd) \ | ||
188 | ((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_PFN_MASK)) | ||
189 | #define pgd_page(pgd) (pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT)) | ||
190 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT) | ||
191 | static inline int pgd_large(pgd_t pgd) { return 0; } | 117 | static inline int pgd_large(pgd_t pgd) { return 0; } |
192 | #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE) | 118 | #define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE) |
193 | 119 | ||
194 | /* PUD - Level3 access */ | 120 | /* PUD - Level3 access */ |
195 | /* to find an entry in a page-table-directory. */ | ||
196 | #define pud_page_vaddr(pud) \ | ||
197 | ((unsigned long)__va(pud_val((pud)) & PHYSICAL_PAGE_MASK)) | ||
198 | #define pud_page(pud) (pfn_to_page(pud_val((pud)) >> PAGE_SHIFT)) | ||
199 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)) | ||
200 | #define pud_offset(pgd, address) \ | ||
201 | ((pud_t *)pgd_page_vaddr(*(pgd)) + pud_index((address))) | ||
202 | #define pud_present(pud) (pud_val((pud)) & _PAGE_PRESENT) | ||
203 | |||
204 | static inline int pud_large(pud_t pte) | ||
205 | { | ||
206 | return (pud_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == | ||
207 | (_PAGE_PSE | _PAGE_PRESENT); | ||
208 | } | ||
209 | 121 | ||
210 | /* PMD - Level 2 access */ | 122 | /* PMD - Level 2 access */ |
211 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val((pmd)) & PTE_PFN_MASK)) | ||
212 | #define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT)) | ||
213 | |||
214 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) | ||
215 | #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \ | ||
216 | pmd_index(address)) | ||
217 | #define pmd_none(x) (!pmd_val((x))) | ||
218 | #define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT) | ||
219 | #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot)))) | ||
220 | #define pmd_pfn(x) ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT) | ||
221 | |||
222 | #define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT) | 123 | #define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT) |
223 | #define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) | \ | 124 | #define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) | \ |
224 | _PAGE_FILE }) | 125 | _PAGE_FILE }) |
@@ -226,13 +127,6 @@ static inline int pud_large(pud_t pte) | |||
226 | 127 | ||
227 | /* PTE - Level 1 access. */ | 128 | /* PTE - Level 1 access. */ |
228 | 129 | ||
229 | /* page, protection -> pte */ | ||
230 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn((page)), (pgprot)) | ||
231 | |||
232 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
233 | #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \ | ||
234 | pte_index((address))) | ||
235 | |||
236 | /* x86-64 always has all page tables mapped. */ | 130 | /* x86-64 always has all page tables mapped. */ |
237 | #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) | 131 | #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) |
238 | #define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address)) | 132 | #define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address)) |
@@ -266,9 +160,6 @@ extern int direct_gbpages; | |||
266 | extern int kern_addr_valid(unsigned long addr); | 160 | extern int kern_addr_valid(unsigned long addr); |
267 | extern void cleanup_highmap(void); | 161 | extern void cleanup_highmap(void); |
268 | 162 | ||
269 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | ||
270 | remap_pfn_range(vma, vaddr, pfn, size, prot) | ||
271 | |||
272 | #define HAVE_ARCH_UNMAPPED_AREA | 163 | #define HAVE_ARCH_UNMAPPED_AREA |
273 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN | 164 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN |
274 | 165 | ||