From c395dc2410b2a0e42f81693c62a6c2fb8b75827e Mon Sep 17 00:00:00 2001 From: NAKAMURA Gou Date: Mon, 23 Jun 2014 18:28:54 +0900 Subject: [PATCH] add pte_is_dirty() --- arch/x86/kernel/include/arch-memory.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/x86/kernel/include/arch-memory.h b/arch/x86/kernel/include/arch-memory.h index 26752e0a..8704299a 100644 --- a/arch/x86/kernel/include/arch-memory.h +++ b/arch/x86/kernel/include/arch-memory.h @@ -138,6 +138,21 @@ static inline int pte_is_writable(pte_t *ptep) return !!(*ptep & PF_WRITABLE); } +static inline int pte_is_dirty(pte_t *ptep, size_t pgsize) +{ + switch (pgsize) { + case PTL1_SIZE: return !!(*ptep & PFL1_DIRTY); + case PTL2_SIZE: return !!(*ptep & PFL2_DIRTY); + case PTL3_SIZE: return !!(*ptep & PFL3_DIRTY); + default: +#if 0 /* XXX: workaround. cannot use panic() here */ + panic("pte_is_dirty"); +#else + return !!(*ptep & PTATTR_DIRTY); +#endif + } +} + static inline uintptr_t pte_get_phys(pte_t *ptep) { return (*ptep & PT_PHYSMASK);