pmap.h revision 208504
1183267Sjkoshy/*- 2174397Sjkoshy * Copyright (c) 1991, 1993 3145256Sjkoshy * The Regents of the University of California. All rights reserved. 4145256Sjkoshy * 5174397Sjkoshy * This code is derived from software contributed to Berkeley by 6174397Sjkoshy * The Mach Operating System project at Carnegie-Mellon University. 7174397Sjkoshy * 8145256Sjkoshy * Redistribution and use in source and binary forms, with or without 9145256Sjkoshy * modification, are permitted provided that the following conditions 10145256Sjkoshy * are met: 11145256Sjkoshy * 1. Redistributions of source code must retain the above copyright 12145256Sjkoshy * notice, this list of conditions and the following disclaimer. 13145256Sjkoshy * 2. Redistributions in binary form must reproduce the above copyright 14145256Sjkoshy * notice, this list of conditions and the following disclaimer in the 15145256Sjkoshy * documentation and/or other materials provided with the distribution. 16145256Sjkoshy * 4. Neither the name of the University nor the names of its contributors 17145256Sjkoshy * may be used to endorse or promote products derived from this software 18145256Sjkoshy * without specific prior written permission. 19145256Sjkoshy * 20145256Sjkoshy * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21145256Sjkoshy * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22145256Sjkoshy * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23145256Sjkoshy * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24145256Sjkoshy * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25145256Sjkoshy * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26145256Sjkoshy * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27145256Sjkoshy * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28145256Sjkoshy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29145256Sjkoshy * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30145256Sjkoshy * SUCH DAMAGE. 31242496Sjimharris * 32145256Sjkoshy * from: @(#)pmap.h 8.1 (Berkeley) 6/11/93 33145256Sjkoshy * 34145256Sjkoshy * 35145256Sjkoshy * Copyright (c) 1987, 1990 Carnegie-Mellon University. 36147679Sjkoshy * All rights reserved. 37145256Sjkoshy * 38147679Sjkoshy * Author: Avadis Tevanian, Jr. 39147679Sjkoshy * 40150684Sjkoshy * Permission to use, copy, modify and distribute this software and 41150684Sjkoshy * its documentation is hereby granted, provided that both the copyright 42152569Sru * notice and this permission notice appear in all copies of the 43145256Sjkoshy * software, derivative works or modified versions, and any portions 44145256Sjkoshy * thereof, and that both notices appear in supporting documentation. 45145256Sjkoshy * 46145256Sjkoshy * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 47145256Sjkoshy * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 48145256Sjkoshy * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 49145256Sjkoshy * 50145256Sjkoshy * Carnegie Mellon requests users of this software to return to 51145256Sjkoshy * 52145256Sjkoshy * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 53147679Sjkoshy * School of Computer Science 54145256Sjkoshy * Carnegie Mellon University 55145256Sjkoshy * Pittsburgh PA 15213-3890 56147679Sjkoshy * 57173875Sjkoshy * any improvements or extensions that they make and grant Carnegie the 58145256Sjkoshy * rights to redistribute these changes. 59145256Sjkoshy * 60145256Sjkoshy * $FreeBSD: head/sys/vm/pmap.h 208504 2010-05-24 14:26:57Z alc $ 61145256Sjkoshy */ 62145256Sjkoshy 63173875Sjkoshy/* 64173875Sjkoshy * Machine address mapping definitions -- machine-independent 65173875Sjkoshy * section. [For machine-dependent section, see "machine/pmap.h".] 66173875Sjkoshy */ 67145256Sjkoshy 68173875Sjkoshy#ifndef _PMAP_VM_ 69173875Sjkoshy#define _PMAP_VM_ 70145256Sjkoshy/* 71145256Sjkoshy * Each machine dependent implementation is expected to 72145256Sjkoshy * keep certain statistics. They may do this anyway they 73173875Sjkoshy * so choose, but are expected to return the statistics 74147679Sjkoshy * in the following structure. 75148221Sjkoshy */ 76145256Sjkoshystruct pmap_statistics { 77145256Sjkoshy long resident_count; /* # of pages mapped (total) */ 78147679Sjkoshy long wired_count; /* # of pages wired */ 79157907Sjkoshy}; 80157907Sjkoshytypedef struct pmap_statistics *pmap_statistics_t; 81145256Sjkoshy 82157907Sjkoshy/* 83174397Sjkoshy * Each machine dependent implementation is expected to provide: 84211397Sjoel * 85174397Sjkoshy * vm_memattr_t pmap_page_get_memattr(vm_page_t); 86174397Sjkoshy * boolean_t pmap_page_is_mapped(vm_page_t); 87174397Sjkoshy * void pmap_page_set_memattr(vm_page_t, vm_memattr_t); 88145256Sjkoshy */ 89145256Sjkoshy#include <machine/pmap.h> 90173875Sjkoshy 91173875Sjkoshy#ifdef _KERNEL 92145256Sjkoshystruct thread; 93173875Sjkoshy 94145256Sjkoshy/* 95145256Sjkoshy * Updates to kernel_vm_end are synchronized by the kernel_map's system mutex. 96145256Sjkoshy */ 97145256Sjkoshyextern vm_offset_t kernel_vm_end; 98147679Sjkoshy 99145256Sjkoshyvoid pmap_align_superpage(vm_object_t, vm_ooffset_t, vm_offset_t *, 100145256Sjkoshy vm_size_t); 101147679Sjkoshy#if defined(__mips__) 102145256Sjkoshyvoid pmap_align_tlb(vm_offset_t *); 103173875Sjkoshy#endif 104145256Sjkoshyvoid pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); 105145256Sjkoshyvoid pmap_clear_modify(vm_page_t m); 106145256Sjkoshyvoid pmap_clear_reference(vm_page_t m); 107145256Sjkoshyvoid pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); 108145256Sjkoshyvoid pmap_copy_page(vm_page_t, vm_page_t); 109147679Sjkoshyvoid pmap_enter(pmap_t, vm_offset_t, vm_prot_t, vm_page_t, 110145256Sjkoshy vm_prot_t, boolean_t); 111145256Sjkoshyvoid pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, 112147679Sjkoshy vm_prot_t prot); 113145256Sjkoshyvoid pmap_enter_object(pmap_t pmap, vm_offset_t start, 114173875Sjkoshy vm_offset_t end, vm_page_t m_start, vm_prot_t prot); 115145256Sjkoshyvm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va); 116145256Sjkoshyvm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, 117145256Sjkoshy vm_prot_t prot); 118147679Sjkoshyvoid pmap_growkernel(vm_offset_t); 119145256Sjkoshyvoid pmap_init(void); 120145256Sjkoshyboolean_t pmap_is_modified(vm_page_t m); 121145256Sjkoshyboolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); 122147679Sjkoshyboolean_t pmap_is_referenced(vm_page_t m); 123145256Sjkoshyboolean_t pmap_ts_referenced(vm_page_t m); 124173875Sjkoshyvm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); 125145256Sjkoshyint pmap_mincore(pmap_t pmap, vm_offset_t addr, 126145256Sjkoshy vm_paddr_t *locked_pa); 127145256Sjkoshyvoid pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, 128145256Sjkoshy vm_object_t object, vm_pindex_t pindex, vm_size_t size); 129147679Sjkoshyboolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); 130145256Sjkoshyvoid pmap_page_init(vm_page_t m); 131145256Sjkoshyint pmap_page_wired_mappings(vm_page_t m); 132147679Sjkoshyint pmap_pinit(pmap_t); 133145256Sjkoshyvoid pmap_pinit0(pmap_t); 134145256Sjkoshyvoid pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); 135145256Sjkoshyvoid pmap_qenter(vm_offset_t, vm_page_t *, int); 136145256Sjkoshyvoid pmap_qremove(vm_offset_t, int); 137145256Sjkoshyvoid pmap_release(pmap_t); 138145256Sjkoshyvoid pmap_remove(pmap_t, vm_offset_t, vm_offset_t); 139157907Sjkoshyvoid pmap_remove_all(vm_page_t m); 140145256Sjkoshyvoid pmap_remove_pages(pmap_t); 141145256Sjkoshyvoid pmap_remove_write(vm_page_t m); 142145256Sjkoshyvoid pmap_sync_icache(pmap_t, vm_offset_t, vm_size_t); 143166657Sjkoshyvoid pmap_zero_page(vm_page_t); 144145256Sjkoshyvoid pmap_zero_page_area(vm_page_t, int off, int size); 145145256Sjkoshyvoid pmap_zero_page_idle(vm_page_t); 146147679Sjkoshyvoid pmap_activate(struct thread *td); 147145256Sjkoshy 148147679Sjkoshy#define pmap_resident_count(pm) ((pm)->pm_stats.resident_count) 149145256Sjkoshy#define pmap_wired_count(pm) ((pm)->pm_stats.wired_count) 150145256Sjkoshy 151145256Sjkoshy#endif /* _KERNEL */ 152145256Sjkoshy#endif /* _PMAP_VM_ */ 153145256Sjkoshy