+#ifndef PMAP_ENTER_OPTIONS
+#define PMAP_ENTER_OPTIONS(pmap, virtual_address, page, protection, \
+ fault_type, flags, wired, options, result) \
+ MACRO_BEGIN \
+ pmap_t __pmap = (pmap); \
+ vm_page_t __page = (page); \
+ int __extra_options = 0; \
+ \
+ PMAP_ENTER_CHECK(__pmap, __page) \
+ if (__page->object->internal) { \
+ __extra_options |= PMAP_OPTIONS_INTERNAL; \
+ } \
+ if (__page->reusable || __page->object->all_reusable) { \
+ __extra_options |= PMAP_OPTIONS_REUSABLE; \
+ } \
+ result = pmap_enter_options(__pmap, \
+ (virtual_address), \
+ __page->phys_page, \
+ (protection), \
+ (fault_type), \
+ (flags), \
+ (wired), \
+ (options) | __extra_options, \
+ NULL); \
+ MACRO_END
+#endif /* !PMAP_ENTER_OPTIONS */
+
+#ifndef PMAP_SET_CACHE_ATTR
+#define PMAP_SET_CACHE_ATTR(mem, object, cache_attr, batch_pmap_op) \
+ MACRO_BEGIN \
+ if (!batch_pmap_op) { \
+ pmap_set_cache_attributes(mem->phys_page, cache_attr); \
+ object->set_cache_attr = TRUE; \
+ } \
+ MACRO_END
+#endif /* PMAP_SET_CACHE_ATTR */
+
+#ifndef PMAP_BATCH_SET_CACHE_ATTR
+#define PMAP_BATCH_SET_CACHE_ATTR(object, user_page_list, \
+ cache_attr, num_pages, batch_pmap_op) \
+ MACRO_BEGIN \
+ if ((batch_pmap_op)) { \
+ unsigned int __page_idx=0; \
+ while (__page_idx < (num_pages)) { \
+ pmap_set_cache_attributes( \
+ user_page_list[__page_idx].phys_addr, \
+ (cache_attr)); \
+ __page_idx++; \
+ } \
+ (object)->set_cache_attr = TRUE; \
+ } \
+ MACRO_END
+#endif /* PMAP_BATCH_SET_CACHE_ATTR */
+
+#define PMAP_ENTER_CHECK(pmap, page) \
+{ \
+ if ((pmap) != kernel_pmap) { \
+ ASSERT_PAGE_DECRYPTED(page); \
+ } \
+ if ((page)->error) { \
+ panic("VM page %p should not have an error\n", \
+ (page)); \
+ } \
+}
+