pmap.h revision 117045
1118611Snjl/*
2118611Snjl * Copyright (c) 1991, 1993
3118611Snjl *	The Regents of the University of California.  All rights reserved.
4118611Snjl *
5118611Snjl * This code is derived from software contributed to Berkeley by
6118611Snjl * The Mach Operating System project at Carnegie-Mellon University.
7217365Sjkim *
8281075Sdim * Redistribution and use in source and binary forms, with or without
9118611Snjl * modification, are permitted provided that the following conditions
10118611Snjl * are met:
11217365Sjkim * 1. Redistributions of source code must retain the above copyright
12217365Sjkim *    notice, this list of conditions and the following disclaimer.
13217365Sjkim * 2. Redistributions in binary form must reproduce the above copyright
14217365Sjkim *    notice, this list of conditions and the following disclaimer in the
15217365Sjkim *    documentation and/or other materials provided with the distribution.
16217365Sjkim * 3. All advertising materials mentioning features or use of this software
17217365Sjkim *    must display the following acknowledgement:
18217365Sjkim *	This product includes software developed by the University of
19217365Sjkim *	California, Berkeley and its contributors.
20217365Sjkim * 4. Neither the name of the University nor the names of its contributors
21217365Sjkim *    may be used to endorse or promote products derived from this software
22217365Sjkim *    without specific prior written permission.
23217365Sjkim *
24217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25118611Snjl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26217365Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27217365Sjkim * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28217365Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29118611Snjl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32217365Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33217365Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34217365Sjkim * SUCH DAMAGE.
35217365Sjkim *
36217365Sjkim *	from: @(#)pmap.h	8.1 (Berkeley) 6/11/93
37217365Sjkim *
38217365Sjkim *
39217365Sjkim * Copyright (c) 1987, 1990 Carnegie-Mellon University.
40217365Sjkim * All rights reserved.
41217365Sjkim *
42217365Sjkim * Author: Avadis Tevanian, Jr.
43118611Snjl *
44151937Sjkim * Permission to use, copy, modify and distribute this software and
45118611Snjl * its documentation is hereby granted, provided that both the copyright
46209746Sjkim * notice and this permission notice appear in all copies of the
47193529Sjkim * software, derivative works or modified versions, and any portions
48193529Sjkim * thereof, and that both notices appear in supporting documentation.
49213806Sjkim *
50118611Snjl * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
51118611Snjl * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
52118611Snjl * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
53118611Snjl *
54228110Sjkim * Carnegie Mellon requests users of this software to return to
55151937Sjkim *
56118611Snjl *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
57151937Sjkim *  School of Computer Science
58151937Sjkim *  Carnegie Mellon University
59151937Sjkim *  Pittsburgh PA 15213-3890
60151937Sjkim *
61118611Snjl * any improvements or extensions that they make and grant Carnegie the
62151937Sjkim * rights to redistribute these changes.
63151937Sjkim *
64151937Sjkim * $FreeBSD: head/sys/vm/pmap.h 117045 2003-06-29 21:20:04Z alc $
65151937Sjkim */
66151937Sjkim
67151937Sjkim/*
68118611Snjl *	Machine address mapping definitions -- machine-independent
69118611Snjl *	section.  [For machine-dependent section, see "machine/pmap.h".]
70209746Sjkim */
71209746Sjkim
72209746Sjkim#ifndef	_PMAP_VM_
73209746Sjkim#define	_PMAP_VM_
74209746Sjkim/*
75209746Sjkim * Each machine dependent implementation is expected to
76209746Sjkim * keep certain statistics.  They may do this anyway they
77209746Sjkim * so choose, but are expected to return the statistics
78209746Sjkim * in the following structure.
79209746Sjkim */
80209746Sjkimstruct pmap_statistics {
81209746Sjkim	long resident_count;	/* # of pages mapped (total) */
82209746Sjkim	long wired_count;	/* # of pages wired */
83209746Sjkim};
84284460Sjkimtypedef struct pmap_statistics *pmap_statistics_t;
85239340Sjkim
86209746Sjkim#include <machine/pmap.h>
87209746Sjkim
88239340Sjkim#ifdef _KERNEL
89239340Sjkimstruct proc;
90239340Sjkimstruct thread;
91209746Sjkim
92284460Sjkim/*
93209746Sjkim * Updates to kernel_vm_end are synchronized by the kernel_map's system mutex.
94284460Sjkim */
95284460Sjkimextern vm_offset_t kernel_vm_end;
96284460Sjkim
97209746Sjkimextern	int	 pmap_pagedaemon_waken;
98284460Sjkim
99284460Sjkimvoid		 pmap_change_wiring(pmap_t, vm_offset_t, boolean_t);
100209746Sjkimvoid		 pmap_clear_modify(vm_page_t m);
101209746Sjkimvoid		 pmap_clear_reference(vm_page_t m);
102209746Sjkimvoid		 pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t);
103209746Sjkimvoid		 pmap_copy_page(vm_page_t, vm_page_t);
104209746Sjkimvoid		 pmap_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t,
105209746Sjkim		    boolean_t);
106237412Sjkimvm_page_t	 pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m,
107118611Snjl		    vm_page_t mpte);
108118611Snjlvm_paddr_t	 pmap_extract(pmap_t pmap, vm_offset_t va);
109118611Snjlvoid		 pmap_growkernel(vm_offset_t);
110118611Snjlvoid		 pmap_init(vm_paddr_t, vm_paddr_t);
111118611Snjlboolean_t	 pmap_is_modified(vm_page_t m);
112118611Snjlboolean_t	 pmap_ts_referenced(vm_page_t m);
113118611Snjlvm_offset_t	 pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
114118611Snjlvoid		 pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
115118611Snjl		    vm_object_t object, vm_pindex_t pindex, vm_size_t size,
116118611Snjl		    int pagelimit);
117118611Snjlboolean_t	 pmap_page_exists_quick(pmap_t pmap, vm_page_t m);
118118611Snjlvoid		 pmap_page_protect(vm_page_t m, vm_prot_t prot);
119118611Snjlvoid		 pmap_pinit(pmap_t);
120167802Sjkimvoid		 pmap_pinit0(pmap_t);
121118611Snjlvoid		 pmap_pinit2(pmap_t);
122151937Sjkimvoid		 pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t);
123118611Snjlvoid		 pmap_qenter(vm_offset_t, vm_page_t *, int);
124118611Snjlvoid		 pmap_qremove(vm_offset_t, int);
125118611Snjlvoid		 pmap_release(pmap_t);
126118611Snjlvoid		 pmap_remove(pmap_t, vm_offset_t, vm_offset_t);
127118611Snjlvoid		 pmap_remove_all(vm_page_t m);
128118611Snjlvoid		 pmap_remove_pages(pmap_t, vm_offset_t, vm_offset_t);
129118611Snjlvoid		 pmap_zero_page(vm_page_t);
130118611Snjlvoid		 pmap_zero_page_area(vm_page_t, int off, int size);
131118611Snjlvoid		 pmap_zero_page_idle(vm_page_t);
132118611Snjlvoid		 pmap_prefault(pmap_t, vm_offset_t, vm_map_entry_t);
133118611Snjlint		 pmap_mincore(pmap_t pmap, vm_offset_t addr);
134118611Snjlvoid		 pmap_activate(struct thread *td);
135118611Snjlvm_offset_t	 pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size);
136118611Snjlvoid		*pmap_kenter_temporary(vm_offset_t pa, int i);
137118611Snjlvoid		 pmap_init2(void);
138118611Snjl#endif /* _KERNEL */
139237412Sjkim#endif /* _PMAP_VM_ */
140118611Snjl