2 # Copyright (c) 2010 Nathan Whitehorn
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #include <sys/param.h>
32 #include <sys/mutex.h>
33 #include <sys/systm.h>
36 #include <vm/vm_page.h>
38 #include <machine/mmuvar.h>
41 * MOEA64 kobj methods for 64-bit Book-S page table
42 * manipulation routines used, for example, by hypervisors.
49 * Copy ref/changed bits from PTE referenced by _pt_cookie to _pvo_pt.
51 METHOD void pte_synch {
58 * Clear bits ptebit (a mask) from the low word of the PTE referenced by
59 * _pt_cookie. Note that _pvo_pt is for reference use only -- the bit should
60 * NOT be cleared there.
62 METHOD void pte_clear {
71 * Invalidate the PTE referenced by _pt_cookie, synchronizing its validity
72 * and ref/changed bits after completion.
74 METHOD void pte_unset {
82 * Update the PTE referenced by _pt_cookie with the values in _pvo_pt,
83 * making sure that the values of ref/changed bits are preserved and
84 * synchronized back to _pvo_pt.
86 METHOD void pte_change {
95 * Insert the PTE _pvo_pt into the PTEG group _ptegidx, returning the index
96 * of the PTE in its group at completion, or -1 if no slots were free. Must
97 * not replace PTEs marked LPTE_WIRED or LPTE_LOCKED, and must set LPTE_HID
98 * and LPTE_VALID appropriately in _pvo_pt.
100 METHOD int pte_insert {
103 struct lpte *_pvo_pt;
107 * Return the page table reference cookie corresponding to _pvo, or -1 if
108 * the _pvo is not currently in the page table.
110 METHOD uintptr_t pvo_to_pte {
112 const struct pvo_entry *_pvo;