powerpc/mm: use pte helpers in generic code
Get rid of platform specific _PAGE_XXXX in powerpc common code and use helpers instead. mm/dump_linuxpagetables.c will be handled separately Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
34eb138ed7
commit
26973fa5ac
@@ -331,17 +331,14 @@ static inline bool pte_ci(pte_t pte)
|
||||
#define pte_access_permitted pte_access_permitted
|
||||
static inline bool pte_access_permitted(pte_t pte, bool write)
|
||||
{
|
||||
unsigned long pteval = pte_val(pte);
|
||||
/*
|
||||
* A read-only access is controlled by _PAGE_USER bit.
|
||||
* We have _PAGE_READ set for WRITE and EXECUTE
|
||||
*/
|
||||
unsigned long need_pte_bits = _PAGE_PRESENT | _PAGE_USER;
|
||||
if (!pte_present(pte) || !pte_user(pte) || !pte_read(pte))
|
||||
return false;
|
||||
|
||||
if (write)
|
||||
need_pte_bits |= _PAGE_WRITE;
|
||||
|
||||
if ((pteval & need_pte_bits) != need_pte_bits)
|
||||
if (write && !pte_write(pte))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user