vm.h revision 139825
1139825Simp/*- 21541Srgrimes * Copyright (c) 1991, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 4. Neither the name of the University nor the names of its contributors 141541Srgrimes * may be used to endorse or promote products derived from this software 151541Srgrimes * without specific prior written permission. 161541Srgrimes * 171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 201541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 271541Srgrimes * SUCH DAMAGE. 281541Srgrimes * 291541Srgrimes * @(#)vm.h 8.2 (Berkeley) 12/13/93 3052635Sphk * @(#)vm_prot.h 8.1 (Berkeley) 6/11/93 3152635Sphk * @(#)vm_inherit.h 8.1 (Berkeley) 6/11/93 3252635Sphk * 3352635Sphk * Copyright (c) 1987, 1990 Carnegie-Mellon University. 3452635Sphk * All rights reserved. 3552635Sphk * 3652635Sphk * Authors: Avadis Tevanian, Jr., Michael Wayne Young 3752635Sphk * 3852635Sphk * Permission to use, copy, modify and distribute this software and 3952635Sphk * its documentation is hereby granted, provided that both the copyright 4052635Sphk * notice and this permission notice appear in all copies of the 4152635Sphk * software, derivative works or modified versions, and any portions 4252635Sphk * thereof, and that both notices appear in supporting documentation. 4352635Sphk * 4452635Sphk * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 4552635Sphk * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 4652635Sphk * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 4752635Sphk * 4852635Sphk * Carnegie Mellon requests users of this software to return to 4952635Sphk * 5052635Sphk * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 5152635Sphk * School of Computer Science 5252635Sphk * Carnegie Mellon University 5352635Sphk * Pittsburgh PA 15213-3890 5452635Sphk * 5552635Sphk * any improvements or extensions that they make and grant Carnegie the 5652635Sphk * rights to redistribute these changes. 5752635Sphk * 5850477Speter * $FreeBSD: head/sys/vm/vm.h 139825 2005-01-07 02:29:27Z imp $ 591541Srgrimes */ 601541Srgrimes 611541Srgrimes#ifndef VM_H 621541Srgrimes#define VM_H 631541Srgrimes 6452635Sphktypedef char vm_inherit_t; /* inheritance codes */ 6552635Sphk 6652635Sphk#define VM_INHERIT_SHARE ((vm_inherit_t) 0) 6752635Sphk#define VM_INHERIT_COPY ((vm_inherit_t) 1) 6852635Sphk#define VM_INHERIT_NONE ((vm_inherit_t) 2) 6952635Sphk#define VM_INHERIT_DEFAULT VM_INHERIT_COPY 7052635Sphk 7112662Sdgtypedef u_char vm_prot_t; /* protection codes */ 721541Srgrimes 7352635Sphk#define VM_PROT_NONE ((vm_prot_t) 0x00) 7452635Sphk#define VM_PROT_READ ((vm_prot_t) 0x01) 7552635Sphk#define VM_PROT_WRITE ((vm_prot_t) 0x02) 7652635Sphk#define VM_PROT_EXECUTE ((vm_prot_t) 0x04) 7752635Sphk#define VM_PROT_OVERRIDE_WRITE ((vm_prot_t) 0x08) /* copy-on-write */ 7852635Sphk 7952635Sphk#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE) 80107948Sdillon#define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE) 8152635Sphk#define VM_PROT_DEFAULT VM_PROT_ALL 8252635Sphk 831541Srgrimesunion vm_map_object; 841541Srgrimestypedef union vm_map_object vm_map_object_t; 851541Srgrimes 861541Srgrimesstruct vm_map_entry; 871541Srgrimestypedef struct vm_map_entry *vm_map_entry_t; 881541Srgrimes 891541Srgrimesstruct vm_map; 901541Srgrimestypedef struct vm_map *vm_map_t; 911541Srgrimes 921541Srgrimesstruct vm_object; 931541Srgrimestypedef struct vm_object *vm_object_t; 941541Srgrimes 9555206Speter#ifndef _KERNEL 9612642Sbde/* 9712710Sbde * This is defined in <sys/types.h> for the kernel so that non-vm kernel 9812710Sbde * sources (mainly Mach-derived ones such as ddb) don't have to include 9912710Sbde * vm stuff. Defining it there for applications might break things. 10012710Sbde * Define it here for "applications" that include vm headers (e.g., 10112710Sbde * genassym). 10212710Sbde */ 10312710Sbdetypedef int boolean_t; 10412710Sbde 10512710Sbde/* 10612642Sbde * This is defined in <sys/types.h> for the kernel so that vnode_if.h 10712642Sbde * doesn't have to include <vm/vm.h>. 10812642Sbde */ 1091541Srgrimesstruct vm_page; 1105455Sdgtypedef struct vm_page *vm_page_t; 11192029Seivind#endif /* _KERNEL */ 1121541Srgrimes 11382127Sdillon/* 114133807Salc * Virtual memory MPSAFE temporary workarounds. 115133807Salc */ 116133807Salcextern int debug_mpsafevm; /* defined in vm/vm_meter.c */ 117133807Salc#define VM_LOCK_GIANT() do { \ 118133807Salc if (!debug_mpsafevm) \ 119133807Salc mtx_lock(&Giant); \ 120133807Salc} while (0) 121133807Salc#define VM_UNLOCK_GIANT() do { \ 122133807Salc if (!debug_mpsafevm) \ 123133807Salc mtx_unlock(&Giant); \ 124133807Salc} while (0) 125133807Salc 126133807Salc/* 12782127Sdillon * Information passed from the machine-independant VM initialization code 12882127Sdillon * for use by machine-dependant code (mainly for MMU support) 12982127Sdillon */ 13082127Sdillonstruct kva_md_info { 13182127Sdillon vm_offset_t buffer_sva; 13282127Sdillon vm_offset_t buffer_eva; 13382127Sdillon vm_offset_t clean_sva; 13482127Sdillon vm_offset_t clean_eva; 13582127Sdillon vm_offset_t pager_sva; 13682127Sdillon vm_offset_t pager_eva; 13782127Sdillon}; 13882127Sdillon 13982127Sdillonextern struct kva_md_info kmi; 14089802Sdwmaloneextern void vm_ksubmap_init(struct kva_md_info *); 14182127Sdillon 1425455Sdg#endif /* VM_H */ 14382127Sdillon 144