1139825Simp/*- 21541Srgrimes * Copyright (c) 1991, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from software contributed to Berkeley by 61541Srgrimes * The Mach Operating System project at Carnegie-Mellon University. 71541Srgrimes * 81541Srgrimes * Redistribution and use in source and binary forms, with or without 91541Srgrimes * modification, are permitted provided that the following conditions 101541Srgrimes * are met: 111541Srgrimes * 1. Redistributions of source code must retain the above copyright 121541Srgrimes * notice, this list of conditions and the following disclaimer. 131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer in the 151541Srgrimes * documentation and/or other materials provided with the distribution. 161541Srgrimes * 4. Neither the name of the University nor the names of its contributors 171541Srgrimes * may be used to endorse or promote products derived from this software 181541Srgrimes * without specific prior written permission. 191541Srgrimes * 201541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301541Srgrimes * SUCH DAMAGE. 311541Srgrimes * 321817Sdg * from: @(#)pmap.h 8.1 (Berkeley) 6/11/93 331541Srgrimes * 341541Srgrimes * 351541Srgrimes * Copyright (c) 1987, 1990 Carnegie-Mellon University. 361541Srgrimes * All rights reserved. 371541Srgrimes * 381541Srgrimes * Author: Avadis Tevanian, Jr. 395455Sdg * 401541Srgrimes * Permission to use, copy, modify and distribute this software and 411541Srgrimes * its documentation is hereby granted, provided that both the copyright 421541Srgrimes * notice and this permission notice appear in all copies of the 431541Srgrimes * software, derivative works or modified versions, and any portions 441541Srgrimes * thereof, and that both notices appear in supporting documentation. 455455Sdg * 465455Sdg * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 475455Sdg * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 481541Srgrimes * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 495455Sdg * 501541Srgrimes * Carnegie Mellon requests users of this software to return to 511541Srgrimes * 521541Srgrimes * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 531541Srgrimes * School of Computer Science 541541Srgrimes * Carnegie Mellon University 551541Srgrimes * Pittsburgh PA 15213-3890 561541Srgrimes * 571541Srgrimes * any improvements or extensions that they make and grant Carnegie the 581541Srgrimes * rights to redistribute these changes. 591817Sdg * 6050477Speter * $FreeBSD$ 611541Srgrimes */ 621541Srgrimes 631541Srgrimes/* 641541Srgrimes * Machine address mapping definitions -- machine-independent 651541Srgrimes * section. [For machine-dependent section, see "machine/pmap.h".] 661541Srgrimes */ 671541Srgrimes 681541Srgrimes#ifndef _PMAP_VM_ 691541Srgrimes#define _PMAP_VM_ 701541Srgrimes/* 711541Srgrimes * Each machine dependent implementation is expected to 721541Srgrimes * keep certain statistics. They may do this anyway they 731541Srgrimes * so choose, but are expected to return the statistics 741541Srgrimes * in the following structure. 751541Srgrimes */ 761541Srgrimesstruct pmap_statistics { 775455Sdg long resident_count; /* # of pages mapped (total) */ 785455Sdg long wired_count; /* # of pages wired */ 791541Srgrimes}; 805455Sdgtypedef struct pmap_statistics *pmap_statistics_t; 811541Srgrimes 82195649Salc/* 83240760Salc * Each machine-dependent implementation is required to provide: 84195649Salc * 85195649Salc * vm_memattr_t pmap_page_get_memattr(vm_page_t); 86195649Salc * boolean_t pmap_page_is_mapped(vm_page_t); 87240760Salc * boolean_t pmap_page_is_write_mapped(vm_page_t); 88195649Salc * void pmap_page_set_memattr(vm_page_t, vm_memattr_t); 89195649Salc */ 901541Srgrimes#include <machine/pmap.h> 911541Srgrimes 9255206Speter#ifdef _KERNEL 9383366Sjulianstruct thread; 9432995Sbde 95110957Salc/* 96110957Salc * Updates to kernel_vm_end are synchronized by the kernel_map's system mutex. 97110957Salc */ 98110957Salcextern vm_offset_t kernel_vm_end; 99110957Salc 100217482Salcvoid pmap_activate(struct thread *td); 101178875Salcvoid pmap_align_superpage(vm_object_t, vm_ooffset_t, vm_offset_t *, 102178875Salc vm_size_t); 103206819Sjmallett#if defined(__mips__) 104206819Sjmallettvoid pmap_align_tlb(vm_offset_t *); 105206819Sjmallett#endif 10692727Salfredvoid pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); 10792727Salfredvoid pmap_clear_modify(vm_page_t m); 10892727Salfredvoid pmap_clear_reference(vm_page_t m); 10992727Salfredvoid pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); 11094777Spetervoid pmap_copy_page(vm_page_t, vm_page_t); 111248814Skibvoid pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, 112248814Skib vm_page_t mb[], vm_offset_t b_offset, int xfersize); 113175067Salcvoid pmap_enter(pmap_t, vm_offset_t, vm_prot_t, vm_page_t, 114175067Salc vm_prot_t, boolean_t); 115217482Salcvoid pmap_enter_object(pmap_t pmap, vm_offset_t start, 116217482Salc vm_offset_t end, vm_page_t m_start, vm_prot_t prot); 117175041Salcvoid pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, 118159627Sups vm_prot_t prot); 119112569Sjakevm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va); 120119999Salcvm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, 121119999Salc vm_prot_t prot); 12292727Salfredvoid pmap_growkernel(vm_offset_t); 123127869Salcvoid pmap_init(void); 12492727Salfredboolean_t pmap_is_modified(vm_page_t m); 125120722Salcboolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); 126207155Salcboolean_t pmap_is_referenced(vm_page_t m); 127112569Sjakevm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); 128208504Salcint pmap_mincore(pmap_t pmap, vm_offset_t addr, 129208504Salc vm_paddr_t *locked_pa); 13092727Salfredvoid pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, 131117206Salc vm_object_t object, vm_pindex_t pindex, vm_size_t size); 13292727Salfredboolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); 133147217Salcvoid pmap_page_init(vm_page_t m); 134173708Salcint pmap_page_wired_mappings(vm_page_t m); 135173361Skibint pmap_pinit(pmap_t); 13692727Salfredvoid pmap_pinit0(pmap_t); 13792727Salfredvoid pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); 13892727Salfredvoid pmap_qenter(vm_offset_t, vm_page_t *, int); 13992727Salfredvoid pmap_qremove(vm_offset_t, int); 14092727Salfredvoid pmap_release(pmap_t); 14192727Salfredvoid pmap_remove(pmap_t, vm_offset_t, vm_offset_t); 142106753Salcvoid pmap_remove_all(vm_page_t m); 143157443Spetervoid pmap_remove_pages(pmap_t); 144160889Salcvoid pmap_remove_write(vm_page_t m); 145198341Smarcelvoid pmap_sync_icache(pmap_t, vm_offset_t, vm_size_t); 146217482Salcboolean_t pmap_ts_referenced(vm_page_t m); 14794777Spetervoid pmap_zero_page(vm_page_t); 14894777Spetervoid pmap_zero_page_area(vm_page_t, int off, int size); 14999571Spetervoid pmap_zero_page_idle(vm_page_t); 150120831Sbms 151120831Sbms#define pmap_resident_count(pm) ((pm)->pm_stats.resident_count) 152120831Sbms#define pmap_wired_count(pm) ((pm)->pm_stats.wired_count) 153120831Sbms 15455206Speter#endif /* _KERNEL */ 15512905Sbde#endif /* _PMAP_VM_ */ 156