uvm_pmap.h revision 1.10 1 1.10 thorpej /* $NetBSD: uvm_pmap.h,v 1.10 2002/04/10 00:40:45 thorpej Exp $ */
2 1.1 mrg
3 1.7 chs /*
4 1.1 mrg * Copyright (c) 1991, 1993
5 1.1 mrg * The Regents of the University of California. All rights reserved.
6 1.1 mrg *
7 1.1 mrg * This code is derived from software contributed to Berkeley by
8 1.1 mrg * The Mach Operating System project at Carnegie-Mellon University.
9 1.1 mrg *
10 1.1 mrg * Redistribution and use in source and binary forms, with or without
11 1.1 mrg * modification, are permitted provided that the following conditions
12 1.1 mrg * are met:
13 1.1 mrg * 1. Redistributions of source code must retain the above copyright
14 1.1 mrg * notice, this list of conditions and the following disclaimer.
15 1.1 mrg * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 mrg * notice, this list of conditions and the following disclaimer in the
17 1.1 mrg * documentation and/or other materials provided with the distribution.
18 1.1 mrg * 3. All advertising materials mentioning features or use of this software
19 1.1 mrg * must display the following acknowledgement:
20 1.1 mrg * This product includes software developed by the University of
21 1.1 mrg * California, Berkeley and its contributors.
22 1.1 mrg * 4. Neither the name of the University nor the names of its contributors
23 1.1 mrg * may be used to endorse or promote products derived from this software
24 1.1 mrg * without specific prior written permission.
25 1.1 mrg *
26 1.1 mrg * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 1.1 mrg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.1 mrg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.1 mrg * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 1.1 mrg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.1 mrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.1 mrg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.1 mrg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.1 mrg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.1 mrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.1 mrg * SUCH DAMAGE.
37 1.1 mrg *
38 1.1 mrg * @(#)pmap.h 8.1 (Berkeley) 6/11/93
39 1.1 mrg *
40 1.1 mrg *
41 1.1 mrg * Copyright (c) 1987, 1990 Carnegie-Mellon University.
42 1.1 mrg * All rights reserved.
43 1.1 mrg *
44 1.1 mrg * Author: Avadis Tevanian, Jr.
45 1.7 chs *
46 1.1 mrg * Permission to use, copy, modify and distribute this software and
47 1.1 mrg * its documentation is hereby granted, provided that both the copyright
48 1.1 mrg * notice and this permission notice appear in all copies of the
49 1.1 mrg * software, derivative works or modified versions, and any portions
50 1.1 mrg * thereof, and that both notices appear in supporting documentation.
51 1.7 chs *
52 1.7 chs * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
53 1.7 chs * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
54 1.1 mrg * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
55 1.7 chs *
56 1.1 mrg * Carnegie Mellon requests users of this software to return to
57 1.1 mrg *
58 1.1 mrg * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
59 1.1 mrg * School of Computer Science
60 1.1 mrg * Carnegie Mellon University
61 1.1 mrg * Pittsburgh PA 15213-3890
62 1.1 mrg *
63 1.1 mrg * any improvements or extensions that they make and grant Carnegie the
64 1.1 mrg * rights to redistribute these changes.
65 1.1 mrg */
66 1.1 mrg
67 1.1 mrg /*
68 1.1 mrg * Machine address mapping definitions -- machine-independent
69 1.1 mrg * section. [For machine-dependent section, see "machine/pmap.h".]
70 1.1 mrg */
71 1.1 mrg
72 1.1 mrg #ifndef _PMAP_VM_
73 1.1 mrg #define _PMAP_VM_
74 1.1 mrg
75 1.1 mrg struct proc; /* for pmap_activate()/pmap_deactivate() proto */
76 1.1 mrg
77 1.1 mrg /*
78 1.1 mrg * Each machine dependent implementation is expected to
79 1.1 mrg * keep certain statistics. They may do this anyway they
80 1.1 mrg * so choose, but are expected to return the statistics
81 1.1 mrg * in the following structure.
82 1.1 mrg */
83 1.1 mrg struct pmap_statistics {
84 1.1 mrg long resident_count; /* # of pages mapped (total)*/
85 1.1 mrg long wired_count; /* # of pages wired */
86 1.1 mrg };
87 1.1 mrg typedef struct pmap_statistics *pmap_statistics_t;
88 1.1 mrg
89 1.8 matt #ifdef _KERNEL
90 1.1 mrg #include <machine/pmap.h>
91 1.8 matt #endif
92 1.1 mrg
93 1.1 mrg /*
94 1.1 mrg * Flags passed to pmap_enter(). Note the bottom 3 bits are VM_PROT_*
95 1.1 mrg * bits, used to indicate the access type that was made (to seed modified
96 1.1 mrg * and referenced information).
97 1.1 mrg */
98 1.1 mrg #define PMAP_WIRED 0x00000010 /* wired mapping */
99 1.1 mrg #define PMAP_CANFAIL 0x00000020 /* can fail if resource shortage */
100 1.1 mrg
101 1.1 mrg #ifndef PMAP_EXCLUDE_DECLS /* Used in Sparc port to virtualize pmap mod */
102 1.1 mrg #ifdef _KERNEL
103 1.1 mrg __BEGIN_DECLS
104 1.6 thorpej #if !defined(pmap_kernel)
105 1.6 thorpej struct pmap *pmap_kernel __P((void));
106 1.6 thorpej #endif
107 1.6 thorpej
108 1.1 mrg void pmap_activate __P((struct proc *));
109 1.1 mrg void pmap_deactivate __P((struct proc *));
110 1.1 mrg void pmap_unwire __P((pmap_t, vaddr_t));
111 1.1 mrg
112 1.1 mrg #if !defined(pmap_clear_modify)
113 1.1 mrg boolean_t pmap_clear_modify __P((struct vm_page *));
114 1.1 mrg #endif
115 1.1 mrg #if !defined(pmap_clear_reference)
116 1.1 mrg boolean_t pmap_clear_reference __P((struct vm_page *));
117 1.1 mrg #endif
118 1.1 mrg
119 1.1 mrg void pmap_collect __P((pmap_t));
120 1.1 mrg void pmap_copy __P((pmap_t,
121 1.1 mrg pmap_t, vaddr_t, vsize_t, vaddr_t));
122 1.10 thorpej #if !defined(pmap_copy_page)
123 1.1 mrg void pmap_copy_page __P((paddr_t, paddr_t));
124 1.10 thorpej #endif
125 1.1 mrg struct pmap *pmap_create __P((void));
126 1.1 mrg void pmap_destroy __P((pmap_t));
127 1.1 mrg int pmap_enter __P((pmap_t,
128 1.1 mrg vaddr_t, paddr_t, vm_prot_t, int));
129 1.1 mrg boolean_t pmap_extract __P((pmap_t, vaddr_t, paddr_t *));
130 1.1 mrg #if defined(PMAP_GROWKERNEL)
131 1.1 mrg vaddr_t pmap_growkernel __P((vaddr_t));
132 1.1 mrg #endif
133 1.1 mrg
134 1.1 mrg void pmap_init __P((void));
135 1.1 mrg
136 1.1 mrg void pmap_kenter_pa __P((vaddr_t, paddr_t, vm_prot_t));
137 1.1 mrg void pmap_kremove __P((vaddr_t, vsize_t));
138 1.1 mrg #if !defined(pmap_is_modified)
139 1.1 mrg boolean_t pmap_is_modified __P((struct vm_page *));
140 1.1 mrg #endif
141 1.1 mrg #if !defined(pmap_is_referenced)
142 1.1 mrg boolean_t pmap_is_referenced __P((struct vm_page *));
143 1.1 mrg #endif
144 1.1 mrg
145 1.1 mrg void pmap_page_protect __P((struct vm_page *, vm_prot_t));
146 1.1 mrg
147 1.1 mrg #if !defined(pmap_phys_address)
148 1.6 thorpej paddr_t pmap_phys_address __P((int));
149 1.1 mrg #endif
150 1.1 mrg void pmap_protect __P((pmap_t,
151 1.1 mrg vaddr_t, vaddr_t, vm_prot_t));
152 1.1 mrg void pmap_reference __P((pmap_t));
153 1.1 mrg void pmap_remove __P((pmap_t, vaddr_t, vaddr_t));
154 1.9 chris void pmap_update __P((pmap_t));
155 1.6 thorpej #if !defined(pmap_resident_count)
156 1.6 thorpej long pmap_resident_count __P((pmap_t));
157 1.6 thorpej #endif
158 1.6 thorpej #if !defined(pmap_wired_count)
159 1.6 thorpej long pmap_wired_count __P((pmap_t));
160 1.6 thorpej #endif
161 1.10 thorpej #if !defined(pmap_zero_page)
162 1.1 mrg void pmap_zero_page __P((paddr_t));
163 1.10 thorpej #endif
164 1.1 mrg
165 1.3 thorpej void pmap_virtual_space __P((vaddr_t *, vaddr_t *));
166 1.1 mrg #if defined(PMAP_STEAL_MEMORY)
167 1.1 mrg vaddr_t pmap_steal_memory __P((vsize_t, vaddr_t *, vaddr_t *));
168 1.1 mrg #endif
169 1.1 mrg
170 1.1 mrg #if defined(PMAP_FORK)
171 1.1 mrg void pmap_fork __P((pmap_t, pmap_t));
172 1.1 mrg #endif
173 1.1 mrg __END_DECLS
174 1.1 mrg #endif /* kernel*/
175 1.1 mrg #endif /* PMAP_EXCLUDE_DECLS */
176 1.1 mrg
177 1.1 mrg #endif /* _PMAP_VM_ */
178