summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/kmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/sys/kmem.h')
-rw-r--r--usr/src/uts/common/sys/kmem.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr/src/uts/common/sys/kmem.h b/usr/src/uts/common/sys/kmem.h
index 3a37f63fa2..03d4d24ba3 100644
--- a/usr/src/uts/common/sys/kmem.h
+++ b/usr/src/uts/common/sys/kmem.h
@@ -95,6 +95,15 @@ typedef enum kmem_cbrc {
#ifdef _KERNEL
+/*
+ * Helps clients implementing the move() callback to recognize known objects by
+ * testing a client-designated pointer member. Takes advantage of the fact that
+ * any scribbling to freed memory done by kmem is guaranteed to set one of the
+ * two low order bits.
+ */
+#define POINTER_IS_VALID(p) (!((uintptr_t)(p) & 0x3))
+#define POINTER_INVALIDATE(pp) (*(pp) = (void *)((uintptr_t)(*(pp)) | 0x1))
+
extern int kmem_ready;
extern pgcnt_t kmem_reapahead;