+#include <kern/locks.h>
+
+#include <libkern/OSAtomic.h>
+
+
+#include <vm/vm_options.h>
+
+#ifdef MACH_KERNEL_PRIVATE
+#include <vm/vm_page.h>
+#endif
+
+#include <sys/kdebug.h>
+
+#define VM_PAGE_AVAILABLE_COUNT() ((unsigned int)(vm_page_cleaned_count))
+
+/* externally manipulated counters */
+extern unsigned int vm_pageout_cleaned_reactivated, vm_pageout_cleaned_fault_reactivated, vm_pageout_cleaned_commit_reactivated;
+
+#if CONFIG_FREEZE
+extern boolean_t memorystatus_freeze_enabled;
+#endif
+
+#define VM_DYNAMIC_PAGING_ENABLED() (VM_CONFIG_COMPRESSOR_IS_ACTIVE)
+
+#if VM_PRESSURE_EVENTS
+extern boolean_t vm_pressure_events_enabled;
+#endif /* VM_PRESSURE_EVENTS */
+
+
+/*
+ * the following codes are used in the DBG_MACH_WORKINGSET subclass
+ * of the DBG_MACH class
+ */
+#define VM_DISCONNECT_ALL_PAGE_MAPPINGS 0x00
+#define VM_DISCONNECT_TASK_PAGE_MAPPINGS 0x01
+#define VM_REAL_FAULT_ADDR_INTERNAL 0x02
+#define VM_REAL_FAULT_ADDR_PURGABLE 0x03
+#define VM_REAL_FAULT_ADDR_EXTERNAL 0x04
+#define VM_REAL_FAULT_ADDR_SHAREDCACHE 0x05
+
+
+
+extern int vm_debug_events;
+
+#define VMF_CHECK_ZFDELAY 0x100
+#define VMF_COWDELAY 0x101
+#define VMF_ZFDELAY 0x102
+#define VMF_COMPRESSORDELAY 0x103
+
+#define VM_PAGEOUT_SCAN 0x104
+#define VM_PAGEOUT_BALANCE 0x105
+#define VM_PAGEOUT_FREELIST 0x106
+#define VM_PAGEOUT_PURGEONE 0x107
+#define VM_PAGEOUT_CACHE_EVICT 0x108
+#define VM_PAGEOUT_THREAD_BLOCK 0x109
+#define VM_PAGEOUT_JETSAM 0x10A
+#define VM_INFO1 0x10B
+#define VM_INFO2 0x10C
+#define VM_INFO3 0x10D
+#define VM_INFO4 0x10E
+#define VM_INFO5 0x10F
+#define VM_INFO6 0x110
+#define VM_INFO7 0x111
+
+#define VM_UPL_PAGE_WAIT 0x120
+#define VM_IOPL_PAGE_WAIT 0x121
+#define VM_PAGE_WAIT_BLOCK 0x122
+
+#if CONFIG_IOSCHED
+#define VM_PAGE_SLEEP 0x123
+#define VM_PAGE_EXPEDITE 0x124
+#define VM_PAGE_EXPEDITE_NO_MEMORY 0x125
+#endif
+
+#define VM_PRESSURE_EVENT 0x130
+#define VM_EXECVE 0x131
+#define VM_WAKEUP_COMPACTOR_SWAPPER 0x132
+
+#define VM_DATA_WRITE 0x140
+
+#define VM_DEBUG_EVENT(name, event, control, arg1, arg2, arg3, arg4) \
+ MACRO_BEGIN \
+ if (vm_debug_events) { \
+ KERNEL_DEBUG_CONSTANT((MACHDBG_CODE(DBG_MACH_VM, event)) | control, arg1, arg2, arg3, arg4, 0); \
+ } \
+ MACRO_END
+
+#define VM_DEBUG_CONSTANT_EVENT(name, event, control, arg1, arg2, arg3, arg4) \
+ MACRO_BEGIN \
+ KERNEL_DEBUG_CONSTANT((MACHDBG_CODE(DBG_MACH_VM, event)) | control, arg1, arg2, arg3, arg4, 0); \
+ MACRO_END
+
+extern void memoryshot(unsigned int event, unsigned int control);
+
+extern void update_vm_info(void);
+
+#if CONFIG_IOSCHED
+extern int upl_get_cached_tier(
+ upl_t upl);
+#endif
+
+extern ppnum_t upl_get_highest_page(
+ upl_t upl);
+
+extern upl_size_t upl_get_size(
+ upl_t upl);
+
+extern upl_t upl_associated_upl(upl_t upl);
+extern void upl_set_associated_upl(upl_t upl, upl_t associated_upl);
+
+#ifdef XNU_KERNEL_PRIVATE