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/* 83237168Salc * 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); 87237168Salc * 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 100270439Skib/* 101270439Skib * Flags for pmap_enter(). The bits in the low-order byte are reserved 102270439Skib * for the protection code (vm_prot_t) that describes the fault type. 103270439Skib */ 104270439Skib#define PMAP_ENTER_NOSLEEP 0x0100 105270439Skib#define PMAP_ENTER_WIRED 0x0200 106270439Skib 107217482Salcvoid pmap_activate(struct thread *td); 108255028Salcvoid pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, 109255028Salc int advice); 110178875Salcvoid pmap_align_superpage(vm_object_t, vm_ooffset_t, vm_offset_t *, 111178875Salc vm_size_t); 11292727Salfredvoid pmap_clear_modify(vm_page_t m); 11392727Salfredvoid pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); 11494777Spetervoid pmap_copy_page(vm_page_t, vm_page_t); 115248280Skibvoid pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, 116248280Skib vm_page_t mb[], vm_offset_t b_offset, int xfersize); 117270439Skibint pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, 118270439Skib vm_prot_t prot, u_int flags, int8_t psind); 119217482Salcvoid pmap_enter_object(pmap_t pmap, vm_offset_t start, 120217482Salc vm_offset_t end, vm_page_t m_start, vm_prot_t prot); 121175041Salcvoid pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, 122159627Sups vm_prot_t prot); 123112569Sjakevm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va); 124119999Salcvm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, 125119999Salc vm_prot_t prot); 12692727Salfredvoid pmap_growkernel(vm_offset_t); 127127869Salcvoid pmap_init(void); 12892727Salfredboolean_t pmap_is_modified(vm_page_t m); 129120722Salcboolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); 130207155Salcboolean_t pmap_is_referenced(vm_page_t m); 131112569Sjakevm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); 132208504Salcint pmap_mincore(pmap_t pmap, vm_offset_t addr, 133208504Salc vm_paddr_t *locked_pa); 13492727Salfredvoid pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, 135117206Salc vm_object_t object, vm_pindex_t pindex, vm_size_t size); 13692727Salfredboolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); 137147217Salcvoid pmap_page_init(vm_page_t m); 138173708Salcint pmap_page_wired_mappings(vm_page_t m); 139173361Skibint pmap_pinit(pmap_t); 14092727Salfredvoid pmap_pinit0(pmap_t); 14192727Salfredvoid pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); 14292727Salfredvoid pmap_qenter(vm_offset_t, vm_page_t *, int); 14392727Salfredvoid pmap_qremove(vm_offset_t, int); 14492727Salfredvoid pmap_release(pmap_t); 14592727Salfredvoid pmap_remove(pmap_t, vm_offset_t, vm_offset_t); 146106753Salcvoid pmap_remove_all(vm_page_t m); 147157443Spetervoid pmap_remove_pages(pmap_t); 148160889Salcvoid pmap_remove_write(vm_page_t m); 149198341Smarcelvoid pmap_sync_icache(pmap_t, vm_offset_t, vm_size_t); 150217482Salcboolean_t pmap_ts_referenced(vm_page_t m); 151270920Skibvoid pmap_unwire(pmap_t pmap, vm_offset_t start, vm_offset_t end); 15294777Spetervoid pmap_zero_page(vm_page_t); 15394777Spetervoid pmap_zero_page_area(vm_page_t, int off, int size); 15499571Spetervoid pmap_zero_page_idle(vm_page_t); 155120831Sbms 156120831Sbms#define pmap_resident_count(pm) ((pm)->pm_stats.resident_count) 157120831Sbms#define pmap_wired_count(pm) ((pm)->pm_stats.wired_count) 158120831Sbms 15955206Speter#endif /* _KERNEL */ 16012905Sbde#endif /* _PMAP_VM_ */ 161