1 /* $NetBSD: pmap_stub.c,v 1.22 2009/11/07 12:08:35 dsl Exp $ */
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
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
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
53 #undef pmap_page_protect
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
);
66 #if !defined(pmap_is_modified) && !defined(__vax__)
68 pmap_is_modified(struct vm_page
*pg
)
75 #if !defined(pmap_clear_modify) && !defined(__vax__)
77 pmap_clear_modify(struct vm_page
*pg
)
86 pmap_update(pmap_t pmap
)
93 pmap_kenter_pa(vaddr_t va
, paddr_t pa
, vm_prot_t prot
, u_int fl
)
96 panic("%s: unavailable", __func__
);
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__)
119 pmap_remove(pmap_t pmap
, vaddr_t sva
, vaddr_t eva
)
122 panic("%s: unavailable", __func__
);
126 pmap_extract(pmap_t pmap
, vaddr_t va
, paddr_t
*pap
)
138 #if !defined(__i386__) && !defined(__x86_64__) && \
139 !defined(__hppa__) && \
142 pmap_page_protect(struct vm_page
*pg
, vm_prot_t prot
)
151 pmap_page_remove(struct vm_page
*pg
)
157 pmap_changebit(struct vm_page
*pg
, unsigned int set
, unsigned int clear
)
164 pmap_testbit(struct vm_page
*pg
, unsigned int bit
)
171 #if defined(__i386__) || defined(__x86_64__)
173 pmap_clear_attrs(struct vm_page
*pg
, unsigned what
)
180 pmap_page_remove(struct vm_page
*pg
)
186 pmap_test_attrs(struct vm_page
*pg
, unsigned what
)
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
;
207 pmap_clear_modify_long(struct pv_entry
*pv
)
214 pmap_clear_reference_long(struct pv_entry
*pv
)
221 pmap_is_modified_long(struct pv_entry
*pv
)
228 pmap_page_protect_long(struct pv_entry
*pv
, vm_prot_t prot
)
234 pmap_protect_long(pmap_t pmap
, vaddr_t va1
, vaddr_t va2
, vm_prot_t prot
)
244 pmap_clear_bit(struct vm_page
*pg
, int ptebit
)
251 pmap_query_bit(struct vm_page
*pg
, int ptebit
)
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
;