Commit 649e8ef6 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge

x86: unify pmd_present

Impact: cleanup

Unify and demacro pmd_present.
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
parent 9f38d7e8
...@@ -445,6 +445,11 @@ static inline int pte_present(pte_t a) ...@@ -445,6 +445,11 @@ static inline int pte_present(pte_t a)
return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE); return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
} }
static inline int pmd_present(pmd_t pmd)
{
return pmd_val(pmd) & _PAGE_PRESENT;
}
#if PAGETABLE_LEVELS > 2 #if PAGETABLE_LEVELS > 2
static inline int pud_present(pud_t pud) static inline int pud_present(pud_t pud)
{ {
......
...@@ -87,7 +87,6 @@ extern unsigned long pg0[]; ...@@ -87,7 +87,6 @@ extern unsigned long pg0[];
/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
#define pmd_none(x) (!(unsigned long)pmd_val((x))) #define pmd_none(x) (!(unsigned long)pmd_val((x)))
#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT)
#define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) #define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
......
...@@ -208,7 +208,6 @@ static inline int pud_large(pud_t pte) ...@@ -208,7 +208,6 @@ static inline int pud_large(pud_t pte)
#define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \ #define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \
pmd_index(address)) pmd_index(address))
#define pmd_none(x) (!pmd_val((x))) #define pmd_none(x) (!pmd_val((x)))
#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT)
#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