-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t) 0xC0000000U)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t) 0xFfffffffU)
-#define KERNEL_STACK_SIZE (I386_PGBYTES*4)
+
+#define KB (1024ULL)
+#define MB (1024*KB)
+#define GB (1024*MB)
+
+/*
+ * Maximum physical memory supported.
+ */
+#define K32_MAXMEM (32*GB)
+#define K64_MAXMEM (252*GB)
+#define KERNEL_MAXMEM K64_MAXMEM
+
+/*
+ * XXX
+ * The kernel max VM address is limited to 0xFF3FFFFF for now because
+ * some data structures are explicitly allocated at 0xFF400000 without
+ * VM's knowledge (see osfmk/i386/locore.s for the allocation of PTmap and co.).
+ * We can't let VM allocate memory from there.
+ */
+
+
+#define KERNEL_IMAGE_TO_PHYS(x) (x)
+#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t) 0xFFFFFF8000000000UL)
+#define VM_MIN_KERNEL_PAGE ((ppnum_t)0)
+#define VM_MIN_KERNEL_AND_KEXT_ADDRESS (VM_MIN_KERNEL_ADDRESS - 0x80000000ULL)
+#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t) 0xFFFFFFFFFFFFEFFFUL)
+#define VM_MAX_KERNEL_ADDRESS_EFI32 ((vm_offset_t) 0xFFFFFF80FFFFEFFFUL)
+#define KEXT_ALLOC_MAX_OFFSET (2 * 1024 * 1024 * 1024UL)
+#define KEXT_ALLOC_BASE(x) ((x) - KEXT_ALLOC_MAX_OFFSET)
+#define KEXT_ALLOC_SIZE(x) (KEXT_ALLOC_MAX_OFFSET - (x))
+
+#define VM_KERNEL_ADDRESS(va) ((((vm_address_t)(va))>=VM_MIN_KERNEL_AND_KEXT_ADDRESS) && \
+ (((vm_address_t)(va))<=VM_MAX_KERNEL_ADDRESS))
+
+#define VM_MAP_MIN_ADDRESS MACH_VM_MIN_ADDRESS
+#define VM_MAP_MAX_ADDRESS MACH_VM_MAX_ADDRESS