+#include <mach/mach_types.h>
+#include <mach/vm_types.h>
+#include <mach/machine/vm_types.h>
+#include <mach/vm_prot.h>
+#include <mach/vm_statistics.h>
+#include <kern/assert.h>
+#include <kern/cpu_number.h>
+#include <kern/lock.h>
+#include <kern/queue.h>
+#include <ppc/proc_reg.h>
+
+/*
+ * Don't change these structures unless you change the assembly code
+ */
+
+/*
+ * This control block serves as anchor for all virtual mappings of the same physical
+ * page, i.e., aliases. There is a table for each bank (mem_region). All tables
+ * must reside in V=R storage and within the first 2GB of memory. Also, the
+ * mappings to which it points must be on at least a 64-byte boundary. These
+ * requirements allow a total of 2 bits for status and flags, and allow all address
+ * calculations to be 32-bit.
+ */
+
+#pragma pack(4) /* Make sure the structure stays as we defined it */
+typedef struct phys_entry {
+ addr64_t ppLink; /* Physical pointer to aliased mappings and flags */
+#define ppLock 0x8000000000000000LL /* Lock for alias chain */
+#define ppFlags 0x700000000000000FLL /* Status and flags */
+#define ppI 0x2000000000000000LL /* Cache inhibited */
+#define ppIb 2 /* Cache inhibited */
+#define ppG 0x1000000000000000LL /* Guarded */
+#define ppGb 3 /* Guarded */
+#define ppR 0x0000000000000008LL /* Referenced */
+#define ppRb 60 /* Referenced */
+#define ppC 0x0000000000000004LL /* Changed */
+#define ppCb 61 /* Changed */
+
+/* The lock, attribute, and flag bits are arranged so that their positions may be
+ * described by a contiguous mask of one bits wrapping from bit postion 63 to 0.
+ * In assembly language, we can then rapidly produce this mask with:
+ * li r0,ppLFAmask ; r0 <- 0x00000000000000FF
+ * rotrdi r0,r0,ppLFArrot ; r0 <- 0xF00000000000000F
+ */
+#define ppLFAmask 0x00FF /* One bit for each lock, attr, or flag bit */
+#define ppLFArrot 4 /* Right-rotate count to obtain 64-bit mask */
+} phys_entry_t;
+#pragma pack()
+#define physEntrySize sizeof(phys_entry_t)
+
+/* Memory may be non-contiguous. This data structure contains info
+ * for mapping this non-contiguous space into the contiguous
+ * physical->virtual mapping tables. An array of this type is
+ * provided to the pmap system at bootstrap by ppc_vm_init.
+ *
+ */
+
+#pragma pack(4) /* Make sure the structure stays as we defined it */
+typedef struct mem_region {
+ phys_entry_t *mrPhysTab; /* Base of region table */
+ ppnum_t mrStart; /* Start of region */
+ ppnum_t mrEnd; /* Last page in region */
+ ppnum_t mrAStart; /* Next page in region to allocate */
+ ppnum_t mrAEnd; /* Last page in region to allocate */
+} mem_region_t;
+#pragma pack()
+
+#define mrSize sizeof(mem_region_t)
+#define PMAP_MEM_REGION_MAX 11
+
+extern mem_region_t pmap_mem_regions[PMAP_MEM_REGION_MAX + 1];
+extern unsigned int pmap_mem_regions_count;
+
+/* Prototypes */
+
+
+#pragma pack(4) /* Make sure the structure stays as we defined it */