1#- |
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# |
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 |
47CODE { 48 static moea64_pte_replace_t moea64_pte_replace_default; |
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 |
62/** |
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. |
65 */ |
66METHOD int64_t pte_synch { |
67 mmu_t _mmu; |
68 struct pvo_entry *_pvo; |
69}; 70 71/** 72 * Clear bits ptebit (a mask) from the low word of the PTE referenced by |
73 * _pvo. Return previous values of ref/changed bits or -1 if _pvo is not 74 * currently in the page table. |
75 */ |
76METHOD int64_t pte_clear { |
77 mmu_t _mmu; |
78 struct pvo_entry *_pvo; |
79 uint64_t _ptebit; 80}; 81 82/** |
83 * Invalidate the PTE referenced by _pvo, returning its ref/changed bits. 84 * Returns -1 if PTE not currently present in page table. |
85 */ |
86METHOD int64_t pte_unset { |
87 mmu_t _mmu; |
88 struct pvo_entry *_pvo; |
89}; 90 91/** |
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() |
102 */ |
103METHOD int64_t pte_replace { |
104 mmu_t _mmu; |
105 struct pvo_entry *_pvo; 106 int _flags; 107} DEFAULT moea64_pte_replace_default; |
108 109/** |
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(). |
116 */ 117METHOD int pte_insert { 118 mmu_t _mmu; |
119 struct pvo_entry *_pvo; |
120}; 121 |