diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2009-02-05 14:30:51 -0500 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy@goop.org> | 2009-02-06 15:31:48 -0500 |
commit | 4fea801ac95d6534a93aa01d3ac62be163d845af (patch) | |
tree | a5a285d5fd1c07c8d24d8da2f0517ac3f71cc9ed /arch/x86/include/asm | |
parent | 649e8ef60fac0a2f6960cdb090d73e78717ac065 (diff) |
x86: unify pmd_none
Impact: cleanup
Unify and demacro pmd_none.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 7 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_32.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_64.h | 1 |
3 files changed, 7 insertions, 3 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 147d3f097ab0..2f38bbee77e7 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -450,6 +450,13 @@ static inline int pmd_present(pmd_t pmd) | |||
450 | return pmd_val(pmd) & _PAGE_PRESENT; | 450 | return pmd_val(pmd) & _PAGE_PRESENT; |
451 | } | 451 | } |
452 | 452 | ||
453 | static inline int pmd_none(pmd_t pmd) | ||
454 | { | ||
455 | /* Only check low word on 32-bit platforms, since it might be | ||
456 | out of sync with upper half. */ | ||
457 | return !(unsigned long)native_pmd_val(pmd); | ||
458 | } | ||
459 | |||
453 | #if PAGETABLE_LEVELS > 2 | 460 | #if PAGETABLE_LEVELS > 2 |
454 | static inline int pud_present(pud_t pud) | 461 | static inline int pud_present(pud_t pud) |
455 | { | 462 | { |
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h index f35160730b65..26e73569223c 100644 --- a/arch/x86/include/asm/pgtable_32.h +++ b/arch/x86/include/asm/pgtable_32.h | |||
@@ -85,8 +85,6 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t); | |||
85 | /* The boot page tables (all created as a single array) */ | 85 | /* The boot page tables (all created as a single array) */ |
86 | extern unsigned long pg0[]; | 86 | extern unsigned long pg0[]; |
87 | 87 | ||
88 | /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ | ||
89 | #define pmd_none(x) (!(unsigned long)pmd_val((x))) | ||
90 | #define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | 88 | #define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) |
91 | 89 | ||
92 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) | 90 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) |
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index 471b3058f3d7..f3ad89433246 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -207,7 +207,6 @@ static inline int pud_large(pud_t pte) | |||
207 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) | 207 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) |
208 | #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \ | 208 | #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \ |
209 | pmd_index(address)) | 209 | pmd_index(address)) |
210 | #define pmd_none(x) (!pmd_val((x))) | ||
211 | #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot)))) | 210 | #define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot)))) |
212 | #define pmd_pfn(x) ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT) | 211 | #define pmd_pfn(x) ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT) |
213 | 212 | ||