+/*
+ * Clear a data page's reference bits.
+ */
+#if defined(tahoe)
+#define dpte_clrref(pte, c) { \
+ uncache(pte); \
+ if (pte->pg_u) { \
+ c = &cmap[pgtocm(pte->pg_pfnum)]; \
+ if (c->c_lock) \
+ continue; \
+ pte->pg_u = 0; \
+ if (anycl(pte, pg_m)) \
+ pte->pg_m = 1; \
+ distcl(pte); \
+ } \
+}
+#else
+#define dpte_clrref(pte, c) { \
+ c = &cmap[pgtocm(pte->pg_pfnum)]; \
+ if (c->c_lock) \
+ continue; \
+ pte->pg_v = 0; \
+ if (anycl(pte, pg_m)) \
+ pte->pg_m = 1; \
+ distcl(pte); \
+}
+#endif
+
+/*
+ * Clear a text page's reference bits.
+ */
+#if defined(tahoe)
+#define tpte_clrref(pte, c, rp, i) { \
+ uncache(pte); \
+ if (pte->pg_u) { \
+ c = &cmap[pgtocm(pte->pg_pfnum)]; \
+ if (c->c_lock) \
+ continue; \
+ pte->pg_u = 0; \
+ if (anycl(pte, pg_m)) \
+ pte->pg_m = 1; \
+ distcl(pte); \
+ distpte(rp->p_textp, i, pte); \
+ } \
+}
+#else
+#define tpte_clrref(pte, c, rp, i) { \
+ dpte_clrref(pte, c); \
+ distpte(rp->p_textp, i, pte); \
+}
+#endif
+