Commit eab724e5 authored by Jan Beulich's avatar Jan Beulich Committed by Andi Kleen

[PATCH] x86-64: adjust pmd_bad()

Make pmd_bad() symmetrical to pgd_bad() and pud_bad(). At once,
simplify them all.

TBD: tighten down the checks again as suggested by Hugh D.
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 475850c8
No related merge requests found
...@@ -223,18 +223,17 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long ...@@ -223,18 +223,17 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
static inline unsigned long pgd_bad(pgd_t pgd) static inline unsigned long pgd_bad(pgd_t pgd)
{ {
unsigned long val = pgd_val(pgd); return pgd_val(pgd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER);
val &= ~PTE_MASK;
val &= ~(_PAGE_USER | _PAGE_DIRTY);
return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED);
} }
static inline unsigned long pud_bad(pud_t pud) static inline unsigned long pud_bad(pud_t pud)
{ {
unsigned long val = pud_val(pud); return pud_val(pud) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER);
val &= ~PTE_MASK; }
val &= ~(_PAGE_USER | _PAGE_DIRTY);
return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED); static inline unsigned long pmd_bad(pmd_t pmd)
{
return pmd_val(pmd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER);
} }
#define pte_none(x) (!pte_val(x)) #define pte_none(x) (!pte_val(x))
...@@ -347,7 +346,6 @@ static inline int pmd_large(pmd_t pte) { ...@@ -347,7 +346,6 @@ static inline int pmd_large(pmd_t pte) {
#define pmd_none(x) (!pmd_val(x)) #define pmd_none(x) (!pmd_val(x))
#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
#define pmd_bad(x) ((pmd_val(x) & (~PTE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE )
#define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot))) #define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot)))
#define pmd_pfn(x) ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT) #define pmd_pfn(x) ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment