1df8bae1dSRodney W. Grimes /* 2df8bae1dSRodney W. Grimes * Copyright (c) 1991, 1993 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * 5df8bae1dSRodney W. Grimes * This code is derived from software contributed to Berkeley by 6df8bae1dSRodney W. Grimes * The Mach Operating System project at Carnegie-Mellon University. 7df8bae1dSRodney W. Grimes * 8df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 9df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 10df8bae1dSRodney W. Grimes * are met: 11df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 12df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 13df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 14df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 15df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 16df8bae1dSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 17df8bae1dSRodney W. Grimes * must display the following acknowledgement: 18df8bae1dSRodney W. Grimes * This product includes software developed by the University of 19df8bae1dSRodney W. Grimes * California, Berkeley and its contributors. 20df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 21df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 22df8bae1dSRodney W. Grimes * without specific prior written permission. 23df8bae1dSRodney W. Grimes * 24df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34df8bae1dSRodney W. Grimes * SUCH DAMAGE. 35df8bae1dSRodney W. Grimes * 363c4dd356SDavid Greenman * from: @(#)pmap.h 8.1 (Berkeley) 6/11/93 37df8bae1dSRodney W. Grimes * 38df8bae1dSRodney W. Grimes * 39df8bae1dSRodney W. Grimes * Copyright (c) 1987, 1990 Carnegie-Mellon University. 40df8bae1dSRodney W. Grimes * All rights reserved. 41df8bae1dSRodney W. Grimes * 42df8bae1dSRodney W. Grimes * Author: Avadis Tevanian, Jr. 43df8bae1dSRodney W. Grimes * 44df8bae1dSRodney W. Grimes * Permission to use, copy, modify and distribute this software and 45df8bae1dSRodney W. Grimes * its documentation is hereby granted, provided that both the copyright 46df8bae1dSRodney W. Grimes * notice and this permission notice appear in all copies of the 47df8bae1dSRodney W. Grimes * software, derivative works or modified versions, and any portions 48df8bae1dSRodney W. Grimes * thereof, and that both notices appear in supporting documentation. 49df8bae1dSRodney W. Grimes * 50df8bae1dSRodney W. Grimes * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 51df8bae1dSRodney W. Grimes * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 52df8bae1dSRodney W. Grimes * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 53df8bae1dSRodney W. Grimes * 54df8bae1dSRodney W. Grimes * Carnegie Mellon requests users of this software to return to 55df8bae1dSRodney W. Grimes * 56df8bae1dSRodney W. Grimes * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 57df8bae1dSRodney W. Grimes * School of Computer Science 58df8bae1dSRodney W. Grimes * Carnegie Mellon University 59df8bae1dSRodney W. Grimes * Pittsburgh PA 15213-3890 60df8bae1dSRodney W. Grimes * 61df8bae1dSRodney W. Grimes * any improvements or extensions that they make and grant Carnegie the 62df8bae1dSRodney W. Grimes * rights to redistribute these changes. 633c4dd356SDavid Greenman * 64c3aac50fSPeter Wemm * $FreeBSD$ 65df8bae1dSRodney W. Grimes */ 66df8bae1dSRodney W. Grimes 67df8bae1dSRodney W. Grimes /* 68df8bae1dSRodney W. Grimes * Machine address mapping definitions -- machine-independent 69df8bae1dSRodney W. Grimes * section. [For machine-dependent section, see "machine/pmap.h".] 70df8bae1dSRodney W. Grimes */ 71df8bae1dSRodney W. Grimes 72df8bae1dSRodney W. Grimes #ifndef _PMAP_VM_ 73df8bae1dSRodney W. Grimes #define _PMAP_VM_ 74df8bae1dSRodney W. Grimes /* 75df8bae1dSRodney W. Grimes * Each machine dependent implementation is expected to 76df8bae1dSRodney W. Grimes * keep certain statistics. They may do this anyway they 77df8bae1dSRodney W. Grimes * so choose, but are expected to return the statistics 78df8bae1dSRodney W. Grimes * in the following structure. 79df8bae1dSRodney W. Grimes */ 80df8bae1dSRodney W. Grimes struct pmap_statistics { 81df8bae1dSRodney W. Grimes long resident_count; /* # of pages mapped (total) */ 82df8bae1dSRodney W. Grimes long wired_count; /* # of pages wired */ 83df8bae1dSRodney W. Grimes }; 84df8bae1dSRodney W. Grimes typedef struct pmap_statistics *pmap_statistics_t; 85df8bae1dSRodney W. Grimes 86df8bae1dSRodney W. Grimes #include <machine/pmap.h> 87df8bae1dSRodney W. Grimes 88c4473420SPeter Wemm #ifdef _KERNEL 898bcc577eSBruce Evans struct proc; 90b40ce416SJulian Elischer struct thread; 918bcc577eSBruce Evans 9253b19636SAlan Cox /* 9353b19636SAlan Cox * Updates to kernel_vm_end are synchronized by the kernel_map's system mutex. 9453b19636SAlan Cox */ 9553b19636SAlan Cox extern vm_offset_t kernel_vm_end; 9653b19636SAlan Cox 97eea85e9bSAlan Cox extern int pmap_pagedaemon_waken; 98eea85e9bSAlan Cox 9911caded3SAlfred Perlstein void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); 10011caded3SAlfred Perlstein void pmap_clear_modify(vm_page_t m); 10111caded3SAlfred Perlstein void pmap_clear_reference(vm_page_t m); 10211caded3SAlfred Perlstein void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); 1031a87a0daSPeter Wemm void pmap_copy_page(vm_page_t, vm_page_t); 10411caded3SAlfred Perlstein void pmap_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, 10511caded3SAlfred Perlstein boolean_t); 106dca96f1aSAlan Cox vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, 107dca96f1aSAlan Cox vm_page_t mpte); 108227f9a1cSJake Burkholder vm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va); 109b9850eb2SAlan Cox vm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, 110b9850eb2SAlan Cox vm_prot_t prot); 11111caded3SAlfred Perlstein void pmap_growkernel(vm_offset_t); 112227f9a1cSJake Burkholder void pmap_init(vm_paddr_t, vm_paddr_t); 11311caded3SAlfred Perlstein boolean_t pmap_is_modified(vm_page_t m); 114566526a9SAlan Cox boolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); 11511caded3SAlfred Perlstein boolean_t pmap_ts_referenced(vm_page_t m); 116227f9a1cSJake Burkholder vm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); 11711caded3SAlfred Perlstein void pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, 1181f78f902SAlan Cox vm_object_t object, vm_pindex_t pindex, vm_size_t size); 11911caded3SAlfred Perlstein boolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); 12011caded3SAlfred Perlstein void pmap_page_protect(vm_page_t m, vm_prot_t prot); 12111caded3SAlfred Perlstein void pmap_pinit(pmap_t); 12211caded3SAlfred Perlstein void pmap_pinit0(pmap_t); 12311caded3SAlfred Perlstein void pmap_pinit2(pmap_t); 12411caded3SAlfred Perlstein void pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); 12511caded3SAlfred Perlstein void pmap_qenter(vm_offset_t, vm_page_t *, int); 12611caded3SAlfred Perlstein void pmap_qremove(vm_offset_t, int); 12711caded3SAlfred Perlstein void pmap_release(pmap_t); 12811caded3SAlfred Perlstein void pmap_remove(pmap_t, vm_offset_t, vm_offset_t); 1296372d61eSAlan Cox void pmap_remove_all(vm_page_t m); 13011caded3SAlfred Perlstein void pmap_remove_pages(pmap_t, vm_offset_t, vm_offset_t); 1311a87a0daSPeter Wemm void pmap_zero_page(vm_page_t); 1321a87a0daSPeter Wemm void pmap_zero_page_area(vm_page_t, int off, int size); 133a58b3a68SPeter Wemm void pmap_zero_page_idle(vm_page_t); 13411caded3SAlfred Perlstein int pmap_mincore(pmap_t pmap, vm_offset_t addr); 13511caded3SAlfred Perlstein void pmap_activate(struct thread *td); 13611caded3SAlfred Perlstein vm_offset_t pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size); 13711caded3SAlfred Perlstein void *pmap_kenter_temporary(vm_offset_t pa, int i); 13811caded3SAlfred Perlstein void pmap_init2(void); 1392bc7dd56SBruce M Simpson 1402bc7dd56SBruce M Simpson #define pmap_resident_count(pm) ((pm)->pm_stats.resident_count) 1412bc7dd56SBruce M Simpson #define pmap_wired_count(pm) ((pm)->pm_stats.wired_count) 1422bc7dd56SBruce M Simpson 143c4473420SPeter Wemm #endif /* _KERNEL */ 144df8bae1dSRodney W. Grimes #endif /* _PMAP_VM_ */ 145