diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-01-30 18:16:42 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-01-30 18:16:42 +0000 |
commit | 150ead6262ab7cbac1aa9cd45e3a1c47544e5c15 (patch) | |
tree | 1e82bc7c9335d090e0a0f0f3f4e179717b201a6e | |
parent | ba74087eb3865e1609b3d666f13601206dc40297 (diff) |
Move declaration of struct vm_page_md from <machine/vmparam.h> to
<machine/pmap.h> where it belongs, and compensate in <uvm/uvm_extern.h>
by including <uvm/uvm_pmap.h> before <uvm/uvm_page.h>. Tested on all
MACHINE_ARCH but amd64 and i386 (and hppa64).
31 files changed, 348 insertions, 352 deletions
diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h index 4cef887f13e..7e3d9d21596 100644 --- a/sys/arch/alpha/include/pmap.h +++ b/sys/arch/alpha/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.31 2014/01/26 17:40:11 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.32 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.37 2000/11/19 03:16:35 thorpej Exp $ */ /*- @@ -311,4 +311,18 @@ do { \ #endif /* _KERNEL */ +/* + * pmap-specific data stored in the vm_page structure. + */ +struct vm_page_md { + struct pv_entry *pvh_list; /* pv entry list */ + int pvh_attrs; /* page attributes */ +}; + +#define VM_MDPAGE_INIT(pg) \ +do { \ + (pg)->mdpage.pvh_list = NULL; \ + (pg)->mdpage.pvh_attrs = 0; \ +} while (0) + #endif /* _PMAP_MACHINE_ */ diff --git a/sys/arch/alpha/include/vmparam.h b/sys/arch/alpha/include/vmparam.h index ecb214aee77..3cee4af8579 100644 --- a/sys/arch/alpha/include/vmparam.h +++ b/sys/arch/alpha/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.24 2014/01/23 22:06:29 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.25 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.18 2000/05/22 17:13:54 thorpej Exp $ */ /* @@ -125,18 +125,4 @@ #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH #define VM_PHYSSEG_NOADD /* no more after vm_mem_init */ -/* - * pmap-specific data stored in the vm_page structure. - */ -struct vm_page_md { - struct pv_entry *pvh_list; /* pv entry list */ - int pvh_attrs; /* page attributes */ -}; - -#define VM_MDPAGE_INIT(pg) \ -do { \ - (pg)->mdpage.pvh_list = NULL; \ - (pg)->mdpage.pvh_attrs = 0; \ -} while (0) - #endif /* ! _MACHINE_VMPARAM_H_ */ diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h index 1493759dc07..d1af66c6737 100644 --- a/sys/arch/amd64/include/pmap.h +++ b/sys/arch/amd64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.41 2013/03/31 17:07:02 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.42 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -567,4 +567,16 @@ kvtopte(vaddr_t va) #define __HAVE_PMAP_DIRECT #endif /* _KERNEL && !_LOCORE */ + +#ifndef _LOCORE +struct pv_entry; +struct vm_page_md { + struct pv_entry *pv_list; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pv_list = NULL; \ +} while (0) +#endif /* !_LOCORE */ + #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/amd64/include/vmparam.h b/sys/arch/amd64/include/vmparam.h index bd4b65595c8..cc78a8a8b7c 100644 --- a/sys/arch/amd64/include/vmparam.h +++ b/sys/arch/amd64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.17 2014/01/23 22:06:29 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.18 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */ /*- @@ -110,13 +110,4 @@ #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ -struct pv_entry; -struct vm_page_md { - struct pv_entry *pv_list; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - (pg)->mdpage.pv_list = NULL; \ -} while (0) - #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/arch/arm/include/pmap.h b/sys/arch/arm/include/pmap.h index 05844461241..4f6b8187d82 100644 --- a/sys/arch/arm/include/pmap.h +++ b/sys/arch/arm/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.24 2013/05/18 18:06:05 patrick Exp $ */ +/* $OpenBSD: pmap.h,v 1.25 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */ /* @@ -69,6 +69,8 @@ #ifndef _ARM_PMAP_H_ #define _ARM_PMAP_H_ +#include <sys/lock.h> /* struct simplelock */ + #ifdef _KERNEL #include <arm/cpuconf.h> @@ -713,4 +715,34 @@ extern uint32_t pmap_alias_bits; #endif /* _KERNEL */ +#ifndef _LOCORE +/* + * pmap-specific data store in the vm_page structure. + */ +struct vm_page_md { + struct 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 +}; + +#define VM_MDPAGE_INIT(pg) \ +do { \ + (pg)->mdpage.pvh_list = NULL; \ + simple_lock_init(&(pg)->mdpage.pvh_slock); \ + (pg)->mdpage.pvh_attrs = 0; \ + (pg)->mdpage.uro_mappings = 0; \ + (pg)->mdpage.urw_mappings = 0; \ + (pg)->mdpage.k_mappings = 0; \ +} while (/*CONSTCOND*/0) +#endif /* _LOCORE */ + #endif /* _ARM_PMAP_H_ */ diff --git a/sys/arch/arm/include/vmparam.h b/sys/arch/arm/include/vmparam.h index 7c21d5b30a2..cfc9c935acc 100644 --- a/sys/arch/arm/include/vmparam.h +++ b/sys/arch/arm/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.12 2014/01/26 15:43:02 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.13 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.18 2003/05/21 18:04:44 thorpej Exp $ */ /* @@ -43,8 +43,6 @@ * Virtual Memory parameters common to all arm32 platforms. */ -#include <sys/lock.h> /* struct simplelock */ - #define USRTEXT VM_MIN_ADDRESS #define USRSTACK VM_MAXUSER_ADDRESS #define KERNBASE VM_MAXUSER_ADDRESS @@ -97,32 +95,4 @@ #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) ARM_KERNEL_BASE) #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) 0xffffffff) -/* - * pmap-specific data store in the vm_page structure. - */ -struct vm_page_md { - struct 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 -}; - -#define VM_MDPAGE_INIT(pg) \ -do { \ - (pg)->mdpage.pvh_list = NULL; \ - simple_lock_init(&(pg)->mdpage.pvh_slock); \ - (pg)->mdpage.pvh_attrs = 0; \ - (pg)->mdpage.uro_mappings = 0; \ - (pg)->mdpage.urw_mappings = 0; \ - (pg)->mdpage.k_mappings = 0; \ -} while (/*CONSTCOND*/0) - #endif /* _ARM_VMPARAM_H_ */ diff --git a/sys/arch/hppa/include/pmap.h b/sys/arch/hppa/include/pmap.h index b80b1f4bc02..43135a46ef0 100644 --- a/sys/arch/hppa/include/pmap.h +++ b/sys/arch/hppa/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.44 2013/03/31 17:07:03 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.45 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -156,4 +156,23 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) } #endif /* _KERNEL */ + +#if !defined(_LOCORE) + +#include <sys/lock.h> + +struct pv_entry; +struct vm_page_md { + struct simplelock 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 */ +}; + +#define VM_MDPAGE_INIT(pg) do { \ + simple_lock_init(&(pg)->mdpage.pvh_lock); \ + (pg)->mdpage.pvh_list = NULL; \ + (pg)->mdpage.pvh_attrs = 0; \ +} while (0) +#endif + #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/hppa/include/vmparam.h b/sys/arch/hppa/include/vmparam.h index c2a528d2e5a..de0bfea035b 100644 --- a/sys/arch/hppa/include/vmparam.h +++ b/sys/arch/hppa/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.41 2014/01/24 05:21:19 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.42 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 1988-1994, The University of Utah and @@ -92,22 +92,4 @@ #define VM_PHYSSEG_NOADD /* XXX until uvm code is fixed */ -#if !defined(_LOCORE) - -#include <sys/lock.h> - -struct pv_entry; -struct vm_page_md { - struct simplelock 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 */ -}; - -#define VM_MDPAGE_INIT(pg) do { \ - simple_lock_init(&(pg)->mdpage.pvh_lock); \ - (pg)->mdpage.pvh_list = NULL; \ - (pg)->mdpage.pvh_attrs = 0; \ -} while (0) -#endif - #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/arch/hppa64/include/pmap.h b/sys/arch/hppa64/include/pmap.h index d580428d01e..4b08d9c613d 100644 --- a/sys/arch/hppa64/include/pmap.h +++ b/sys/arch/hppa64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.9 2011/09/18 11:55:23 kettenis Exp $ */ +/* $OpenBSD: pmap.h,v 1.10 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -120,4 +120,23 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) } #endif /* _KERNEL */ + +#if !defined(_LOCORE) + +#include <sys/lock.h> + +struct pv_entry; +struct vm_page_md { + struct simplelock 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 */ +}; + +#define VM_MDPAGE_INIT(pg) do { \ + simple_lock_init(&(pg)->mdpage.pvh_lock); \ + (pg)->mdpage.pvh_list = NULL; \ + (pg)->mdpage.pvh_attrs = 0; \ +} while (0) +#endif + #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/hppa64/include/vmparam.h b/sys/arch/hppa64/include/vmparam.h index a8d4a6329c8..c8fcd21d183 100644 --- a/sys/arch/hppa64/include/vmparam.h +++ b/sys/arch/hppa64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.9 2014/01/24 05:21:19 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.10 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 1988-1994, The University of Utah and @@ -92,22 +92,4 @@ #define VM_PHYSSEG_NOADD /* XXX until uvm code is fixed */ -#if !defined(_LOCORE) - -#include <sys/lock.h> - -struct pv_entry; -struct vm_page_md { - struct simplelock 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 */ -}; - -#define VM_MDPAGE_INIT(pg) do { \ - simple_lock_init(&(pg)->mdpage.pvh_lock); \ - (pg)->mdpage.pvh_list = NULL; \ - (pg)->mdpage.pvh_attrs = 0; \ -} while (0) -#endif - #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h index 33bad6e20fc..4de8f2c1c2f 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.63 2014/01/06 14:29:25 sf Exp $ */ +/* $OpenBSD: pmap.h,v 1.64 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */ /* @@ -477,4 +477,14 @@ void pmap_ldt_cleanup(struct proc *); #endif /* USER_LDT */ #endif /* _KERNEL */ + +struct pv_entry; +struct vm_page_md { + struct pv_entry *pv_list; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pv_list = NULL; \ +} while (0) + #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/i386/include/vmparam.h b/sys/arch/i386/include/vmparam.h index 7c965880c47..7be4920756f 100644 --- a/sys/arch/i386/include/vmparam.h +++ b/sys/arch/i386/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.52 2014/01/23 22:06:29 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.53 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.15 1994/10/27 04:16:34 cgd Exp $ */ /*- @@ -117,13 +117,4 @@ #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ -struct pv_entry; -struct vm_page_md { - struct pv_entry *pv_list; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - (pg)->mdpage.pv_list = NULL; \ -} while (0) - #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/arch/m68k/include/pmap_motorola.h b/sys/arch/m68k/include/pmap_motorola.h index e545bdcc1cc..9c727ddb697 100644 --- a/sys/arch/m68k/include/pmap_motorola.h +++ b/sys/arch/m68k/include/pmap_motorola.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_motorola.h,v 1.26 2011/11/01 21:20:55 miod Exp $ */ +/* $OpenBSD: pmap_motorola.h,v 1.27 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -39,10 +39,13 @@ #ifndef _M68K_M68K_PMAP_MOTOROLA_H_ #define _M68K_M68K_PMAP_MOTOROLA_H_ +#if !defined(_LOCORE) +#include <machine/pte.h> +#endif + #ifdef _KERNEL #include <machine/cpu.h> -#include <machine/pte.h> /* * Pmap stuff @@ -117,4 +120,39 @@ void pmap_kenter_cache(vaddr_t, paddr_t, pt_entry_t); #endif /* _KERNEL */ +#ifndef _LOCORE + +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 */ + st_entry_t *pv_ptste; /* non-zero if VA maps a PT page */ + struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */ + int pv_flags; /* flags */ +}; + +/* + * pv_flags carries some PTE permission bits as well - make sure extra flags + * values are > (1 << PG_SHIFT) + */ +/* header: all entries are cache inhibited */ +#define PV_CI (0x01 << PG_SHIFT) +/* header: entry maps a page table page */ +#define PV_PTPAGE (0x02 << PG_SHIFT) + +struct vm_page_md { + struct pv_entry pvent; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pvent.pv_next = NULL; \ + (pg)->mdpage.pvent.pv_pmap = NULL; \ + (pg)->mdpage.pvent.pv_va = 0; \ + (pg)->mdpage.pvent.pv_ptste = NULL; \ + (pg)->mdpage.pvent.pv_ptpmap = NULL; \ + (pg)->mdpage.pvent.pv_flags = 0; \ +} while (0) + +#endif /* _LOCORE */ + #endif /* !_M68K_M68K_PMAP_MOTOROLA_H_ */ diff --git a/sys/arch/m68k/include/vmparam.h b/sys/arch/m68k/include/vmparam.h index 5ce336af4a2..c68ac178126 100644 --- a/sys/arch/m68k/include/vmparam.h +++ b/sys/arch/m68k/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.12 2014/01/23 22:06:29 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.13 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -114,42 +114,4 @@ */ #define VM_PHYSSEG_NOADD -#ifndef _LOCORE - -#include <machine/pte.h> /* st_entry_t */ - -/* XXX - belongs in pmap.h, but put here because of ordering issues */ -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 */ - st_entry_t *pv_ptste; /* non-zero if VA maps a PT page */ - struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */ - int pv_flags; /* flags */ -}; - -/* - * pv_flags carries some PTE permission bits as well - make sure extra flags - * values are > (1 << PG_SHIFT) - */ -/* header: all entries are cache inhibited */ -#define PV_CI (0x01 << PG_SHIFT) -/* header: entry maps a page table page */ -#define PV_PTPAGE (0x02 << PG_SHIFT) - -struct vm_page_md { - struct pv_entry pvent; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - (pg)->mdpage.pvent.pv_next = NULL; \ - (pg)->mdpage.pvent.pv_pmap = NULL; \ - (pg)->mdpage.pvent.pv_va = 0; \ - (pg)->mdpage.pvent.pv_ptste = NULL; \ - (pg)->mdpage.pvent.pv_ptpmap = NULL; \ - (pg)->mdpage.pvent.pv_flags = 0; \ -} while (0) - -#endif /* _LOCORE */ - #endif /* !_M68K_VMPARAM_H_ */ diff --git a/sys/arch/m88k/include/pmap.h b/sys/arch/m88k/include/pmap.h index 27e8ff69b1f..73b9a15b2f6 100644 --- a/sys/arch/m88k/include/pmap.h +++ b/sys/arch/m88k/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.23 2013/11/02 23:10:30 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.24 2014/01/30 18:16:41 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1991 Carnegie Mellon University @@ -83,4 +83,25 @@ int pmap_translation_info(pmap_t, vaddr_t, paddr_t *, uint32_t *); #endif /* _KERNEL */ +#ifndef _LOCORE +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 */ + int pv_flags; +}; + +struct vm_page_md { + struct pv_entry pvent; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pvent.pv_next = NULL; \ + (pg)->mdpage.pvent.pv_pmap = NULL; \ + (pg)->mdpage.pvent.pv_va = 0; \ + (pg)->mdpage.pvent.pv_flags = 0; \ +} while (0) + +#endif /* _LOCORE */ + #endif /* _M88K_PMAP_H_ */ diff --git a/sys/arch/m88k/include/vmparam.h b/sys/arch/m88k/include/vmparam.h index b1acd526c43..e7be94ff5c4 100644 --- a/sys/arch/m88k/include/vmparam.h +++ b/sys/arch/m88k/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.13 2014/01/23 22:06:29 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.14 2014/01/30 18:16:41 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University @@ -86,30 +86,4 @@ #define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM #define VM_PHYSSEG_NOADD -#ifndef _LOCORE -/* - * pmap-specific data stored in the vm_physmem[] array. - */ - -/* XXX - belongs in pmap.h, but put here because of ordering issues */ -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 */ - int pv_flags; -}; - -struct vm_page_md { - struct pv_entry pvent; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - (pg)->mdpage.pvent.pv_next = NULL; \ - (pg)->mdpage.pvent.pv_pmap = NULL; \ - (pg)->mdpage.pvent.pv_va = 0; \ - (pg)->mdpage.pvent.pv_flags = 0; \ -} while (0) - -#endif /* _LOCORE */ - #endif /* _MACHINE_VM_PARAM_ */ diff --git a/sys/arch/macppc/include/vmparam.h b/sys/arch/macppc/include/vmparam.h index 2160f020553..bd100b466ea 100644 --- a/sys/arch/macppc/include/vmparam.h +++ b/sys/arch/macppc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.25 2014/01/24 05:21:19 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.26 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ /*- @@ -101,13 +101,4 @@ extern vaddr_t ppc_kvm_stolen; #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ -struct pv_entry; -struct vm_page_md { - LIST_HEAD(,pte_desc) pv_list; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - LIST_INIT(&((pg)->mdpage.pv_list)); \ -} while (0) - #endif diff --git a/sys/arch/mips64/include/pmap.h b/sys/arch/mips64/include/pmap.h index 9db0f268fff..497a59d7b3f 100644 --- a/sys/arch/mips64/include/pmap.h +++ b/sys/arch/mips64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.29 2013/05/29 20:36:12 pirofti Exp $ */ +/* $OpenBSD: pmap.h,v 1.30 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -176,4 +176,24 @@ vm_page_t pmap_unmap_direct(vaddr_t); #endif /* _KERNEL */ +#if !defined(_LOCORE) +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; + +struct vm_page_md { + struct pv_entry pv_ent; /* pv list of this seg */ +}; + +#define VM_MDPAGE_INIT(pg) \ + do { \ + (pg)->mdpage.pv_ent.pv_next = NULL; \ + (pg)->mdpage.pv_ent.pv_pmap = NULL; \ + (pg)->mdpage.pv_ent.pv_va = 0; \ + } while (0) + +#endif /* !_LOCORE */ + #endif /* !_MIPS64_PMAP_H_ */ diff --git a/sys/arch/mips64/include/vmparam.h b/sys/arch/mips64/include/vmparam.h index bbf323b6f49..ef8ba3edc5a 100644 --- a/sys/arch/mips64/include/vmparam.h +++ b/sys/arch/mips64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.26 2014/01/24 05:21:19 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.27 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */ /* @@ -109,29 +109,4 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) -#if !defined(_LOCORE) -/* - * pmap-specific data - */ - -/* XXX - belongs in pmap.h, but put here because of ordering issues */ -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; - -struct vm_page_md { - struct pv_entry pv_ent; /* pv list of this seg */ -}; - -#define VM_MDPAGE_INIT(pg) \ - do { \ - (pg)->mdpage.pv_ent.pv_next = NULL; \ - (pg)->mdpage.pv_ent.pv_pmap = NULL; \ - (pg)->mdpage.pv_ent.pv_va = 0; \ - } while (0) - -#endif /* _KERNEL && !_LOCORE */ - #endif /* !_MIPS64_VMPARAM_H_ */ diff --git a/sys/arch/powerpc/include/pmap.h b/sys/arch/powerpc/include/pmap.h index 03ae397f4d7..fe6c6395d43 100644 --- a/sys/arch/powerpc/include/pmap.h +++ b/sys/arch/powerpc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.49 2013/03/23 16:12:26 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.50 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ /*- @@ -167,5 +167,15 @@ int reserve_dumppages(caddr_t p); #define PMAP_NOCACHE 0x1 /* map uncached */ #endif /* _KERNEL */ + +struct vm_page_md { + LIST_HEAD(,pte_desc) pv_list; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + LIST_INIT(&((pg)->mdpage.pv_list)); \ +} while (0) + #endif /* _LOCORE */ + #endif /* _POWERPC_PMAP_H_ */ diff --git a/sys/arch/sh/include/pmap.h b/sys/arch/sh/include/pmap.h index 71fa349d466..ebcfc99b23d 100644 --- a/sys/arch/sh/include/pmap.h +++ b/sys/arch/sh/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.12 2013/03/31 17:07:03 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.13 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.28 2006/04/10 23:12:11 uwe Exp $ */ /*- @@ -101,4 +101,23 @@ pt_entry_t *__pmap_kpte_lookup(vaddr_t); boolean_t __pmap_pte_load(pmap_t, vaddr_t, int); #endif /* !_KERNEL */ + +#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 /* !_SH_PMAP_H_ */ diff --git a/sys/arch/sh/include/vmparam.h b/sys/arch/sh/include/vmparam.h index 59dcf653a5d..1ca15b6f6f9 100644 --- a/sys/arch/sh/include/vmparam.h +++ b/sys/arch/sh/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.9 2014/01/23 22:06:29 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.10 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.17 2006/03/04 01:55:03 uwe Exp $ */ /*- @@ -85,22 +85,4 @@ #define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE) -/* pmap-specific data store in the vm_page structure. */ -#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 /* !_SH_VMPARAM_H_ */ diff --git a/sys/arch/socppc/include/vmparam.h b/sys/arch/socppc/include/vmparam.h index 8e04269ca9f..2a4edbe9d51 100644 --- a/sys/arch/socppc/include/vmparam.h +++ b/sys/arch/socppc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.7 2014/01/24 05:21:19 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.8 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ /*- @@ -97,13 +97,4 @@ extern vaddr_t ppc_kvm_stolen; #define VM_PHYSSEG_NOADD #define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM -struct pv_entry; -struct vm_page_md { - LIST_HEAD(,pte_desc) pv_list; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - LIST_INIT(&((pg)->mdpage.pv_list)); \ -} while (0) - #endif diff --git a/sys/arch/solbourne/include/pmap.h b/sys/arch/solbourne/include/pmap.h index ca54d15507f..e65202d0736 100644 --- a/sys/arch/solbourne/include/pmap.h +++ b/sys/arch/solbourne/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.7 2013/03/21 02:10:37 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.8 2014/01/30 18:16:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -92,4 +92,22 @@ void pmap_writetext(unsigned char *, int); #endif /* _KERNEL */ +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) */ +}; + +struct vm_page_md { + struct pvlist pv_head; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pv_head.pv_next = NULL; \ + (pg)->mdpage.pv_head.pv_pmap = NULL; \ + (pg)->mdpage.pv_head.pv_va = 0; \ + (pg)->mdpage.pv_head.pv_flags = 0; \ +} while (0) + #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index 022aadb3b34..bed3dfd7f9a 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.53 2013/06/11 16:42:11 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.54 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */ /* @@ -175,38 +175,6 @@ struct pmap { typedef struct pmap *pmap_t; -/* - * 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. - * - * Note that these are per machine independent page (so there may be - * only one for every two hardware pages, e.g.). Since the virtual - * address is aligned on a page boundary, the low order bits are free - * for storing flags. Only the head of each list has flags. - * - * THIS SHOULD BE PART OF THE CORE MAP - */ -/* XXX - struct pvlist moved to vmparam.h because of include ordering issues */ - -/* - * Flags in pv_flags. Note that PV_MOD must be 1 and PV_REF must be 2 - * since they must line up with the bits in the hardware PTEs (see pte.h). - * SUN4M bits are at a slightly different location in the PTE. - * Note: the REF, MOD and ANC flag bits occur only in the head of a pvlist. - * The cacheable bit (either PV_NC or PV_C4M) is meaningful in each - * individual pv entry. - */ -#define PV_MOD 1 /* page modified */ -#define PV_REF 2 /* page referenced */ -#define PV_NC 4 /* page cannot be cached */ -#define PV_REF4M 1 /* page referenced (SRMMU) */ -#define PV_MOD4M 2 /* page modified (SRMMU) */ -#define PV_C4M 4 /* page _can_ be cached (SRMMU) */ -#define PV_ANC 0x10 /* page has incongruent aliases */ - #if 0 struct kvm_cpustate { int kvm_npmemarr; @@ -407,4 +375,55 @@ extern void (*pmap_changeprot_p)(pmap_t, vaddr_t, #endif /* _KERNEL */ +/* + * 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. + * + * Note that these are per machine independent page (so there may be + * only one for every two hardware pages, e.g.). Since the virtual + * address is aligned on a page boundary, the low order bits are free + * for storing flags. Only the head of each list has flags. + */ + +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) */ +}; + +struct vm_page_md { + struct pvlist pv_head; +}; + +#ifdef _KERNEL + +/* + * Flags in pv_flags. Note that PV_MOD must be 1 and PV_REF must be 2 + * since they must line up with the bits in the hardware PTEs (see pte.h). + * SUN4M bits are at a slightly different location in the PTE. + * Note: the REF, MOD and ANC flag bits occur only in the head of a pvlist. + * The cacheable bit (either PV_NC or PV_C4M) is meaningful in each + * individual pv entry. + */ +#define PV_MOD 1 /* page modified */ +#define PV_REF 2 /* page referenced */ +#define PV_NC 4 /* page cannot be cached */ +#define PV_REF4M 1 /* page referenced (SRMMU) */ +#define PV_MOD4M 2 /* page modified (SRMMU) */ +#define PV_C4M 4 /* page _can_ be cached (SRMMU) */ +#define PV_ANC 0x10 /* page has incongruent aliases */ + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pv_head.pv_next = NULL; \ + (pg)->mdpage.pv_head.pv_pmap = NULL; \ + (pg)->mdpage.pv_head.pv_va = 0; \ + (pg)->mdpage.pv_head.pv_flags = 0; \ +} while (0) + +#endif /* _KERNEL */ + #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h index 0d51ddf7362..827a355a537 100644 --- a/sys/arch/sparc/include/vmparam.h +++ b/sys/arch/sparc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.40 2014/01/23 22:06:29 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.41 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.13 1997/07/12 16:20:03 perry Exp $ */ /* @@ -105,30 +105,6 @@ #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ -/* - * pmap specific data stored in the vm_physmem[] array - */ - - -/* XXX - belongs in pmap.h, but put here because of ordering issues */ -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) */ -}; - -struct vm_page_md { - struct pvlist pv_head; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - (pg)->mdpage.pv_head.pv_next = NULL; \ - (pg)->mdpage.pv_head.pv_pmap = NULL; \ - (pg)->mdpage.pv_head.pv_va = 0; \ - (pg)->mdpage.pv_head.pv_flags = 0; \ -} while (0) - #if defined (_KERNEL) && !defined(_LOCORE) struct vm_map; #define dvma_mapin(map,va,len,canwait) dvma_mapin_space(map,va,len,canwait,0) diff --git a/sys/arch/sparc64/include/pmap.h b/sys/arch/sparc64/include/pmap.h index d674032a908..e7556b4ca00 100644 --- a/sys/arch/sparc64/include/pmap.h +++ b/sys/arch/sparc64/include/pmap.h @@ -188,7 +188,28 @@ void switchexit(struct proc *); int ctx_alloc(struct pmap*); void ctx_free(struct pmap*); - #endif /* _KERNEL */ + +/* + * For each struct vm_page, there is a list of all currently valid virtual + * mappings of that page. + */ +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 pvent; +}; + +#define VM_MDPAGE_INIT(pg) do { \ + (pg)->mdpage.pvent.pv_next = NULL; \ + (pg)->mdpage.pvent.pv_pmap = NULL; \ + (pg)->mdpage.pvent.pv_va = 0; \ +} while (0) + #endif /* _LOCORE */ #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/sparc64/include/vmparam.h b/sys/arch/sparc64/include/vmparam.h index 7cf65c04adf..2994e461032 100644 --- a/sys/arch/sparc64/include/vmparam.h +++ b/sys/arch/sparc64/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.24 2014/01/23 22:06:30 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.25 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.18 2001/05/01 02:19:19 thorpej Exp $ */ /* @@ -115,30 +115,6 @@ #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ -/* - * 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, the list is pv_table. - * - * XXX - this doesn't belong here, but for now we have to keep it here - * because of include ordering issues. - */ -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 pvent; -}; - -#define VM_MDPAGE_INIT(pg) do { \ - (pg)->mdpage.pvent.pv_next = NULL; \ - (pg)->mdpage.pvent.pv_pmap = NULL; \ - (pg)->mdpage.pvent.pv_va = 0; \ -} while (0) - #if defined (_KERNEL) && !defined(_LOCORE) struct vm_map; vaddr_t dvma_mapin(struct vm_map *, vaddr_t, int, int); diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index 9b84e438fe5..994f94b99ff 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.37 2013/11/24 22:08:23 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.38 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */ /* @@ -135,4 +135,15 @@ void pmap_pinit(pmap_t); #endif /* _KERNEL */ +struct vm_page_md { + struct pv_entry *pv_head; + int pv_attr; /* write/modified bits */ +}; + +#define VM_MDPAGE_INIT(pg) \ + do { \ + (pg)->mdpage.pv_head = NULL; \ + (pg)->mdpage.pv_attr = 0; \ + } while (0) + #endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h index 98ba01be5e8..6e2650a4d76 100644 --- a/sys/arch/vax/include/vmparam.h +++ b/sys/arch/vax/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.35 2014/01/23 22:06:30 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.36 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.32 2000/03/07 00:05:59 matt Exp $ */ /*- @@ -102,20 +102,4 @@ #define USRIOSIZE (8 * VAX_NPTEPG) /* 512MB */ #define VM_PHYS_SIZE (USRIOSIZE*VAX_NBPG) -/* - * This should be in <machine/pmap.h>, but needs to be in this file - * due to include ordering issues. - */ - -struct vm_page_md { - struct pv_entry *pv_head; - int pv_attr; /* write/modified bits */ -}; - -#define VM_MDPAGE_INIT(pg) \ - do { \ - (pg)->mdpage.pv_head = NULL; \ - (pg)->mdpage.pv_attr = 0; \ - } while (0) - #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 380cdaf57e4..59aba87302c 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.109 2013/07/09 15:37:43 beck Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.110 2014/01/30 18:16:41 miod Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -400,8 +400,8 @@ extern struct uvmexp uvmexp; #include <uvm/uvm_param.h> #include <sys/lock.h> #include <sys/mutex.h> -#include <uvm/uvm_page.h> #include <uvm/uvm_pmap.h> +#include <uvm/uvm_page.h> #include <uvm/uvm_map.h> #include <uvm/uvm_fault.h> #include <uvm/uvm_pager.h> |