+#include <cpus.h>
+
+#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 ppN 0x4000000000000000LL /* Not executable */
+#define ppFlags 0x000000000000003FLL /* Status and flags */
+#define ppI 0x0000000000000020LL /* Cache inhibited */
+#define ppIb 58 /* Cache inhibited */
+#define ppG 0x0000000000000010LL /* Guarded */
+#define ppGb 59 /* Guarded */
+#define ppR 0x0000000000000008LL /* Referenced */
+#define ppRb 60 /* Referenced */
+#define ppC 0x0000000000000004LL /* Changed */
+#define ppCb 61 /* Changed */
+#define ppPP 0x0000000000000003LL /* Protection */
+#define ppPPb 62 /* Protection begin */
+#define ppPPe 63 /* Protection end */
+} phys_entry;
+#pragma pack()
+
+/* 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 *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 26
+
+extern mem_region_t pmap_mem_regions[PMAP_MEM_REGION_MAX + 1];
+extern int pmap_mem_regions_count;
+
+/* Prototypes */
+
+
+#pragma pack(4) /* Make sure the structure stays as we defined it */