1279377Simp/*- 2279377Simp * Copyright (c) 1991, 1993 3279377Simp * The Regents of the University of California. All rights reserved. 4279377Simp * 5279377Simp * This code is derived from software contributed to Berkeley by 6279377Simp * The Mach Operating System project at Carnegie-Mellon University. 7279377Simp * 8279377Simp * Redistribution and use in source and binary forms, with or without 9279377Simp * modification, are permitted provided that the following conditions 10279377Simp * are met: 11279377Simp * 1. Redistributions of source code must retain the above copyright 12279377Simp * notice, this list of conditions and the following disclaimer. 13279377Simp * 2. Redistributions in binary form must reproduce the above copyright 14279377Simp * notice, this list of conditions and the following disclaimer in the 15279377Simp * documentation and/or other materials provided with the distribution. 16279377Simp * 4. Neither the name of the University nor the names of its contributors 17279377Simp * may be used to endorse or promote products derived from this software 18279377Simp * without specific prior written permission. 19279377Simp * 20279377Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21279377Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22279377Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23279377Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24279377Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25279377Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26279377Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27279377Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28279377Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29279377Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30279377Simp * SUCH DAMAGE. 31279377Simp * 32279377Simp * from: @(#)pmap.h 8.1 (Berkeley) 6/11/93 33279377Simp * 34279377Simp * 35279377Simp * Copyright (c) 1987, 1990 Carnegie-Mellon University. 36279377Simp * All rights reserved. 37279377Simp * 38279377Simp * Author: Avadis Tevanian, Jr. 39279377Simp * 40279377Simp * Permission to use, copy, modify and distribute this software and 41279377Simp * its documentation is hereby granted, provided that both the copyright 42279377Simp * notice and this permission notice appear in all copies of the 43279377Simp * software, derivative works or modified versions, and any portions 44279377Simp * thereof, and that both notices appear in supporting documentation. 45279377Simp * 46279377Simp * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 47279377Simp * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 48279377Simp * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 49279377Simp * 50279377Simp * Carnegie Mellon requests users of this software to return to 51279377Simp * 52279377Simp * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 53279377Simp * School of Computer Science 54279377Simp * Carnegie Mellon University 55279377Simp * Pittsburgh PA 15213-3890 56279377Simp * 57279377Simp * any improvements or extensions that they make and grant Carnegie the 58279377Simp * rights to redistribute these changes. 59279377Simp * 60279377Simp * $FreeBSD$ 61279377Simp */ 62279377Simp 63279377Simp/* 64279377Simp * Machine address mapping definitions -- machine-independent 65279377Simp * section. [For machine-dependent section, see "machine/pmap.h".] 66279377Simp */ 67279377Simp 68279377Simp#ifndef _PMAP_VM_ 69279377Simp#define _PMAP_VM_ 70279377Simp/* 71279377Simp * Each machine dependent implementation is expected to 72279377Simp * keep certain statistics. They may do this anyway they 73279377Simp * so choose, but are expected to return the statistics 74279377Simp * in the following structure. 75279377Simp */ 76279377Simpstruct pmap_statistics { 77279377Simp long resident_count; /* # of pages mapped (total) */ 78279377Simp long wired_count; /* # of pages wired */ 79279377Simp}; 80279377Simptypedef struct pmap_statistics *pmap_statistics_t; 81279377Simp 82279377Simp/* 83279377Simp * Each machine-dependent implementation is required to provide: 84279377Simp * 85279377Simp * vm_memattr_t pmap_page_get_memattr(vm_page_t); 86279377Simp * boolean_t pmap_page_is_mapped(vm_page_t); 87279377Simp * boolean_t pmap_page_is_write_mapped(vm_page_t); 88279377Simp * void pmap_page_set_memattr(vm_page_t, vm_memattr_t); 89279377Simp */ 90279377Simp#include <machine/pmap.h> 91279377Simp 92279377Simp#ifdef _KERNEL 93279377Simpstruct thread; 94279377Simp 95279377Simp/* 96279377Simp * Updates to kernel_vm_end are synchronized by the kernel_map's system mutex. 97279377Simp */ 98279377Simpextern vm_offset_t kernel_vm_end; 99279377Simp 100279377Simpvoid pmap_activate(struct thread *td); 101279377Simpvoid pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, 102279377Simp int advice); 103279377Simpvoid pmap_align_superpage(vm_object_t, vm_ooffset_t, vm_offset_t *, 104279377Simp vm_size_t); 105279377Simpvoid pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); 106279377Simpvoid pmap_clear_modify(vm_page_t m); 107279377Simpvoid pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); 108279377Simpvoid pmap_copy_page(vm_page_t, vm_page_t); 109279377Simpvoid pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, 110279377Simp vm_page_t mb[], vm_offset_t b_offset, int xfersize); 111279377Simpvoid pmap_enter(pmap_t, vm_offset_t, vm_prot_t, vm_page_t, 112279377Simp vm_prot_t, boolean_t); 113279377Simpvoid pmap_enter_object(pmap_t pmap, vm_offset_t start, 114279377Simp vm_offset_t end, vm_page_t m_start, vm_prot_t prot); 115279377Simpvoid pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, 116279377Simp vm_prot_t prot); 117279377Simpvm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va); 118279377Simpvm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, 119279377Simp vm_prot_t prot); 120279377Simpvoid pmap_growkernel(vm_offset_t); 121279377Simpvoid pmap_init(void); 122279377Simpboolean_t pmap_is_modified(vm_page_t m); 123279377Simpboolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); 124279377Simpboolean_t pmap_is_referenced(vm_page_t m); 125279377Simpvm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); 126279377Simpint pmap_mincore(pmap_t pmap, vm_offset_t addr, 127279377Simp vm_paddr_t *locked_pa); 128279377Simpvoid pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, 129279377Simp vm_object_t object, vm_pindex_t pindex, vm_size_t size); 130279377Simpboolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); 131279377Simpvoid pmap_page_init(vm_page_t m); 132279377Simpint pmap_page_wired_mappings(vm_page_t m); 133279377Simpint pmap_pinit(pmap_t); 134279377Simpvoid pmap_pinit0(pmap_t); 135279377Simpvoid pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); 136279377Simpvoid pmap_qenter(vm_offset_t, vm_page_t *, int); 137279377Simpvoid pmap_qremove(vm_offset_t, int); 138279377Simpvoid pmap_release(pmap_t); 139279377Simpvoid pmap_remove(pmap_t, vm_offset_t, vm_offset_t); 140279377Simpvoid pmap_remove_all(vm_page_t m); 141279377Simpvoid pmap_remove_pages(pmap_t); 142279377Simpvoid pmap_remove_write(vm_page_t m); 143279377Simpvoid pmap_sync_icache(pmap_t, vm_offset_t, vm_size_t); 144279377Simpboolean_t pmap_ts_referenced(vm_page_t m); 145279377Simpvoid pmap_zero_page(vm_page_t); 146279377Simpvoid pmap_zero_page_area(vm_page_t, int off, int size); 147279377Simpvoid pmap_zero_page_idle(vm_page_t); 148279377Simp 149279377Simp#define pmap_resident_count(pm) ((pm)->pm_stats.resident_count) 150279377Simp#define pmap_wired_count(pm) ((pm)->pm_stats.wired_count) 151279377Simp 152279377Simp#endif /* _KERNEL */ 153279377Simp#endif /* _PMAP_VM_ */ 154279377Simp