From: mlarkin Date: Fri, 9 Jan 2015 03:43:52 +0000 (+0000) Subject: Cleanup some macros and #defines in i386 pmap. Previously committed and X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d7c9b95f5e642e88069ef5fcbc9e685f2c0fb288;p=openbsd Cleanup some macros and #defines in i386 pmap. Previously committed and backed out because of libkvm breakage, recommitting now with libkvm fix. ok deraadt@ --- diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index ed4a3a65bab..fa93c7b1f19 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_i386.c,v 1.24 2013/11/01 15:57:56 deraadt Exp $ */ +/* $OpenBSD: kvm_i386.c,v 1.25 2015/01/09 03:43:52 mlarkin Exp $ */ /* $NetBSD: kvm_i386.c,v 1.9 1996/03/18 22:33:38 thorpej Exp $ */ /*- @@ -58,6 +58,15 @@ #include +/* + * These must match the values in pmap.c/pmapae.c + */ +#define PD_MASK 0xffc00000 /* page directory address bits */ +#define PT_MASK 0x003ff000 /* page table address bits */ +#define pdei(VA) (((VA) & PD_MASK) >> PDSHIFT) +#define ptei(VA) (((VA) & PT_MASK) >> PAGE_SHIFT) + + struct vmstate { pd_entry_t *PTD; }; diff --git a/sys/arch/i386/i386/hibernate_machdep.c b/sys/arch/i386/i386/hibernate_machdep.c index 8196310baa0..e7175de3c30 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.43 2014/12/23 01:24:50 deraadt Exp $ */ +/* $OpenBSD: hibernate_machdep.c,v 1.44 2015/01/09 03:43:52 mlarkin Exp $ */ /* * Copyright (c) 2011 Mike Larkin @@ -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 82f88771491..8f003520234 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.165 2014/12/23 01:24:50 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.166 2015/01/09 03:43:52 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 369e1b90614..99c63c5e98f 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.14 2014/12/23 01:24:51 deraadt Exp $ */ +/* $OpenBSD: hibernate_var.h,v 1.15 2015/01/09 03:43:52 mlarkin Exp $ */ /* * Copyright (c) 2011 Mike Larkin @@ -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 37fed0ceb0e..d8dd8733296 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.69 2014/12/23 01:24:51 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.70 2015/01/09 03:43:52 mlarkin Exp $ */ /* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */ /* @@ -195,12 +195,6 @@ #define avtophys(VA) ((*avtopte(VA) & PG_FRAME) | \ ((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. diff --git a/sys/arch/i386/include/pte.h b/sys/arch/i386/include/pte.h index 851af59c053..805ed0f4868 100644 --- a/sys/arch/i386/include/pte.h +++ b/sys/arch/i386/include/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.18 2014/12/23 01:24:51 deraadt Exp $ */ +/* $OpenBSD: pte.h,v 1.19 2015/01/09 03:43:52 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)