+/*
+ * IMPORTANT:
+ * The "alias" field can be updated while holding the VM map lock
+ * "shared". It's OK as along as it's the only field that can be
+ * updated without the VM map "exclusive" lock.
+ */
+#define VME_OBJECT(entry) ((entry)->vme_object.vmo_object)
+#define VME_OBJECT_SET(entry, object) \
+ MACRO_BEGIN \
+ (entry)->vme_object.vmo_object = (object); \
+ MACRO_END
+#define VME_SUBMAP(entry) ((entry)->vme_object.vmo_submap)
+#define VME_SUBMAP_SET(entry, submap) \
+ MACRO_BEGIN \
+ (entry)->vme_object.vmo_submap = (submap); \
+ MACRO_END
+#define VME_OFFSET(entry) ((entry)->vme_offset & ~PAGE_MASK)
+#define VME_OFFSET_SET(entry, offset) \
+ MACRO_BEGIN \
+ int __alias; \
+ __alias = VME_ALIAS((entry)); \
+ assert((offset & PAGE_MASK) == 0); \
+ (entry)->vme_offset = offset | __alias; \
+ MACRO_END
+#define VME_OBJECT_SHADOW(entry, length) \
+ MACRO_BEGIN \
+ vm_object_t __object; \
+ vm_object_offset_t __offset; \
+ __object = VME_OBJECT((entry)); \
+ __offset = VME_OFFSET((entry)); \
+ vm_object_shadow(&__object, &__offset, (length)); \
+ if (__object != VME_OBJECT((entry))) { \
+ VME_OBJECT_SET((entry), __object); \
+ } \
+ if (__offset != VME_OFFSET((entry))) { \
+ VME_OFFSET_SET((entry), __offset); \
+ } \
+ MACRO_END
+
+#define VME_ALIAS_MASK (PAGE_MASK)
+#define VME_ALIAS(entry) ((unsigned int)((entry)->vme_offset & VME_ALIAS_MASK))
+#define VME_ALIAS_SET(entry, alias) \
+ MACRO_BEGIN \
+ vm_map_offset_t __offset; \
+ __offset = VME_OFFSET((entry)); \
+ (entry)->vme_offset = __offset | ((alias) & VME_ALIAS_MASK); \
+ MACRO_END
+