-/* Returns true if the PTE for user virtual page UPAGE in PD has
- been accessed recently, that is, between the time the PTE was
- installed and the last time it was cleared.
- Returns false if PD contains no PDE for UPAGE. */
+/* Set the dirty bit to DIRTY in the PTE for virtual page VPAGE
+ in PD. */
+void
+pagedir_set_dirty (uint32_t *pd, const void *vpage, bool dirty)
+{
+ uint32_t *pte = lookup_page (pd, vpage, false);
+ if (pte != NULL)
+ {
+ if (dirty)
+ *pte |= PTE_D;
+ else
+ {
+ *pte &= ~(uint32_t) PTE_D;
+ invalidate_pagedir (pd);
+ }
+ }
+}
+
+/* Returns true if the PTE for virtual page VPAGE in PD has been
+ accessed recently, that is, between the time the PTE was
+ installed and the last time it was cleared. Returns false if
+ PD contains no PTE for VPAGE. */