pmap.h revision 157443
195065Strhodes/*- 295065Strhodes * Copyright (c) 1991, 1993 395065Strhodes * The Regents of the University of California. All rights reserved. 495065Strhodes * 595065Strhodes * This code is derived from software contributed to Berkeley by 695065Strhodes * The Mach Operating System project at Carnegie-Mellon University. 795065Strhodes * 895065Strhodes * Redistribution and use in source and binary forms, with or without 995065Strhodes * modification, are permitted provided that the following conditions 1095065Strhodes * are met: 1195065Strhodes * 1. Redistributions of source code must retain the above copyright 1295065Strhodes * notice, this list of conditions and the following disclaimer. 1395065Strhodes * 2. Redistributions in binary form must reproduce the above copyright 1495065Strhodes * notice, this list of conditions and the following disclaimer in the 1595065Strhodes * documentation and/or other materials provided with the distribution. 1695065Strhodes * 4. Neither the name of the University nor the names of its contributors 1795065Strhodes * may be used to endorse or promote products derived from this software 1895065Strhodes * without specific prior written permission. 1995065Strhodes * 2095065Strhodes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2195065Strhodes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2295065Strhodes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2395065Strhodes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2495065Strhodes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2595065Strhodes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2695065Strhodes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2795065Strhodes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2895065Strhodes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2995065Strhodes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3097592Sru * SUCH DAMAGE. 3197592Sru * 32164524Sbrueffer * from: @(#)pmap.h 8.1 (Berkeley) 6/11/93 3395065Strhodes * 3495065Strhodes * 3595065Strhodes * Copyright (c) 1987, 1990 Carnegie-Mellon University. 3695065Strhodes * All rights reserved. 3795065Strhodes * 3895065Strhodes * Author: Avadis Tevanian, Jr. 39164524Sbrueffer * 40164524Sbrueffer * Permission to use, copy, modify and distribute this software and 41164524Sbrueffer * its documentation is hereby granted, provided that both the copyright 42164524Sbrueffer * notice and this permission notice appear in all copies of the 43131034Simp * software, derivative works or modified versions, and any portions 44164524Sbrueffer * thereof, and that both notices appear in supporting documentation. 45164524Sbrueffer * 46164524Sbrueffer * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 47164524Sbrueffer * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 48164524Sbrueffer * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 49164524Sbrueffer * 50164524Sbrueffer * Carnegie Mellon requests users of this software to return to 51164524Sbrueffer * 5295065Strhodes * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 5395065Strhodes * School of Computer Science 5495065Strhodes * Carnegie Mellon University 5595065Strhodes * Pittsburgh PA 15213-3890 5695065Strhodes * 5795065Strhodes * any improvements or extensions that they make and grant Carnegie the 5895065Strhodes * rights to redistribute these changes. 5995065Strhodes * 6095065Strhodes * $FreeBSD: head/sys/vm/pmap.h 157443 2006-04-03 21:16:10Z peter $ 6197592Sru */ 6297592Sru 6395065Strhodes/* 6497592Sru * Machine address mapping definitions -- machine-independent 6597592Sru * section. [For machine-dependent section, see "machine/pmap.h".] 6697592Sru */ 6795065Strhodes 6897592Sru#ifndef _PMAP_VM_ 6997592Sru#define _PMAP_VM_ 7095065Strhodes/* 7195065Strhodes * Each machine dependent implementation is expected to 7295065Strhodes * keep certain statistics. They may do this anyway they 73171107Simp * so choose, but are expected to return the statistics 74171107Simp * in the following structure. 7595065Strhodes */ 7695065Strhodesstruct pmap_statistics { 7797592Sru long resident_count; /* # of pages mapped (total) */ 7895065Strhodes long wired_count; /* # of pages wired */ 7995065Strhodes}; 8097592Srutypedef struct pmap_statistics *pmap_statistics_t; 8197592Sru 8295065Strhodes#include <machine/pmap.h> 8395065Strhodes 8495065Strhodes#ifdef _KERNEL 8597592Srustruct proc; 8697592Srustruct thread; 8795065Strhodes 8897592Sru/* 8995065Strhodes * Updates to kernel_vm_end are synchronized by the kernel_map's system mutex. 9097592Sru */ 9197592Sruextern vm_offset_t kernel_vm_end; 9297592Sru 9397592Sruvoid pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); 9497592Sruvoid pmap_clear_modify(vm_page_t m); 9595065Strhodesvoid pmap_clear_reference(vm_page_t m); 9695065Strhodesvoid pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); 9795065Strhodesvoid pmap_copy_page(vm_page_t, vm_page_t); 9895065Strhodesvoid pmap_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, 9995065Strhodes boolean_t); 10095065Strhodesvm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, 10195065Strhodes vm_prot_t prot, vm_page_t mpte); 102171107Simpvm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va); 103171107Simpvm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, 10495065Strhodes vm_prot_t prot); 10597592Sruvoid pmap_growkernel(vm_offset_t); 10697592Sruvoid pmap_init(void); 10797592Sruboolean_t pmap_is_modified(vm_page_t m); 10897592Sruboolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); 10997592Sruboolean_t pmap_ts_referenced(vm_page_t m); 11097592Sruvm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); 11197592Sruvoid pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, 11295065Strhodes vm_object_t object, vm_pindex_t pindex, vm_size_t size); 11395065Strhodesboolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); 11495065Strhodesvoid pmap_page_init(vm_page_t m); 11595065Strhodesvoid pmap_page_protect(vm_page_t m, vm_prot_t prot); 11695065Strhodesvoid pmap_pinit(pmap_t); 11795065Strhodesvoid pmap_pinit0(pmap_t); 11895065Strhodesvoid pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); 11995065Strhodesvoid pmap_qenter(vm_offset_t, vm_page_t *, int); 12095065Strhodesvoid pmap_qremove(vm_offset_t, int); 12197592Sruvoid pmap_release(pmap_t); 12297592Sruvoid pmap_remove(pmap_t, vm_offset_t, vm_offset_t); 12395065Strhodesvoid pmap_remove_all(vm_page_t m); 12495065Strhodesvoid pmap_remove_pages(pmap_t); 12595065Strhodesvoid pmap_zero_page(vm_page_t); 12695065Strhodesvoid pmap_zero_page_area(vm_page_t, int off, int size); 12797592Sruvoid pmap_zero_page_idle(vm_page_t); 12897592Sruint pmap_mincore(pmap_t pmap, vm_offset_t addr); 12995065Strhodesvoid pmap_activate(struct thread *td); 13095065Strhodesvm_offset_t pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size); 13197592Sru 13295065Strhodes#define pmap_resident_count(pm) ((pm)->pm_stats.resident_count) 13395065Strhodes#define pmap_wired_count(pm) ((pm)->pm_stats.wired_count) 13495065Strhodes 13595065Strhodes#endif /* _KERNEL */ 13695065Strhodes#endif /* _PMAP_VM_ */ 13795065Strhodes