Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / rump / librump / rumpkern / pmap_stub.c
blobd7e5ec896d6a7c113d108308521433449fd0953b
1 /* $NetBSD: pmap_stub.c,v 1.22 2009/11/07 12:08:35 dsl Exp $ */
3 /*
4 * Copyright (c) 2008 Antti Kantee. All Rights Reserved.
6 * Development of this software was supported by the
7 * Finnish Cultural Foundation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: pmap_stub.c,v 1.22 2009/11/07 12:08:35 dsl Exp $");
34 #include <sys/param.h>
36 #include <uvm/uvm_extern.h>
38 /* get your kicks on pmap 66 */
39 struct pmap *const kernel_pmap_ptr = (struct pmap *const)0x66;
42 * Provide a userspace pmap with the headers the kernel gives us.
43 * This results in some arch-specific frobbling which
44 * cannot really be easily avoided until the pmap interface is
45 * specified with something else than a .h and autogenerated into C.
48 #if defined(__sparc__) && !defined(__sparc_v9__)
49 #undef pmap_is_modified
50 #undef pmap_clear_modify
51 #undef pmap_kenter_pa
52 #undef pmap_kremove
53 #undef pmap_page_protect
54 #undef pmap_extract
55 #undef pmap_enter
57 bool pmap_is_modified(struct vm_page *);
58 bool pmap_clear_modify(struct vm_page *);
59 void pmap_kenter_pa(vaddr_t, paddr_t, vm_prot_t, u_int);
60 void pmap_kremove(vaddr_t, vsize_t);
61 void pmap_page_protect(struct vm_page *, vm_prot_t);
62 bool pmap_extract(pmap_t, vaddr_t, paddr_t *);
63 int pmap_enter(pmap_t, vaddr_t, paddr_t, vm_prot_t, u_int);
64 #endif
66 #if !defined(pmap_is_modified) && !defined(__vax__)
67 bool
68 pmap_is_modified(struct vm_page *pg)
71 return true;
73 #endif
75 #if !defined(pmap_clear_modify) && !defined(__vax__)
76 bool
77 pmap_clear_modify(struct vm_page *pg)
80 return true;
82 #endif
84 #ifndef pmap_update
85 void
86 pmap_update(pmap_t pmap)
90 #endif
92 void
93 pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int fl)
96 panic("%s: unavailable", __func__);
99 void
100 pmap_kremove(vaddr_t va, vsize_t size)
103 panic("%s: unavailable", __func__);
107 pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
110 panic("%s: unavailable", __func__);
114 * It's a brave new world.
116 #if !defined(__vax__)
118 void
119 pmap_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva)
122 panic("%s: unavailable", __func__);
125 bool
126 pmap_extract(pmap_t pmap, vaddr_t va, paddr_t *pap)
129 *pap = va;
130 return true;
133 #endif
136 * Begin MD stubs
138 #if !defined(__i386__) && !defined(__x86_64__) && \
139 !defined(__hppa__) && \
140 !defined(__vax__)
141 void
142 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
145 /* nada */
147 #endif
149 #ifdef __hppa__
150 void
151 pmap_page_remove(struct vm_page *pg)
156 bool
157 pmap_changebit(struct vm_page *pg, unsigned int set, unsigned int clear)
160 return true;
163 bool
164 pmap_testbit(struct vm_page *pg, unsigned int bit)
167 return true;
169 #endif
171 #if defined(__i386__) || defined(__x86_64__)
172 bool
173 pmap_clear_attrs(struct vm_page *pg, unsigned what)
176 return false;
179 void
180 pmap_page_remove(struct vm_page *pg)
185 bool
186 pmap_test_attrs(struct vm_page *pg, unsigned what)
189 return true;
192 paddr_t
193 vtophys(vaddr_t va)
196 return va;
198 #endif
200 #ifdef __vax__
202 * XXX: this won't work on vax. But I'm not terribly
203 * uberinterested in that for the time being.
205 struct pv_entry *pv_table;
206 bool
207 pmap_clear_modify_long(struct pv_entry *pv)
210 return true;
213 bool
214 pmap_clear_reference_long(struct pv_entry *pv)
217 return true;
220 bool
221 pmap_is_modified_long(struct pv_entry *pv)
224 return true;
227 void
228 pmap_page_protect_long(struct pv_entry *pv, vm_prot_t prot)
233 void
234 pmap_protect_long(pmap_t pmap, vaddr_t va1, vaddr_t va2, vm_prot_t prot)
239 struct pte *Sysmap;
240 #endif
242 #ifdef PPC_OEA
243 bool
244 pmap_clear_bit(struct vm_page *pg, int ptebit)
247 return true;
250 bool
251 pmap_query_bit(struct vm_page *pg, int ptebit)
254 return true;
256 #endif
258 #if defined(__sparc__) && !defined(__sparc_v9__)
259 bool (*pmap_clear_modify_p)(struct vm_page *) = pmap_clear_modify;
260 bool (*pmap_is_modified_p)(struct vm_page *) = pmap_is_modified;
261 void (*pmap_kenter_pa_p)(vaddr_t, paddr_t, vm_prot_t, u_int) = pmap_kenter_pa;
262 void (*pmap_kremove_p)(vaddr_t, vsize_t) = pmap_kremove;
263 void (*pmap_page_protect_p)(struct vm_page *, vm_prot_t) = pmap_page_protect;
264 bool (*pmap_extract_p)(pmap_t, vaddr_t, paddr_t *) = pmap_extract;
265 int (*pmap_enter_p)(pmap_t, vaddr_t, paddr_t, vm_prot_t, u_int) = pmap_enter;
266 #endif