diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h index 7b9584b2a301..cc99805f695f 100644 --- a/sys/arch/alpha/include/pmap.h +++ b/sys/arch/alpha/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.75 2009/10/26 03:51:43 thorpej Exp $ */ +/* $NetBSD: pmap.h,v 1.76 2010/11/14 13:33:20 uebayasi Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc. @@ -349,6 +349,22 @@ do { \ } \ } while (0) +/* + * pmap-specific data store in the vm_page structure. + */ +#define __HAVE_VM_PAGE_MD +struct vm_page_md { + struct pv_entry *pvh_list; /* pv_entry list */ + int pvh_attrs; /* page attributes */ + unsigned pvh_refcnt; +}; + +#define VM_MDPAGE_INIT(pg) \ +do { \ + (pg)->mdpage.pvh_list = NULL; \ + (pg)->mdpage.pvh_refcnt = 0; \ +} while (/*CONSTCOND*/0) + #endif /* _KERNEL */ #endif /* _PMAP_MACHINE_ */ diff --git a/sys/arch/alpha/include/vmparam.h b/sys/arch/alpha/include/vmparam.h index fa1701b80f10..97494aa47e20 100644 --- a/sys/arch/alpha/include/vmparam.h +++ b/sys/arch/alpha/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.34 2010/11/06 15:42:43 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.35 2010/11/14 13:33:20 uebayasi Exp $ */ /* * Copyright (c) 1992, 1993 @@ -151,20 +151,4 @@ #define VM_NFREELIST 1 #define VM_FREELIST_DEFAULT 0 -/* - * pmap-specific data store in the vm_page structure. - */ -#define __HAVE_VM_PAGE_MD -struct vm_page_md { - struct pv_entry *pvh_list; /* pv_entry list */ - int pvh_attrs; /* page attributes */ - unsigned pvh_refcnt; -}; - -#define VM_MDPAGE_INIT(pg) \ -do { \ - (pg)->mdpage.pvh_list = NULL; \ - (pg)->mdpage.pvh_refcnt = 0; \ -} while (/*CONSTCOND*/0) - #endif /* ! _ALPHA_VMPARAM_H_ */ diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h index 792580f987b8..1cdd70ba550e 100644 --- a/sys/arch/amd64/include/pmap.h +++ b/sys/arch/amd64/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.22 2008/10/26 00:08:15 mrg Exp $ */ +/* $NetBSD: pmap.h,v 1.23 2010/11/14 13:33:20 uebayasi Exp $ */ /* * @@ -343,7 +343,18 @@ pmap_pte_flush(void) void pmap_prealloc_lowmem_ptps(void); void pmap_changeprot_local(vaddr_t, vm_prot_t); -#else /* __x86_64__ */ +#include + +#define __HAVE_VM_PAGE_MD +#define VM_MDPAGE_INIT(pg) \ + memset(&(pg)->mdpage, 0, sizeof((pg)->mdpage)); \ + PMAP_PAGE_INIT(&(pg)->mdpage.mp_pp) + +struct vm_page_md { + struct pmap_page mp_pp; +}; + +#else /* !__x86_64__ */ #include diff --git a/sys/arch/amd64/include/vmparam.h b/sys/arch/amd64/include/vmparam.h index a96f8ed22a52..a1479783f374 100644 --- a/sys/arch/amd64/include/vmparam.h +++ b/sys/arch/amd64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.23 2010/11/06 15:42:44 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.24 2010/11/14 13:33:21 uebayasi Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -156,17 +156,6 @@ #define VM_FREELIST_FIRST4G 1 #define VM_FREELIST_FIRST16 2 -#include - -#define __HAVE_VM_PAGE_MD -#define VM_MDPAGE_INIT(pg) \ - memset(&(pg)->mdpage, 0, sizeof((pg)->mdpage)); \ - PMAP_PAGE_INIT(&(pg)->mdpage.mp_pp) - -struct vm_page_md { - struct pmap_page mp_pp; -}; - #else /* !__x86_64__ */ #include diff --git a/sys/arch/arm/include/arm32/pmap.h b/sys/arch/arm/include/arm32/pmap.h index 3608d84245d3..7e9a5b717e61 100644 --- a/sys/arch/arm/include/arm32/pmap.h +++ b/sys/arch/arm/include/arm32/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.96 2010/11/02 06:07:06 uebayasi Exp $ */ +/* $NetBSD: pmap.h,v 1.97 2010/11/14 13:33:21 uebayasi Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -762,6 +762,50 @@ extern void (*pmap_zero_page_func)(paddr_t); */ #define POOL_VTOPHYS(va) vtophys((vaddr_t) (va)) +#ifndef _LOCORE + +/* + * pmap-specific data store in the vm_page structure. + */ +#define __HAVE_VM_PAGE_MD +struct vm_page_md { + SLIST_HEAD(,pv_entry) pvh_list; /* pv_entry list */ + struct simplelock pvh_slock; /* lock on this head */ + int pvh_attrs; /* page attributes */ + u_int uro_mappings; + u_int urw_mappings; + union { + u_short s_mappings[2]; /* Assume kernel count <= 65535 */ + u_int i_mappings; + } k_u; +#define kro_mappings k_u.s_mappings[0] +#define krw_mappings k_u.s_mappings[1] +#define k_mappings k_u.i_mappings +}; + +/* + * Set the default color of each page. + */ +#if ARM_MMU_V6 > 0 +#define VM_MDPAGE_PVH_ATTRS_INIT(pg) \ + (pg)->mdpage.pvh_attrs = (pg)->phys_addr & arm_cache_prefer_mask +#else +#define VM_MDPAGE_PVH_ATTRS_INIT(pg) \ + (pg)->mdpage.pvh_attrs = 0 +#endif + +#define VM_MDPAGE_INIT(pg) \ +do { \ + SLIST_INIT(&(pg)->mdpage.pvh_list); \ + simple_lock_init(&(pg)->mdpage.pvh_slock); \ + VM_MDPAGE_PVH_ATTRS_INIT(pg); \ + (pg)->mdpage.uro_mappings = 0; \ + (pg)->mdpage.urw_mappings = 0; \ + (pg)->mdpage.k_mappings = 0; \ +} while (/*CONSTCOND*/0) + +#endif /* !_LOCORE */ + #endif /* _KERNEL */ #endif /* _ARM32_PMAP_H_ */ diff --git a/sys/arch/arm/include/arm32/vmparam.h b/sys/arch/arm/include/arm32/vmparam.h index fd6ac3d5c57f..024461a72d59 100644 --- a/sys/arch/arm/include/arm32/vmparam.h +++ b/sys/arch/arm/include/arm32/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.24 2009/03/06 20:31:47 joerg Exp $ */ +/* $NetBSD: vmparam.h,v 1.25 2010/11/14 13:33:21 uebayasi Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -96,47 +96,6 @@ extern vaddr_t virtual_end; #define VM_MAX_KERNEL_BUF \ ((virtual_end - virtual_avail) * 4 / 10) #endif - -/* - * pmap-specific data store in the vm_page structure. - */ -#define __HAVE_VM_PAGE_MD -struct vm_page_md { - SLIST_HEAD(,pv_entry) pvh_list; /* pv_entry list */ - struct simplelock pvh_slock; /* lock on this head */ - int pvh_attrs; /* page attributes */ - u_int uro_mappings; - u_int urw_mappings; - union { - u_short s_mappings[2]; /* Assume kernel count <= 65535 */ - u_int i_mappings; - } k_u; -#define kro_mappings k_u.s_mappings[0] -#define krw_mappings k_u.s_mappings[1] -#define k_mappings k_u.i_mappings -}; - -/* - * Set the default color of each page. - */ -#if ARM_MMU_V6 > 0 -#define VM_MDPAGE_PVH_ATTRS_INIT(pg) \ - (pg)->mdpage.pvh_attrs = (pg)->phys_addr & arm_cache_prefer_mask -#else -#define VM_MDPAGE_PVH_ATTRS_INIT(pg) \ - (pg)->mdpage.pvh_attrs = 0 -#endif - - -#define VM_MDPAGE_INIT(pg) \ -do { \ - SLIST_INIT(&(pg)->mdpage.pvh_list); \ - simple_lock_init(&(pg)->mdpage.pvh_slock); \ - VM_MDPAGE_PVH_ATTRS_INIT(pg); \ - (pg)->mdpage.uro_mappings = 0; \ - (pg)->mdpage.urw_mappings = 0; \ - (pg)->mdpage.k_mappings = 0; \ -} while (/*CONSTCOND*/0) #endif /* __ASSEMBLER__ */ #endif /* _KERNEL */ diff --git a/sys/arch/hppa/include/pmap.h b/sys/arch/hppa/include/pmap.h index a566a53815e3..d755a037dd63 100644 --- a/sys/arch/hppa/include/pmap.h +++ b/sys/arch/hppa/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.28 2010/07/06 20:50:34 cegger Exp $ */ +/* $NetBSD: pmap.h,v 1.29 2010/11/14 13:33:21 uebayasi Exp $ */ /* $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $ */ @@ -192,6 +192,25 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) ((((va) & 0xc0000000) != 0xc0000000) ? \ (pmap)->pm_space : HPPA_SID_KERNEL) +#define __HAVE_VM_PAGE_MD + +struct pv_entry; + +struct vm_page_md { + struct kmutex pvh_lock; /* locks every pv on this list */ + struct pv_entry *pvh_list; /* head of list (locked by pvh_lock) */ + u_int pvh_attrs; /* to preserve ref/mod */ + int pvh_aliases; /* alias counting */ +}; + +#define VM_MDPAGE_INIT(pg) \ +do { \ + mutex_init(&(pg)->mdpage.pvh_lock, MUTEX_NODEBUG, IPL_VM); \ + (pg)->mdpage.pvh_list = NULL; \ + (pg)->mdpage.pvh_attrs = 0; \ + (pg)->mdpage.pvh_aliases = 0; \ +} while (0) + #endif /* _KERNEL */ #endif /* _HPPA_PMAP_H_ */ diff --git a/sys/arch/hppa/include/vmparam.h b/sys/arch/hppa/include/vmparam.h index 60063c6b320e..219fd99d1aa1 100644 --- a/sys/arch/hppa/include/vmparam.h +++ b/sys/arch/hppa/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.17 2010/11/14 03:16:04 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.18 2010/11/14 13:33:21 uebayasi Exp $ */ /* $OpenBSD: vmparam.h,v 1.33 2006/06/04 17:21:24 miod Exp $ */ @@ -101,25 +101,4 @@ #define VM_FREELIST_DEFAULT 0 #define VM_FREELIST_ISADMA 1 -#if defined(_KERNEL) && !defined(_LOCORE) -#define __HAVE_VM_PAGE_MD - -struct pv_entry; - -struct vm_page_md { - struct kmutex pvh_lock; /* locks every pv on this list */ - struct pv_entry *pvh_list; /* head of list (locked by pvh_lock) */ - u_int pvh_attrs; /* to preserve ref/mod */ - int pvh_aliases; /* alias counting */ -}; - -#define VM_MDPAGE_INIT(pg) \ -do { \ - mutex_init(&(pg)->mdpage.pvh_lock, MUTEX_NODEBUG, IPL_VM); \ - (pg)->mdpage.pvh_list = NULL; \ - (pg)->mdpage.pvh_attrs = 0; \ - (pg)->mdpage.pvh_aliases = 0; \ -} while (0) -#endif - #endif /* _HPPA_VMPARAM_H_ */ diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h index a4ee1f0155ee..9f70b46daca1 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.107 2010/07/24 00:45:55 jym Exp $ */ +/* $NetBSD: pmap.h,v 1.108 2010/11/14 13:33:21 uebayasi Exp $ */ /* * @@ -447,4 +447,15 @@ struct trapframe; int pmap_exec_fixup(struct vm_map *, struct trapframe *, struct pcb *); void pmap_ldt_cleanup(struct lwp *); +#include + +#define __HAVE_VM_PAGE_MD +#define VM_MDPAGE_INIT(pg) \ + memset(&(pg)->mdpage, 0, sizeof((pg)->mdpage)); \ + PMAP_PAGE_INIT(&(pg)->mdpage.mp_pp) + +struct vm_page_md { + struct pmap_page mp_pp; +}; + #endif /* _I386_PMAP_H_ */ diff --git a/sys/arch/i386/include/vmparam.h b/sys/arch/i386/include/vmparam.h index 3981dfe35d8d..d3cfe9607fe7 100644 --- a/sys/arch/i386/include/vmparam.h +++ b/sys/arch/i386/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.71 2010/11/06 15:42:45 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.72 2010/11/14 13:33:21 uebayasi Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -133,15 +133,4 @@ #endif /* XEN */ #define VM_FREELIST_DEFAULT 0 -#include - -#define __HAVE_VM_PAGE_MD -#define VM_MDPAGE_INIT(pg) \ - memset(&(pg)->mdpage, 0, sizeof((pg)->mdpage)); \ - PMAP_PAGE_INIT(&(pg)->mdpage.mp_pp) - -struct vm_page_md { - struct pmap_page mp_pp; -}; - #endif /* _I386_VMPARAM_H_ */ diff --git a/sys/arch/ia64/include/pmap.h b/sys/arch/ia64/include/pmap.h index dfbf51fae997..87f9d0e1f6ea 100644 --- a/sys/arch/ia64/include/pmap.h +++ b/sys/arch/ia64/include/pmap.h @@ -146,4 +146,23 @@ void pmap_bootstrap(void); #define PMAP_VHPT_LOG2SIZE 16 +#include +#include +/* + * pmap-specific data store in the vm_page structure. + */ +#define __HAVE_VM_PAGE_MD +struct vm_page_md { + TAILQ_HEAD(,pv_entry) pv_list; /* pv_entry list */ + int pv_list_count; + kmutex_t pv_mutex; /* lock on this head */ + int pvh_attrs; /* page attributes */ +}; + +#define VM_MDPAGE_INIT(pg) \ +do { \ + TAILQ_INIT(&(pg)->mdpage.pv_list); \ + mutex_init(&(pg)->mdpage.pv_mutex, MUTEX_DEFAULT, IPL_NONE); \ +} while (/*CONSTCOND*/0) + #endif /* _PMAP_MACHINE_ */ diff --git a/sys/arch/ia64/include/vmparam.h b/sys/arch/ia64/include/vmparam.h index 56e14f84103e..13bb402e2010 100644 --- a/sys/arch/ia64/include/vmparam.h +++ b/sys/arch/ia64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.6 2010/11/06 15:42:46 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.7 2010/11/14 13:33:22 uebayasi Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -109,26 +109,4 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) -#ifndef _LOCORE - -#include -#include -/* - * pmap-specific data store in the vm_page structure. - */ -#define __HAVE_VM_PAGE_MD -struct vm_page_md { - TAILQ_HEAD(,pv_entry) pv_list; /* pv_entry list */ - int pv_list_count; - kmutex_t pv_mutex; /* lock on this head */ - int pvh_attrs; /* page attributes */ -}; - -#define VM_MDPAGE_INIT(pg) \ -do { \ - TAILQ_INIT(&(pg)->mdpage.pv_list); \ - mutex_init(&(pg)->mdpage.pv_mutex, MUTEX_DEFAULT, IPL_NONE); \ -} while (/*CONSTCOND*/0) -#endif /*_LOCORE*/ - #endif /* _VMPARAM_H_ */ diff --git a/sys/arch/mips/include/pmap.h b/sys/arch/mips/include/pmap.h index 4a3f60e77d31..0c4a2db8fe1f 100644 --- a/sys/arch/mips/include/pmap.h +++ b/sys/arch/mips/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.58 2010/07/06 20:50:34 cegger Exp $ */ +/* $NetBSD: pmap.h,v 1.59 2010/11/14 13:33:22 uebayasi Exp $ */ /* * Copyright (c) 1992, 1993 @@ -205,5 +205,20 @@ paddr_t mips_pmap_unmap_poolpage(vaddr_t); #define PGC_NOCACHE 0x4000000000000000ULL #endif +#define __HAVE_VM_PAGE_MD + +/* + * pmap-specific data stored in the vm_page structure. + */ +struct vm_page_md { + struct pv_entry *pvh_list; /* pv_entry list */ + u_int pvh_attrs; /* page attributes */ +}; + +#define VM_MDPAGE_INIT(pg) \ +do { \ + (pg)->mdpage.pvh_list = NULL; \ +} while (/* CONSTCOND */ 0) + #endif /* _KERNEL */ #endif /* _MIPS_PMAP_H_ */ diff --git a/sys/arch/mips/include/vmparam.h b/sys/arch/mips/include/vmparam.h index 0d84740a2ff3..f1c668780bc8 100644 --- a/sys/arch/mips/include/vmparam.h +++ b/sys/arch/mips/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.45 2010/11/06 15:42:47 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.46 2010/11/14 13:33:22 uebayasi Exp $ */ /* * Copyright (c) 1992, 1993 @@ -201,21 +201,6 @@ /* VM_PHYSSEG_MAX defined by platform-dependent code. */ #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH -#define __HAVE_VM_PAGE_MD - -/* - * pmap-specific data stored in the vm_page structure. - */ -struct vm_page_md { - struct pv_entry *pvh_list; /* pv_entry list */ - u_int pvh_attrs; /* page attributes */ -}; - -#define VM_MDPAGE_INIT(pg) \ -do { \ - (pg)->mdpage.pvh_list = NULL; \ -} while (/* CONSTCOND */ 0) - #ifndef VM_NFREELIST #define VM_NFREELIST 16 /* 16 distinct memory segments */ #define VM_FREELIST_DEFAULT 0 diff --git a/sys/arch/powerpc/include/oea/pmap.h b/sys/arch/powerpc/include/oea/pmap.h index b3ca99503008..df08683f4516 100644 --- a/sys/arch/powerpc/include/oea/pmap.h +++ b/sys/arch/powerpc/include/oea/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.18 2009/11/07 07:27:45 cegger Exp $ */ +/* $NetBSD: pmap.h,v 1.19 2010/11/14 13:33:22 uebayasi Exp $ */ /*- * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -253,6 +253,20 @@ int pmap_setup_segment0_map(int use_large_pages, ...); void pmap_zero_page(paddr_t); void pmap_copy_page(paddr_t, paddr_t); +LIST_HEAD(pvo_head, pvo_entry); + +#define __HAVE_VM_PAGE_MD + +struct vm_page_md { + struct pvo_head mdpg_pvoh; + unsigned int mdpg_attrs; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + LIST_INIT(&(pg)->mdpage.mdpg_pvoh); \ + (pg)->mdpage.mdpg_attrs = 0; \ +} while (/*CONSTCOND*/0) + __END_DECLS #endif /* _KERNEL */ #endif /* _LOCORE */ diff --git a/sys/arch/powerpc/include/oea/vmparam.h b/sys/arch/powerpc/include/oea/vmparam.h index 3ef32df40f4c..495ebc5b2fcd 100644 --- a/sys/arch/powerpc/include/oea/vmparam.h +++ b/sys/arch/powerpc/include/oea/vmparam.h @@ -194,22 +194,4 @@ #define VM_FREELIST_FIRST16 2 #define VM_FREELIST_MAX 3 -#ifndef _LOCORE - -LIST_HEAD(pvo_head, pvo_entry); - -#define __HAVE_VM_PAGE_MD - -struct vm_page_md { - struct pvo_head mdpg_pvoh; - unsigned int mdpg_attrs; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - LIST_INIT(&(pg)->mdpage.mdpg_pvoh); \ - (pg)->mdpage.mdpg_attrs = 0; \ -} while (/*CONSTCOND*/0) - -#endif /* _LOCORE */ - #endif /* _POWERPC_OEA_VMPARAM_H_ */ diff --git a/sys/arch/sh3/include/pmap.h b/sys/arch/sh3/include/pmap.h index 5c87c27c1a4b..578950ab2d40 100644 --- a/sys/arch/sh3/include/pmap.h +++ b/sys/arch/sh3/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.34 2009/10/21 21:12:02 rmind Exp $ */ +/* $NetBSD: pmap.h,v 1.35 2010/11/14 13:33:22 uebayasi Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -83,4 +83,22 @@ void pmap_prefer(vaddr_t, vaddr_t *); pt_entry_t *__pmap_pte_lookup(pmap_t, vaddr_t); pt_entry_t *__pmap_kpte_lookup(vaddr_t); bool __pmap_pte_load(pmap_t, vaddr_t, int); + +/* pmap-specific data store in the vm_page structure. */ +#define __HAVE_VM_PAGE_MD +#define PVH_REFERENCED 1 +#define PVH_MODIFIED 2 + +struct pv_entry; +struct vm_page_md { + SLIST_HEAD(, pv_entry) pvh_head; + int pvh_flags; +}; + +#define VM_MDPAGE_INIT(pg) \ +do { \ + struct vm_page_md *pvh = &(pg)->mdpage; \ + SLIST_INIT(&pvh->pvh_head); \ + pvh->pvh_flags = 0; \ +} while (/*CONSTCOND*/0) #endif /* !_SH3_PMAP_H_ */ diff --git a/sys/arch/sh3/include/vmparam.h b/sys/arch/sh3/include/vmparam.h index 20d9f1f52b1f..4db8d8e2a6e7 100644 --- a/sys/arch/sh3/include/vmparam.h +++ b/sys/arch/sh3/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.20 2010/11/06 15:42:48 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.21 2010/11/14 13:33:22 uebayasi Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -83,24 +83,4 @@ #define sh3_trunc_page(x) ((uint32_t)(x) & ~PGOFSET) #define sh3_btop(x) ((uint32_t)(x) >> PGSHIFT) #define sh3_ptob(x) ((uint32_t)(x) << PGSHIFT) - -/* pmap-specific data store in the vm_page structure. */ -#define __HAVE_VM_PAGE_MD -#define PVH_REFERENCED 1 -#define PVH_MODIFIED 2 - -#ifndef _LOCORE -struct pv_entry; -struct vm_page_md { - SLIST_HEAD(, pv_entry) pvh_head; - int pvh_flags; -}; - -#define VM_MDPAGE_INIT(pg) \ -do { \ - struct vm_page_md *pvh = &(pg)->mdpage; \ - SLIST_INIT(&pvh->pvh_head); \ - pvh->pvh_flags = 0; \ -} while (/*CONSTCOND*/0) -#endif /* _LOCORE */ #endif /* !_SH3_VMPARAM_H_ */ diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index c7081728a696..f0e3e1051e03 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.88 2009/11/21 04:16:51 rmind Exp $ */ +/* $NetBSD: pmap.h,v 1.89 2010/11/14 13:33:23 uebayasi Exp $ */ /* * Copyright (c) 1996 @@ -390,6 +390,32 @@ extern void (*pmap_protect_p)(pmap_t, vaddr_t, vaddr_t, vm_prot_t); #endif /* SUN4M || SUN4D */ +#define __HAVE_VM_PAGE_MD + +/* + * For each managed physical page, there is a list of all currently + * valid virtual mappings of that page. Since there is usually one + * (or zero) mapping per page, the table begins with an initial entry, + * rather than a pointer; this head entry is empty iff its pv_pmap + * field is NULL. + */ +struct vm_page_md { + struct pvlist { + struct pvlist *pv_next; /* next pvlist, if any */ + struct pmap *pv_pmap; /* pmap of this va */ + vaddr_t pv_va; /* virtual address */ + int pv_flags; /* flags (below) */ + } pvlisthead; +}; +#define VM_MDPAGE_PVHEAD(pg) (&(pg)->mdpage.pvlisthead) + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pvlisthead.pv_next = NULL; \ + (pg)->mdpage.pvlisthead.pv_pmap = NULL; \ + (pg)->mdpage.pvlisthead.pv_va = 0; \ + (pg)->mdpage.pvlisthead.pv_flags = 0; \ +} while(/*CONSTCOND*/0) + #endif /* _KERNEL */ #endif /* _SPARC_PMAP_H_ */ diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h index a688a9728c77..e41525ea0800 100644 --- a/sys/arch/sparc/include/vmparam.h +++ b/sys/arch/sparc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.41 2010/11/06 15:42:49 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.42 2010/11/14 13:33:23 uebayasi Exp $ */ /* * Copyright (c) 1992, 1993 @@ -118,30 +118,4 @@ #define VM_NFREELIST 1 #define VM_FREELIST_DEFAULT 0 -#define __HAVE_VM_PAGE_MD - -/* - * For each managed physical page, there is a list of all currently - * valid virtual mappings of that page. Since there is usually one - * (or zero) mapping per page, the table begins with an initial entry, - * rather than a pointer; this head entry is empty iff its pv_pmap - * field is NULL. - */ -struct vm_page_md { - struct pvlist { - struct pvlist *pv_next; /* next pvlist, if any */ - struct pmap *pv_pmap; /* pmap of this va */ - vaddr_t pv_va; /* virtual address */ - int pv_flags; /* flags (below) */ - } pvlisthead; -}; -#define VM_MDPAGE_PVHEAD(pg) (&(pg)->mdpage.pvlisthead) - -#define VM_MDPAGE_INIT(pg) do { \ - (pg)->mdpage.pvlisthead.pv_next = NULL; \ - (pg)->mdpage.pvlisthead.pv_pmap = NULL; \ - (pg)->mdpage.pvlisthead.pv_va = 0; \ - (pg)->mdpage.pvlisthead.pv_flags = 0; \ -} while(/*CONSTCOND*/0) - #endif /* _SPARC_VMPARAM_H_ */ diff --git a/sys/arch/sparc64/include/pmap.h b/sys/arch/sparc64/include/pmap.h index ca498824faf6..95c617e59d53 100644 --- a/sys/arch/sparc64/include/pmap.h +++ b/sys/arch/sparc64/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.52 2010/03/06 08:08:29 mrg Exp $ */ +/* $NetBSD: pmap.h,v 1.53 2010/11/14 13:33:23 uebayasi Exp $ */ /*- * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -210,6 +210,30 @@ void pmap_zero_page_phys(paddr_t); extern int phys_installed_size; extern struct mem_region *phys_installed; +#define __HAVE_VM_PAGE_MD + +/* + * For each struct vm_page, there is a list of all currently valid virtual + * mappings of that page. An entry is a pv_entry_t. + */ +struct pmap; +typedef struct pv_entry { + struct pv_entry *pv_next; /* next pv_entry */ + struct pmap *pv_pmap; /* pmap where mapping lies */ + vaddr_t pv_va; /* virtual address for mapping */ +} *pv_entry_t; +/* PV flags encoded in the low bits of the VA of the first pv_entry */ + +struct vm_page_md { + struct pv_entry mdpg_pvh; +}; +#define VM_MDPAGE_INIT(pg) \ +do { \ + (pg)->mdpage.mdpg_pvh.pv_next = NULL; \ + (pg)->mdpage.mdpg_pvh.pv_pmap = NULL; \ + (pg)->mdpage.mdpg_pvh.pv_va = 0; \ +} while (/*CONSTCOND*/0) + #endif /* _KERNEL */ #endif /* _LOCORE */ diff --git a/sys/arch/sparc64/include/vmparam.h b/sys/arch/sparc64/include/vmparam.h index a0455bc023b0..59acf6de9fa9 100644 --- a/sys/arch/sparc64/include/vmparam.h +++ b/sys/arch/sparc64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.31 2010/11/06 15:42:49 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.32 2010/11/14 13:33:23 uebayasi Exp $ */ /* * Copyright (c) 1992, 1993 @@ -169,32 +169,4 @@ #define VM_NFREELIST 1 #define VM_FREELIST_DEFAULT 0 -#ifdef _KERNEL - -#define __HAVE_VM_PAGE_MD - -/* - * For each struct vm_page, there is a list of all currently valid virtual - * mappings of that page. An entry is a pv_entry_t. - */ -struct pmap; -typedef struct pv_entry { - struct pv_entry *pv_next; /* next pv_entry */ - struct pmap *pv_pmap; /* pmap where mapping lies */ - vaddr_t pv_va; /* virtual address for mapping */ -} *pv_entry_t; -/* PV flags encoded in the low bits of the VA of the first pv_entry */ - -struct vm_page_md { - struct pv_entry mdpg_pvh; -}; -#define VM_MDPAGE_INIT(pg) \ -do { \ - (pg)->mdpage.mdpg_pvh.pv_next = NULL; \ - (pg)->mdpage.mdpg_pvh.pv_pmap = NULL; \ - (pg)->mdpage.mdpg_pvh.pv_va = 0; \ -} while (/*CONSTCOND*/0) - -#endif /* _KERNEL */ - #endif diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index 31c565d591c3..a2a814408730 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.78 2010/11/12 13:35:51 uebayasi Exp $ */ +/* $NetBSD: pmap.h,v 1.79 2010/11/14 13:33:23 uebayasi Exp $ */ /* * Copyright (c) 1991 Regents of the University of California. @@ -289,4 +289,14 @@ pmap_remove_all(struct pmap *pmap) void pmap_bootstrap(void); vaddr_t pmap_map(vaddr_t, vaddr_t, vaddr_t, int); +#if 0 +#define __HAVE_VM_PAGE_MD + +struct vm_page_md { + unsigned int md_attrs; +}; + +#define VM_MDPAGE_INIT(pg) ((pg)->mdpage.md_attrs = 0) +#endif + #endif /* PMAP_H */ diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h index 1cad274ffa78..03192904ecf4 100644 --- a/sys/arch/vax/include/vmparam.h +++ b/sys/arch/vax/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.46 2010/11/06 15:42:50 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.47 2010/11/14 13:33:23 uebayasi Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -108,15 +108,4 @@ #define USRIOSIZE (8 * VAX_NPTEPG) /* 512MB */ #define VM_PHYS_SIZE (USRIOSIZE*VAX_NBPG) -#if 0 -#define __HAVE_VM_PAGE_MD - -struct vm_page_md { - unsigned int md_attrs; -}; - -#define VM_MDPAGE_INIT(pg) ((pg)->mdpage.md_attrs = 0) -#endif - - #endif