aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2009-02-05 14:31:16 -0500
committerJeremy Fitzhardinge <jeremy@goop.org>2009-02-06 15:31:51 -0500
commit18a7a199f97a7509fb987722e543f1aac3d7ada5 (patch)
tree7b4d733899a124f543072932a023261383c634db
parent6cf7150084500962b8e225e2409ec01ed06a2c71 (diff)
x86: add and use pgd/pud/pmd_flags
Add pgd/pud/pmd_flags which are analogous to pte_flags, and use them where-ever we only care about testing the flags portions of the respective entries. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
-rw-r--r--arch/x86/include/asm/page.h15
-rw-r--r--arch/x86/include/asm/pgtable.h16
2 files changed, 23 insertions, 8 deletions
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
index e9873a2e8695..0b16b64a8fe7 100644
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -95,6 +95,11 @@ static inline pgdval_t native_pgd_val(pgd_t pgd)
95 return pgd.pgd; 95 return pgd.pgd;
96} 96}
97 97
98static inline pgdval_t pgd_flags(pgd_t pgd)
99{
100 return native_pgd_val(pgd) & PTE_FLAGS_MASK;
101}
102
98#if PAGETABLE_LEVELS >= 3 103#if PAGETABLE_LEVELS >= 3
99#if PAGETABLE_LEVELS == 4 104#if PAGETABLE_LEVELS == 4
100typedef struct { pudval_t pud; } pud_t; 105typedef struct { pudval_t pud; } pud_t;
@@ -117,6 +122,11 @@ static inline pudval_t native_pud_val(pud_t pud)
117} 122}
118#endif /* PAGETABLE_LEVELS == 4 */ 123#endif /* PAGETABLE_LEVELS == 4 */
119 124
125static inline pudval_t pud_flags(pud_t pud)
126{
127 return native_pud_val(pud) & PTE_FLAGS_MASK;
128}
129
120typedef struct { pmdval_t pmd; } pmd_t; 130typedef struct { pmdval_t pmd; } pmd_t;
121 131
122static inline pmd_t native_make_pmd(pmdval_t val) 132static inline pmd_t native_make_pmd(pmdval_t val)
@@ -128,6 +138,11 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
128{ 138{
129 return pmd.pmd; 139 return pmd.pmd;
130} 140}
141
142static inline pmdval_t pmd_flags(pmd_t pmd)
143{
144 return native_pmd_val(pmd) & PTE_FLAGS_MASK;
145}
131#else /* PAGETABLE_LEVELS == 2 */ 146#else /* PAGETABLE_LEVELS == 2 */
132#include <asm-generic/pgtable-nopmd.h> 147#include <asm-generic/pgtable-nopmd.h>
133 148
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 9754d06ffe68..c811d76d6fd0 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -236,7 +236,7 @@ static inline unsigned long pte_pfn(pte_t pte)
236 236
237static inline int pmd_large(pmd_t pte) 237static inline int pmd_large(pmd_t pte)
238{ 238{
239 return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == 239 return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
240 (_PAGE_PSE | _PAGE_PRESENT); 240 (_PAGE_PSE | _PAGE_PRESENT);
241} 241}
242 242
@@ -458,7 +458,7 @@ static inline int pte_present(pte_t a)
458 458
459static inline int pmd_present(pmd_t pmd) 459static inline int pmd_present(pmd_t pmd)
460{ 460{
461 return pmd_val(pmd) & _PAGE_PRESENT; 461 return pmd_flags(pmd) & _PAGE_PRESENT;
462} 462}
463 463
464static inline int pmd_none(pmd_t pmd) 464static inline int pmd_none(pmd_t pmd)
@@ -516,7 +516,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address)
516 516
517static inline int pmd_bad(pmd_t pmd) 517static inline int pmd_bad(pmd_t pmd)
518{ 518{
519 return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; 519 return (pmd_flags(pmd) & ~_PAGE_USER) != _KERNPG_TABLE;
520} 520}
521 521
522static inline unsigned long pages_to_mb(unsigned long npg) 522static inline unsigned long pages_to_mb(unsigned long npg)
@@ -535,7 +535,7 @@ static inline int pud_none(pud_t pud)
535 535
536static inline int pud_present(pud_t pud) 536static inline int pud_present(pud_t pud)
537{ 537{
538 return pud_val(pud) & _PAGE_PRESENT; 538 return pud_flags(pud) & _PAGE_PRESENT;
539} 539}
540 540
541static inline unsigned long pud_page_vaddr(pud_t pud) 541static inline unsigned long pud_page_vaddr(pud_t pud)
@@ -561,20 +561,20 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
561 561
562static inline int pud_large(pud_t pud) 562static inline int pud_large(pud_t pud)
563{ 563{
564 return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) == 564 return (pud_flags(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
565 (_PAGE_PSE | _PAGE_PRESENT); 565 (_PAGE_PSE | _PAGE_PRESENT);
566} 566}
567 567
568static inline int pud_bad(pud_t pud) 568static inline int pud_bad(pud_t pud)
569{ 569{
570 return (pud_val(pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) != 0; 570 return (pud_flags(pud) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0;
571} 571}
572#endif /* PAGETABLE_LEVELS > 2 */ 572#endif /* PAGETABLE_LEVELS > 2 */
573 573
574#if PAGETABLE_LEVELS > 3 574#if PAGETABLE_LEVELS > 3
575static inline int pgd_present(pgd_t pgd) 575static inline int pgd_present(pgd_t pgd)
576{ 576{
577 return pgd_val(pgd) & _PAGE_PRESENT; 577 return pgd_flags(pgd) & _PAGE_PRESENT;
578} 578}
579 579
580static inline unsigned long pgd_page_vaddr(pgd_t pgd) 580static inline unsigned long pgd_page_vaddr(pgd_t pgd)
@@ -600,7 +600,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
600 600
601static inline int pgd_bad(pgd_t pgd) 601static inline int pgd_bad(pgd_t pgd)
602{ 602{
603 return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE; 603 return (pgd_flags(pgd) & ~_PAGE_USER) != _KERNPG_TABLE;
604} 604}
605 605
606static inline int pgd_none(pgd_t pgd) 606static inline int pgd_none(pgd_t pgd)