1 /* $OpenBSD: uvm_pmap.h,v 1.24 2015/02/15 21:34:33 miod Exp $ */ 2 /* $NetBSD: uvm_pmap.h,v 1.1 2000/06/27 09:00:14 mrg Exp $ */ 3 4 /* 5 * Copyright (c) 1991, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * The Mach Operating System project at Carnegie-Mellon University. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)pmap.h 8.1 (Berkeley) 6/11/93 36 * 37 * 38 * Copyright (c) 1987, 1990 Carnegie-Mellon University. 39 * All rights reserved. 40 * 41 * Author: Avadis Tevanian, Jr. 42 * 43 * Permission to use, copy, modify and distribute this software and 44 * its documentation is hereby granted, provided that both the copyright 45 * notice and this permission notice appear in all copies of the 46 * software, derivative works or modified versions, and any portions 47 * thereof, and that both notices appear in supporting documentation. 48 * 49 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 50 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 51 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 52 * 53 * Carnegie Mellon requests users of this software to return to 54 * 55 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 56 * School of Computer Science 57 * Carnegie Mellon University 58 * Pittsburgh PA 15213-3890 59 * 60 * any improvements or extensions that they make and grant Carnegie the 61 * rights to redistribute these changes. 62 */ 63 64 /* 65 * Machine address mapping definitions -- machine-independent 66 * section. [For machine-dependent section, see "machine/pmap.h".] 67 */ 68 69 #ifndef _PMAP_VM_ 70 #define _PMAP_VM_ 71 72 struct proc; /* for pmap_activate()/pmap_deactivate() proto */ 73 74 /* 75 * Each machine dependent implementation is expected to 76 * keep certain statistics. They may do this anyway they 77 * so choose, but are expected to return the statistics 78 * in the following structure. 79 */ 80 struct pmap_statistics { 81 long resident_count; /* # of pages mapped (total)*/ 82 long wired_count; /* # of pages wired */ 83 }; 84 typedef struct pmap_statistics *pmap_statistics_t; 85 86 #include <machine/pmap.h> 87 88 /* 89 * Flags passed to pmap_enter(). Note the bottom 3 bits are PROT_* 90 * bits, used to indicate the access type that was made (to seed modified 91 * and referenced information). 92 */ 93 #define PMAP_WIRED 0x00000010 /* wired mapping */ 94 #define PMAP_CANFAIL 0x00000020 /* can fail if resource shortage */ 95 #define PMAP_MD0 0x00000040 /* Machine dependant */ 96 #define PMAP_MD1 0x00000080 /* Machine dependant */ 97 #define PMAP_MD2 0x00000100 /* Machine dependant */ 98 #define PMAP_MD3 0x00000200 /* Machine dependant */ 99 100 #ifndef PMAP_EXCLUDE_DECLS /* Used in Sparc port to virtualize pmap mod */ 101 #ifdef _KERNEL 102 __BEGIN_DECLS 103 #ifndef pmap_activate 104 void pmap_activate(struct proc *); 105 #endif 106 #ifndef pmap_deactivate 107 void pmap_deactivate(struct proc *); 108 #endif 109 #ifndef pmap_unwire 110 void pmap_unwire(pmap_t, vaddr_t); 111 #endif 112 113 #if !defined(pmap_clear_modify) 114 boolean_t pmap_clear_modify(struct vm_page *); 115 #endif 116 #if !defined(pmap_clear_reference) 117 boolean_t pmap_clear_reference(struct vm_page *); 118 #endif 119 120 #if !defined(pmap_collect) 121 void pmap_collect(pmap_t); 122 #endif 123 #if !defined(pmap_copy) 124 void pmap_copy(pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t); 125 #endif 126 #if !defined(pmap_copy_page) 127 void pmap_copy_page(struct vm_page *, struct vm_page *); 128 #endif 129 struct pmap *pmap_create(void); 130 void pmap_destroy(pmap_t); 131 int pmap_enter(pmap_t, 132 vaddr_t, paddr_t, vm_prot_t, int); 133 boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *); 134 #if defined(PMAP_GROWKERNEL) 135 vaddr_t pmap_growkernel(vaddr_t); 136 #endif 137 138 void pmap_init(void); 139 140 void pmap_kenter_pa(vaddr_t, paddr_t, vm_prot_t); 141 void pmap_kremove(vaddr_t, vsize_t); 142 #if !defined(pmap_is_modified) 143 boolean_t pmap_is_modified(struct vm_page *); 144 #endif 145 #if !defined(pmap_is_referenced) 146 boolean_t pmap_is_referenced(struct vm_page *); 147 #endif 148 149 void pmap_page_protect(struct vm_page *, vm_prot_t); 150 151 #if !defined(pmap_proc_iflush) 152 void pmap_proc_iflush(struct proc *, vaddr_t, vsize_t); 153 #endif 154 void pmap_protect(pmap_t, vaddr_t, vaddr_t, vm_prot_t); 155 #if !defined(pmap_reference) 156 void pmap_reference(pmap_t); 157 #endif 158 #if !defined(pmap_remove) 159 void pmap_remove(pmap_t, vaddr_t, vaddr_t); 160 #endif 161 #if !defined(pmap_remove_holes) 162 void pmap_remove_holes(struct vmspace *); 163 #endif 164 #if !defined(pmap_update) 165 void pmap_update(pmap_t); 166 #endif 167 #if !defined(pmap_zero_page) 168 void pmap_zero_page(struct vm_page *); 169 #endif 170 171 void pmap_virtual_space(vaddr_t *, vaddr_t *); 172 #if defined(PMAP_STEAL_MEMORY) 173 vaddr_t pmap_steal_memory(vsize_t, vaddr_t *, vaddr_t *); 174 #endif 175 176 #if defined(PMAP_FORK) 177 void pmap_fork(pmap_t, pmap_t); 178 #endif 179 __END_DECLS 180 #endif /* kernel*/ 181 #endif /* PMAP_EXCLUDE_DECLS */ 182 183 #endif /* _PMAP_VM_ */ 184