moea64_if.m (216174) | moea64_if.m (279252) |
---|---|
1#- | 1#- |
2# Copyright (c) 2010 Nathan Whitehorn | 2# Copyright (c) 2010,2015 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 --- 7 unchanged lines hidden (view full) --- 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# | 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 --- 7 unchanged lines hidden (view full) --- 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: head/sys/powerpc/aim/moea64_if.m 216174 2010-12-04 02:42:52Z nwhitehorn $ | 26# $FreeBSD: head/sys/powerpc/aim/moea64_if.m 279252 2015-02-24 21:37:20Z nwhitehorn $ |
27# 28 29 30#include <sys/param.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/systm.h> 34 --- 4 unchanged lines hidden (view full) --- 39 40/** 41 * MOEA64 kobj methods for 64-bit Book-S page table 42 * manipulation routines used, for example, by hypervisors. 43 */ 44 45INTERFACE moea64; 46 | 27# 28 29 30#include <sys/param.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/systm.h> 34 --- 4 unchanged lines hidden (view full) --- 39 40/** 41 * MOEA64 kobj methods for 64-bit Book-S page table 42 * manipulation routines used, for example, by hypervisors. 43 */ 44 45INTERFACE moea64; 46 |
47CODE { 48 static moea64_pte_replace_t moea64_pte_replace_default; |
|
47 | 49 |
50 static int64_t moea64_pte_replace_default(mmu_t mmu, 51 struct pvo_entry *pvo, int flags) 52 { 53 int64_t refchg; 54 55 refchg = MOEA64_PTE_UNSET(mmu, pvo); 56 MOEA64_PTE_INSERT(mmu, pvo); 57 58 return (refchg); 59 } 60} 61 |
|
48/** | 62/** |
49 * Copy ref/changed bits from PTE referenced by _pt_cookie to _pvo_pt. | 63 * Return ref/changed bits from PTE referenced by _pvo if _pvo is currently in 64 * the page table. Returns -1 if _pvo not currently present in the page table. |
50 */ | 65 */ |
51METHOD void pte_synch { | 66METHOD int64_t pte_synch { |
52 mmu_t _mmu; | 67 mmu_t _mmu; |
53 uintptr_t _pt_cookie; 54 struct lpte *_pvo_pt; | 68 struct pvo_entry *_pvo; |
55}; 56 57/** 58 * Clear bits ptebit (a mask) from the low word of the PTE referenced by | 69}; 70 71/** 72 * 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. | 73 * _pvo. Return previous values of ref/changed bits or -1 if _pvo is not 74 * currently in the page table. |
61 */ | 75 */ |
62METHOD void pte_clear { | 76METHOD int64_t pte_clear { |
63 mmu_t _mmu; | 77 mmu_t _mmu; |
64 uintptr_t _pt_cookie; 65 struct lpte *_pvo_pt; 66 uint64_t _vpn; | 78 struct pvo_entry *_pvo; |
67 uint64_t _ptebit; 68}; 69 70/** | 79 uint64_t _ptebit; 80}; 81 82/** |
71 * Invalidate the PTE referenced by _pt_cookie, synchronizing its validity 72 * and ref/changed bits after completion. | 83 * Invalidate the PTE referenced by _pvo, returning its ref/changed bits. 84 * Returns -1 if PTE not currently present in page table. |
73 */ | 85 */ |
74METHOD void pte_unset { | 86METHOD int64_t pte_unset { |
75 mmu_t _mmu; | 87 mmu_t _mmu; |
76 uintptr_t _pt_cookie; 77 struct lpte *_pvo_pt; 78 uint64_t _vpn; | 88 struct pvo_entry *_pvo; |
79}; 80 81/** | 89}; 90 91/** |
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. | 92 * Update the reference PTE to correspond to the contents of _pvo. Has the 93 * same ref/changed semantics as pte_unset() (and should clear R/C bits). May 94 * change the PVO's location in the page table or return with it unmapped if 95 * PVO_WIRED is not set. By default, does unset() followed by insert(). 96 * 97 * _flags is a bitmask describing what level of page invalidation should occur: 98 * 0 means no invalidation is required 99 * MOEA64_PTE_PROT_UPDATE signifies that the page protection bits are changing 100 * MOEA64_PTE_INVALIDATE requires an invalidation of the same strength as 101 * pte_unset() followed by pte_insert() |
85 */ | 102 */ |
86METHOD void pte_change { | 103METHOD int64_t pte_replace { |
87 mmu_t _mmu; | 104 mmu_t _mmu; |
88 uintptr_t _pt_cookie; 89 struct lpte *_pvo_pt; 90 uint64_t _vpn; 91}; 92 | 105 struct pvo_entry *_pvo; 106 int _flags; 107} DEFAULT moea64_pte_replace_default; |
93 94/** | 108 109/** |
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. | 110 * Insert a PTE corresponding to _pvo into the page table, returning any errors 111 * encountered and (optionally) setting the PVO slot value to some 112 * representation of where the entry was placed. 113 * 114 * Must not replace PTEs marked LPTE_WIRED. If an existing valid PTE is spilled, 115 * must synchronize ref/changed bits as in pte_unset(). |
99 */ 100METHOD int pte_insert { 101 mmu_t _mmu; | 116 */ 117METHOD int pte_insert { 118 mmu_t _mmu; |
102 u_int _ptegidx; 103 struct lpte *_pvo_pt; | 119 struct pvo_entry *_pvo; |
104}; 105 | 120}; 121 |
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 */ 110METHOD uintptr_t pvo_to_pte { 111 mmu_t _mmu; 112 const struct pvo_entry *_pvo; 113}; 114 115 | |