summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2014-12-22 23:59:43 +0000
committermlarkin <mlarkin@openbsd.org>2014-12-22 23:59:43 +0000
commit868cdbd27e8a7ce51e7bde432af8c86ff64d986b (patch)
tree2fad25fe95bb6b52916539e46fd828848a907877
parentThe code already pays attention not to close the same block twice. (diff)
downloadwireguard-openbsd-868cdbd27e8a7ce51e7bde432af8c86ff64d986b.tar.xz
wireguard-openbsd-868cdbd27e8a7ce51e7bde432af8c86ff64d986b.zip
Move PD_MASK, PT_MASK and a couple macros into pmap.c. The only other
user of these was hibernate, which now gets its own PD_MASK (since the resume time PD_MASK is essentially disjoint from the runtime PD_MASK). No functional change, just moving the deck chairs around in preparation for an upcoming change. ok deraadt
-rw-r--r--sys/arch/i386/i386/hibernate_machdep.c4
-rw-r--r--sys/arch/i386/i386/pmap.c11
-rw-r--r--sys/arch/i386/include/hibernate_var.h5
-rw-r--r--sys/arch/i386/include/pmap.h8
-rw-r--r--sys/arch/i386/include/pte.h4
5 files changed, 17 insertions, 15 deletions
diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c
index 7a23be27d8e..99841c53fac 100644
--- a/sys/arch/i386/i386/hibernate_machdep.c
+++ b/sys/arch/i386/i386/hibernate_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hibernate_machdep.c,v 1.41 2014/11/16 12:30:57 deraadt Exp $ */
+/* $OpenBSD: hibernate_machdep.c,v 1.42 2014/12/22 23:59:43 mlarkin Exp $ */
/*
* Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
@@ -193,7 +193,7 @@ hibernate_enter_resume_4m_pde(vaddr_t va, paddr_t pa)
pt_entry_t *pde, npde;
pde = s4pde_4m(va);
- npde = (pa & PD_MASK) | PG_RW | PG_V | PG_M | PG_PS;
+ npde = (pa & HIB_PD_MASK) | PG_RW | PG_V | PG_M | PG_PS;
*pde = npde;
}
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index 5d3326f5a1e..1c4da2b8daf 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.163 2014/12/02 18:13:10 tedu Exp $ */
+/* $OpenBSD: pmap.c,v 1.164 2014/12/22 23:59:43 mlarkin Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
@@ -202,6 +202,15 @@
#define PMAP_HEAD_TO_MAP_LOCK() /* null */
#define PMAP_HEAD_TO_MAP_UNLOCK() /* null */
+#define PD_MASK 0xffc00000 /* page directory address bits */
+#define PT_MASK 0x003ff000 /* page table address bits */
+
+/*
+ * pdei/ptei: generate index into PDP/PTP from a VA
+ */
+#define pdei(VA) (((VA) & PD_MASK) >> PDSHIFT)
+#define ptei(VA) (((VA) & PT_MASK) >> PAGE_SHIFT)
+
/*
* global data structures
*/
diff --git a/sys/arch/i386/include/hibernate_var.h b/sys/arch/i386/include/hibernate_var.h
index 0fe75131ae4..143598e240c 100644
--- a/sys/arch/i386/include/hibernate_var.h
+++ b/sys/arch/i386/include/hibernate_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hibernate_var.h,v 1.12 2014/12/08 07:12:37 mlarkin Exp $ */
+/* $OpenBSD: hibernate_var.h,v 1.13 2014/12/22 23:59:43 mlarkin Exp $ */
/*
* Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
@@ -16,7 +16,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define PIGLET_PAGE_MASK (PD_MASK)
+#define HIB_PD_MASK 0xffc00000
+#define PIGLET_PAGE_MASK (HIB_PD_MASK)
#define HIBERNATE_PD_PAGE (PAGE_SIZE * 21)
#define HIBERNATE_PT_PAGE (PAGE_SIZE * 22)
diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h
index 0285b7def44..751f0799a90 100644
--- a/sys/arch/i386/include/pmap.h
+++ b/sys/arch/i386/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.67 2014/12/02 18:13:10 tedu Exp $ */
+/* $OpenBSD: pmap.h,v 1.68 2014/12/22 23:59:43 mlarkin Exp $ */
/* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */
/*
@@ -196,12 +196,6 @@
((unsigned)(VA) & ~PG_FRAME))
/*
- * pdei/ptei: generate index into PDP/PTP from a VA
- */
-#define pdei(VA) (((VA) & PD_MASK) >> PDSHIFT)
-#define ptei(VA) (((VA) & PT_MASK) >> PAGE_SHIFT)
-
-/*
* PTP macros:
* A PTP's index is the PD index of the PDE that points to it.
* A PTP's offset is the byte-offset in the PTE space that this PTP is at.
diff --git a/sys/arch/i386/include/pte.h b/sys/arch/i386/include/pte.h
index b8f8a419ebc..2c63749a095 100644
--- a/sys/arch/i386/include/pte.h
+++ b/sys/arch/i386/include/pte.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pte.h,v 1.16 2014/10/01 19:41:06 mlarkin Exp $ */
+/* $OpenBSD: pte.h,v 1.17 2014/12/22 23:59:43 mlarkin Exp $ */
/* $NetBSD: pte.h,v 1.11 1998/02/06 21:58:05 thorpej Exp $ */
/*
@@ -144,8 +144,6 @@ typedef u_int32_t pt_entry_t; /* PTE */
#else
#define PTES_PER_PTP (NBPD / PAGE_SIZE) /* # of PTEs in a PTP */
#endif
-#define PD_MASK 0xffc00000 /* page directory address bits */
-#define PT_MASK 0x003ff000 /* page table address bits */
#define PAGE_MASK_L2 (NBPD - 1)