Skip to content

Commit 44b6dfc

Browse files
stevecapperarmctmarinas
authored andcommitted
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: Steve Capper <steve.capper@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent f864b61 commit 44b6dfc

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,47 @@ extern struct page *empty_zero_page;
146146
#define pte_valid_user(pte) \
147147
((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
148148

149-
#define PTE_BIT_FUNC(fn,op) \
150-
static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
151-
152-
PTE_BIT_FUNC(wrprotect, |= PTE_RDONLY);
153-
PTE_BIT_FUNC(mkwrite, &= ~PTE_RDONLY);
154-
PTE_BIT_FUNC(mkclean, &= ~PTE_DIRTY);
155-
PTE_BIT_FUNC(mkdirty, |= PTE_DIRTY);
156-
PTE_BIT_FUNC(mkold, &= ~PTE_AF);
157-
PTE_BIT_FUNC(mkyoung, |= PTE_AF);
158-
PTE_BIT_FUNC(mkspecial, |= PTE_SPECIAL);
149+
static inline pte_t pte_wrprotect(pte_t pte)
150+
{
151+
pte_val(pte) |= PTE_RDONLY;
152+
return pte;
153+
}
154+
155+
static inline pte_t pte_mkwrite(pte_t pte)
156+
{
157+
pte_val(pte) &= ~PTE_RDONLY;
158+
return pte;
159+
}
160+
161+
static inline pte_t pte_mkclean(pte_t pte)
162+
{
163+
pte_val(pte) &= ~PTE_DIRTY;
164+
return pte;
165+
}
166+
167+
static inline pte_t pte_mkdirty(pte_t pte)
168+
{
169+
pte_val(pte) |= PTE_DIRTY;
170+
return pte;
171+
}
172+
173+
static inline pte_t pte_mkold(pte_t pte)
174+
{
175+
pte_val(pte) &= ~PTE_AF;
176+
return pte;
177+
}
178+
179+
static inline pte_t pte_mkyoung(pte_t pte)
180+
{
181+
pte_val(pte) |= PTE_AF;
182+
return pte;
183+
}
184+
185+
static inline pte_t pte_mkspecial(pte_t pte)
186+
{
187+
pte_val(pte) |= PTE_SPECIAL;
188+
return pte;
189+
}
159190

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

0 commit comments

Comments
 (0)