- Accessed bit emulation: - PG_A is set when PG_V is set (conversely if PG_A = 0 then PG_V = 0) - Clearing the reference bit is done by removing the mapping entirely - Dirty bit emulation: - PG_M is set if PG_RW is set (conversely if PG_M = 0 then PG_RW = 0) - PG_RO is a software bit in the PTE to distinguish between a mapping that is truly readonly versus one that is temporarily readonly for doing dirty bit emulation. - Dirty bit emulation is done on a write fault if PG_RO = 0 - Clearing the dirty bit is done by clearing the PG_M and PG_RW bits simultaneously - No accessed/dirty bit emulation is done for the following: - pmap_kenter() and pmap_qenter() - Unmanaged mappings created by pmap_enter(): - These mappings are used by the kernel and not expected to fault. - Dirty bit emulation is disabled for these mappings. - Wired mappings: - pmap_clear_reference() and pmap_ts_referenced() do not actually do anything if accessed bit is emulated for wired mappings. This is because the page is never going to be swapped out anyways so doing expensive accessed bit emulation doesn't seem worthwhile. - pmap_clear_modify() - dirty bit emulation requires that we clear PG_RW along with PG_M - This in turn will cause a write fault although the mapping is wired - The VM subsystem can deal with page faults for wired pages so we can get away without any special treatment.