diff options
author | Joe Perches <joe@perches.com> | 2008-03-23 04:03:11 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:26 -0400 |
commit | 7f94401e439dc1137319c48dfec0285f681eb3ad (patch) | |
tree | e8f08824f51834889f42d34c889ce620268547a7 /include/asm-x86/pgtable_64.h | |
parent | 4b01fef89a10cedbae9857e76283616af3f177cd (diff) |
include/asm-x86/pgtable_64.h: checkpatch cleanups - formatting only
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/pgtable_64.h')
-rw-r--r-- | include/asm-x86/pgtable_64.h | 141 |
1 files changed, 76 insertions, 65 deletions
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h index 0a5081c98ae1..9fd87d0b6477 100644 --- a/include/asm-x86/pgtable_64.h +++ b/include/asm-x86/pgtable_64.h | |||
@@ -52,14 +52,18 @@ extern void paging_init(void); | |||
52 | 52 | ||
53 | #ifndef __ASSEMBLY__ | 53 | #ifndef __ASSEMBLY__ |
54 | 54 | ||
55 | #define pte_ERROR(e) \ | 55 | #define pte_ERROR(e) \ |
56 | printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) | 56 | printk("%s:%d: bad pte %p(%016lx).\n", \ |
57 | #define pmd_ERROR(e) \ | 57 | __FILE__, __LINE__, &(e), pte_val(e)) |
58 | printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), pmd_val(e)) | 58 | #define pmd_ERROR(e) \ |
59 | #define pud_ERROR(e) \ | 59 | printk("%s:%d: bad pmd %p(%016lx).\n", \ |
60 | printk("%s:%d: bad pud %p(%016lx).\n", __FILE__, __LINE__, &(e), pud_val(e)) | 60 | __FILE__, __LINE__, &(e), pmd_val(e)) |
61 | #define pgd_ERROR(e) \ | 61 | #define pud_ERROR(e) \ |
62 | printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) | 62 | printk("%s:%d: bad pud %p(%016lx).\n", \ |
63 | __FILE__, __LINE__, &(e), pud_val(e)) | ||
64 | #define pgd_ERROR(e) \ | ||
65 | printk("%s:%d: bad pgd %p(%016lx).\n", \ | ||
66 | __FILE__, __LINE__, &(e), pgd_val(e)) | ||
63 | 67 | ||
64 | #define pgd_none(x) (!pgd_val(x)) | 68 | #define pgd_none(x) (!pgd_val(x)) |
65 | #define pud_none(x) (!pud_val(x)) | 69 | #define pud_none(x) (!pud_val(x)) |
@@ -87,7 +91,8 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp) | |||
87 | #ifdef CONFIG_SMP | 91 | #ifdef CONFIG_SMP |
88 | return native_make_pte(xchg(&xp->pte, 0)); | 92 | return native_make_pte(xchg(&xp->pte, 0)); |
89 | #else | 93 | #else |
90 | /* native_local_ptep_get_and_clear, but duplicated because of cyclic dependency */ | 94 | /* native_local_ptep_get_and_clear, |
95 | but duplicated because of cyclic dependency */ | ||
91 | pte_t ret = *xp; | 96 | pte_t ret = *xp; |
92 | native_pte_clear(NULL, 0, xp); | 97 | native_pte_clear(NULL, 0, xp); |
93 | return ret; | 98 | return ret; |
@@ -119,7 +124,7 @@ static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd) | |||
119 | *pgdp = pgd; | 124 | *pgdp = pgd; |
120 | } | 125 | } |
121 | 126 | ||
122 | static inline void native_pgd_clear(pgd_t * pgd) | 127 | static inline void native_pgd_clear(pgd_t *pgd) |
123 | { | 128 | { |
124 | native_set_pgd(pgd, native_make_pgd(0)); | 129 | native_set_pgd(pgd, native_make_pgd(0)); |
125 | } | 130 | } |
@@ -128,15 +133,15 @@ static inline void native_pgd_clear(pgd_t * pgd) | |||
128 | 133 | ||
129 | #endif /* !__ASSEMBLY__ */ | 134 | #endif /* !__ASSEMBLY__ */ |
130 | 135 | ||
131 | #define PMD_SIZE (_AC(1,UL) << PMD_SHIFT) | 136 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT) |
132 | #define PMD_MASK (~(PMD_SIZE-1)) | 137 | #define PMD_MASK (~(PMD_SIZE - 1)) |
133 | #define PUD_SIZE (_AC(1,UL) << PUD_SHIFT) | 138 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT) |
134 | #define PUD_MASK (~(PUD_SIZE-1)) | 139 | #define PUD_MASK (~(PUD_SIZE - 1)) |
135 | #define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT) | 140 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) |
136 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 141 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) |
137 | 142 | ||
138 | 143 | ||
139 | #define MAXMEM _AC(0x3fffffffffff, UL) | 144 | #define MAXMEM _AC(0x00003fffffffffff, UL) |
140 | #define VMALLOC_START _AC(0xffffc20000000000, UL) | 145 | #define VMALLOC_START _AC(0xffffc20000000000, UL) |
141 | #define VMALLOC_END _AC(0xffffe1ffffffffff, UL) | 146 | #define VMALLOC_END _AC(0xffffe1ffffffffff, UL) |
142 | #define VMEMMAP_START _AC(0xffffe20000000000, UL) | 147 | #define VMEMMAP_START _AC(0xffffe20000000000, UL) |
@@ -163,18 +168,18 @@ static inline unsigned long pmd_bad(pmd_t pmd) | |||
163 | ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER | _PAGE_PSE | _PAGE_NX); | 168 | ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER | _PAGE_PSE | _PAGE_NX); |
164 | } | 169 | } |
165 | 170 | ||
166 | #define pte_none(x) (!pte_val(x)) | 171 | #define pte_none(x) (!pte_val((x))) |
167 | #define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) | 172 | #define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE)) |
168 | 173 | ||
169 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) /* FIXME: is this right? */ | 174 | #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */ |
170 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 175 | #define pte_page(x) pfn_to_page(pte_pfn((x))) |
171 | #define pte_pfn(x) ((pte_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT) | 176 | #define pte_pfn(x) ((pte_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT) |
172 | 177 | ||
173 | /* | 178 | /* |
174 | * Macro to mark a page protection value as "uncacheable". | 179 | * Macro to mark a page protection value as "uncacheable". |
175 | */ | 180 | */ |
176 | #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) | 181 | #define pgprot_noncached(prot) \ |
177 | 182 | (__pgprot(pgprot_val((prot)) | _PAGE_PCD | _PAGE_PWT)) | |
178 | 183 | ||
179 | /* | 184 | /* |
180 | * Conversion functions: convert a page and protection to a page entry, | 185 | * Conversion functions: convert a page and protection to a page entry, |
@@ -184,77 +189,81 @@ static inline unsigned long pmd_bad(pmd_t pmd) | |||
184 | /* | 189 | /* |
185 | * Level 4 access. | 190 | * Level 4 access. |
186 | */ | 191 | */ |
187 | #define pgd_page_vaddr(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK)) | 192 | #define pgd_page_vaddr(pgd) \ |
188 | #define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)) | 193 | ((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_MASK)) |
189 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 194 | #define pgd_page(pgd) (pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT)) |
190 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) | 195 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) |
191 | #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) | 196 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index((address))) |
197 | #define pgd_offset_k(address) (init_level4_pgt + pgd_index((address))) | ||
192 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT) | 198 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT) |
193 | static inline int pgd_large(pgd_t pgd) { return 0; } | 199 | static inline int pgd_large(pgd_t pgd) { return 0; } |
194 | #define mk_kernel_pgd(address) ((pgd_t){ (address) | _KERNPG_TABLE }) | 200 | #define mk_kernel_pgd(address) ((pgd_t){ (address) | _KERNPG_TABLE }) |
195 | 201 | ||
196 | /* PUD - Level3 access */ | 202 | /* PUD - Level3 access */ |
197 | /* to find an entry in a page-table-directory. */ | 203 | /* to find an entry in a page-table-directory. */ |
198 | #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) | 204 | #define pud_page_vaddr(pud) \ |
199 | #define pud_page(pud) (pfn_to_page(pud_val(pud) >> PAGE_SHIFT)) | 205 | ((unsigned long)__va(pud_val((pud)) & PHYSICAL_PAGE_MASK)) |
200 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) | 206 | #define pud_page(pud) (pfn_to_page(pud_val((pud)) >> PAGE_SHIFT)) |
201 | #define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) | 207 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)) |
202 | #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) | 208 | #define pud_offset(pgd, address) \ |
209 | ((pud_t *)pgd_page_vaddr(*(pgd)) + pud_index((address))) | ||
210 | #define pud_present(pud) (pud_val((pud)) & _PAGE_PRESENT) | ||
203 | 211 | ||
204 | static inline int pud_large(pud_t pte) | 212 | static inline int pud_large(pud_t pte) |
205 | { | 213 | { |
206 | return (pud_val(pte) & (_PAGE_PSE|_PAGE_PRESENT)) == | 214 | return (pud_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == |
207 | (_PAGE_PSE|_PAGE_PRESENT); | 215 | (_PAGE_PSE | _PAGE_PRESENT); |
208 | } | 216 | } |
209 | 217 | ||
210 | /* PMD - Level 2 access */ | 218 | /* PMD - Level 2 access */ |
211 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) | 219 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val((pmd)) & PTE_MASK)) |
212 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 220 | #define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT)) |
213 | 221 | ||
214 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | 222 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) |
215 | #define pmd_offset(dir, address) ((pmd_t *) pud_page_vaddr(*(dir)) + \ | 223 | #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \ |
216 | pmd_index(address)) | 224 | pmd_index(address)) |
217 | #define pmd_none(x) (!pmd_val(x)) | 225 | #define pmd_none(x) (!pmd_val((x))) |
218 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) | 226 | #define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT) |
219 | #define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot))) | 227 | #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot)))) |
220 | #define pmd_pfn(x) ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT) | 228 | #define pmd_pfn(x) ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT) |
221 | 229 | ||
222 | #define pte_to_pgoff(pte) ((pte_val(pte) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT) | 230 | #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) | _PAGE_FILE }) | 231 | #define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) | \ |
232 | _PAGE_FILE }) | ||
224 | #define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT | 233 | #define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT |
225 | 234 | ||
226 | /* PTE - Level 1 access. */ | 235 | /* PTE - Level 1 access. */ |
227 | 236 | ||
228 | /* page, protection -> pte */ | 237 | /* page, protection -> pte */ |
229 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | 238 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn((page)), (pgprot)) |
230 | 239 | ||
231 | #define pte_index(address) \ | 240 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
232 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
233 | #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \ | 241 | #define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \ |
234 | pte_index(address)) | 242 | pte_index((address))) |
235 | 243 | ||
236 | /* x86-64 always has all page tables mapped. */ | 244 | /* x86-64 always has all page tables mapped. */ |
237 | #define pte_offset_map(dir,address) pte_offset_kernel(dir,address) | 245 | #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) |
238 | #define pte_offset_map_nested(dir,address) pte_offset_kernel(dir,address) | 246 | #define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address)) |
239 | #define pte_unmap(pte) /* NOP */ | 247 | #define pte_unmap(pte) /* NOP */ |
240 | #define pte_unmap_nested(pte) /* NOP */ | 248 | #define pte_unmap_nested(pte) /* NOP */ |
241 | 249 | ||
242 | #define update_mmu_cache(vma,address,pte) do { } while (0) | 250 | #define update_mmu_cache(vma, address, pte) do { } while (0) |
243 | 251 | ||
244 | extern int direct_gbpages; | 252 | extern int direct_gbpages; |
245 | 253 | ||
246 | /* Encode and de-code a swap entry */ | 254 | /* Encode and de-code a swap entry */ |
247 | #define __swp_type(x) (((x).val >> 1) & 0x3f) | 255 | #define __swp_type(x) (((x).val >> 1) & 0x3f) |
248 | #define __swp_offset(x) ((x).val >> 8) | 256 | #define __swp_offset(x) ((x).val >> 8) |
249 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) | 257 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | \ |
250 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | 258 | ((offset) << 8) }) |
259 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) }) | ||
251 | #define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val }) | 260 | #define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val }) |
252 | 261 | ||
253 | extern int kern_addr_valid(unsigned long addr); | 262 | extern int kern_addr_valid(unsigned long addr); |
254 | extern void cleanup_highmap(void); | 263 | extern void cleanup_highmap(void); |
255 | 264 | ||
256 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | 265 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ |
257 | remap_pfn_range(vma, vaddr, pfn, size, prot) | 266 | remap_pfn_range(vma, vaddr, pfn, size, prot) |
258 | 267 | ||
259 | #define HAVE_ARCH_UNMAPPED_AREA | 268 | #define HAVE_ARCH_UNMAPPED_AREA |
260 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN | 269 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN |
@@ -267,8 +276,10 @@ extern void cleanup_highmap(void); | |||
267 | 276 | ||
268 | /* fs/proc/kcore.c */ | 277 | /* fs/proc/kcore.c */ |
269 | #define kc_vaddr_to_offset(v) ((v) & __VIRTUAL_MASK) | 278 | #define kc_vaddr_to_offset(v) ((v) & __VIRTUAL_MASK) |
270 | #define kc_offset_to_vaddr(o) \ | 279 | #define kc_offset_to_vaddr(o) \ |
271 | (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o)) | 280 | (((o) & (1UL << (__VIRTUAL_MASK_SHIFT - 1))) \ |
281 | ? ((o) | ~__VIRTUAL_MASK) \ | ||
282 | : (o)) | ||
272 | 283 | ||
273 | #define __HAVE_ARCH_PTE_SAME | 284 | #define __HAVE_ARCH_PTE_SAME |
274 | #endif /* !__ASSEMBLY__ */ | 285 | #endif /* !__ASSEMBLY__ */ |