Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50e59406 authored by Steve Capper's avatar Steve Capper Committed by Ian Maund
Browse files

arm64: mm: Remove PTE_BIT_FUNC macro



Expand out the pte manipulation functions. This makes our life easier
when using things like tags and cscope.

Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Git-commit: 44b6dfc556811c0e6981329e29e1865fc7a8847d
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


[imaund@codeaurora.org: reworked Laura's calls of the PTE_BIT_FUNC macro, as
  it has been removed. Instead, implement them as static inline functions.]
Signed-off-by: default avatarIan Maund <imaund@codeaurora.org>
parent 4142f9fb
Loading
Loading
Loading
Loading
+53 −12
Original line number Diff line number Diff line
@@ -146,18 +146,59 @@ extern struct page *empty_zero_page;
#define pte_valid_user(pte) \
	((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))

#define PTE_BIT_FUNC(fn,op) \
static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }

PTE_BIT_FUNC(wrprotect, |= PTE_RDONLY);
PTE_BIT_FUNC(mkwrite,   &= ~PTE_RDONLY);
PTE_BIT_FUNC(mkclean,   &= ~PTE_DIRTY);
PTE_BIT_FUNC(mkdirty,   |= PTE_DIRTY);
PTE_BIT_FUNC(mkold,     &= ~PTE_AF);
PTE_BIT_FUNC(mkyoung,   |= PTE_AF);
PTE_BIT_FUNC(mkspecial, |= PTE_SPECIAL);
PTE_BIT_FUNC(mkexec,	&= ~PTE_PXN);
PTE_BIT_FUNC(mknexec,	|= PTE_PXN);
static inline pte_t pte_wrprotect(pte_t pte)
{
	pte_val(pte) |= PTE_RDONLY;
	return pte;
}

static inline pte_t pte_mkwrite(pte_t pte)
{
	pte_val(pte) &= ~PTE_RDONLY;
	return pte;
}

static inline pte_t pte_mkclean(pte_t pte)
{
	pte_val(pte) &= ~PTE_DIRTY;
	return pte;
}

static inline pte_t pte_mkdirty(pte_t pte)
{
	pte_val(pte) |= PTE_DIRTY;
	return pte;
}

static inline pte_t pte_mkold(pte_t pte)
{
	pte_val(pte) &= ~PTE_AF;
	return pte;
}

static inline pte_t pte_mkyoung(pte_t pte)
{
	pte_val(pte) |= PTE_AF;
	return pte;
}

static inline pte_t pte_mkspecial(pte_t pte)
{
	pte_val(pte) |= PTE_SPECIAL;
	return pte;
}

static inline pte_t pte_mkexec(pte_t pte)
{
	pte_val(pte) &= ~PTE_PXN;
	return pte;
}

static inline pte_t pte_mknexec(pte_t pte)
{
	pte_val(pte) |= PTE_PXN;
	return pte;
}

static inline void set_pte(pte_t *ptep, pte_t pte)
{