1 #-
2 # Copyright (c) 2010 Nathan Whitehorn
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
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.
13 #
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
24 # SUCH DAMAGE.
25 #
26 # $FreeBSD$
27 #
28
29
30 #include <sys/param.h>
31 #include <sys/lock.h>
32 #include <sys/mutex.h>
33 #include <sys/systm.h>
34
35 #include <vm/vm.h>
36 #include <vm/vm_page.h>
37
38 #include <machine/mmuvar.h>
39
40 /**
41 * MOEA64 kobj methods for 64-bit Book-S page table
42 * manipulation routines used, for example, by hypervisors.
43 */
44
45 INTERFACE moea64;
46
47
48 /**
49 * Copy ref/changed bits from PTE referenced by _pt_cookie to _pvo_pt.
50 */
51 METHOD void pte_synch {
52 mmu_t _mmu;
53 uintptr_t _pt_cookie;
54 struct lpte *_pvo_pt;
55 };
56
57 /**
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.
61 */
62 METHOD void pte_clear {
63 mmu_t _mmu;
64 uintptr_t _pt_cookie;
65 struct lpte *_pvo_pt;
66 uint64_t _vpn;
67 uint64_t _ptebit;
68 };
69
70 /**
71 * Invalidate the PTE referenced by _pt_cookie, synchronizing its validity
72 * and ref/changed bits after completion.
73 */
74 METHOD void pte_unset {
75 mmu_t _mmu;
76 uintptr_t _pt_cookie;
77 struct lpte *_pvo_pt;
78 uint64_t _vpn;
79 };
80
81 /**
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.
85 */
86 METHOD void pte_change {
87 mmu_t _mmu;
88 uintptr_t _pt_cookie;
89 struct lpte *_pvo_pt;
90 uint64_t _vpn;
91 };
92
93
94 /**
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.
99 */
100 METHOD int pte_insert {
101 mmu_t _mmu;
102 u_int _ptegidx;
103 struct lpte *_pvo_pt;
104 };
105
106 /**
107 * Return the page table reference cookie corresponding to _pvo, or -1 if
108 * the _pvo is not currently in the page table.
109 */
110 METHOD uintptr_t pvo_to_pte {
111 mmu_t _mmu;
112 const struct pvo_entry *_pvo;
113 };
114
115
Cache object: 7d2f92a6cdeb53bf781e6d22944c22c3
|