tte.h (91224) | tte.h (97027) |
---|---|
1/*- 2 * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * from: BSDI: pmap.v9.h,v 1.10.2.6 1999/08/23 22:18:44 cp Exp | 1/*- 2 * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * from: BSDI: pmap.v9.h,v 1.10.2.6 1999/08/23 22:18:44 cp Exp |
29 * $FreeBSD: head/sys/sparc64/include/tte.h 91224 2002-02-25 04:56:50Z jake $ | 29 * $FreeBSD: head/sys/sparc64/include/tte.h 97027 2002-05-21 00:29:02Z jake $ |
30 */ 31 32#ifndef _MACHINE_TTE_H_ 33#define _MACHINE_TTE_H_ 34 35#define TTE_SHIFT (4) 36 37#define TD_SIZE_SHIFT (61) 38#define TD_SOFT2_SHIFT (50) 39#define TD_DIAG_SHIFT (41) 40#define TD_PA_SHIFT (13) 41#define TD_SOFT_SHIFT (7) 42 | 30 */ 31 32#ifndef _MACHINE_TTE_H_ 33#define _MACHINE_TTE_H_ 34 35#define TTE_SHIFT (4) 36 37#define TD_SIZE_SHIFT (61) 38#define TD_SOFT2_SHIFT (50) 39#define TD_DIAG_SHIFT (41) 40#define TD_PA_SHIFT (13) 41#define TD_SOFT_SHIFT (7) 42 |
43#define TD_SIZE_SIZE (2) 44#define TD_SOFT2_SIZE (9) 45#define TD_DIAG_SIZE (9) 46#define TD_PA_SIZE (28) 47#define TD_SOFT_SIZE (6) | 43#define TD_SIZE_BITS (2) 44#define TD_SOFT2_BITS (9) 45#define TD_DIAG_BITS (9) 46#define TD_PA_BITS (28) 47#define TD_SOFT_BITS (6) |
48 | 48 |
49#define TD_SIZE_MASK (((1UL << TD_SIZE_SIZE) - 1) << TD_SIZE_SHIFT) 50#define TD_SOFT2_MASK (((1UL << TD_SOFT2_SIZE) - 1) << TD_SOFT2_SHIFT) 51#define TD_DIAG_MASK (((1UL << TD_DIAG_SIZE) - 1) << TD_DIAG_SHIFT) 52#define TD_PA_MASK (((1UL << TD_PA_SIZE) - 1) << TD_PA_SHIFT) 53#define TD_SOFT_MASK (((1UL << TD_SOFT_SIZE) - 1) << TD_SOFT_SHIFT) | 49#define TD_SIZE_MASK ((1UL << TD_SIZE_BITS) - 1) 50#define TD_SOFT2_MASK ((1UL << TD_SOFT2_BITS) - 1) 51#define TD_DIAG_MASK ((1UL << TD_DIAG_BITS) - 1) 52#define TD_PA_MASK ((1UL << TD_PA_BITS) - 1) 53#define TD_SOFT_MASK ((1UL << TD_SOFT_BITS) - 1) |
54 | 54 |
55#define TD_SIZE_SPREAD (3) 56 |
|
55#define TS_EXEC (1UL << 4) 56#define TS_REF (1UL << 3) 57#define TS_PV (1UL << 2) 58#define TS_W (1UL << 1) 59#define TS_WIRED (1UL << 0) 60 61#define TD_V (1UL << 63) 62#define TD_8K (0UL << TD_SIZE_SHIFT) 63#define TD_64K (1UL << TD_SIZE_SHIFT) 64#define TD_512K (2UL << TD_SIZE_SHIFT) 65#define TD_4M (3UL << TD_SIZE_SHIFT) 66#define TD_NFO (1UL << 60) 67#define TD_IE (1UL << 59) | 57#define TS_EXEC (1UL << 4) 58#define TS_REF (1UL << 3) 59#define TS_PV (1UL << 2) 60#define TS_W (1UL << 1) 61#define TS_WIRED (1UL << 0) 62 63#define TD_V (1UL << 63) 64#define TD_8K (0UL << TD_SIZE_SHIFT) 65#define TD_64K (1UL << TD_SIZE_SHIFT) 66#define TD_512K (2UL << TD_SIZE_SHIFT) 67#define TD_4M (3UL << TD_SIZE_SHIFT) 68#define TD_NFO (1UL << 60) 69#define TD_IE (1UL << 59) |
68#define TD_PA(pa) ((pa) & TD_PA_MASK) | 70#define TD_PA(pa) ((pa) & (TD_PA_MASK << TD_PA_SHIFT)) |
69#define TD_EXEC (TS_EXEC << TD_SOFT_SHIFT) 70#define TD_REF (TS_REF << TD_SOFT_SHIFT) 71#define TD_PV (TS_PV << TD_SOFT_SHIFT) 72#define TD_SW (TS_W << TD_SOFT_SHIFT) 73#define TD_WIRED (TS_WIRED << TD_SOFT_SHIFT) 74#define TD_L (1UL << 6) 75#define TD_CP (1UL << 5) 76#define TD_CV (1UL << 4) 77#define TD_E (1UL << 3) 78#define TD_P (1UL << 2) 79#define TD_W (1UL << 1) 80#define TD_G (1UL << 0) 81 82#define TV_VPN(va) ((va) >> PAGE_SHIFT) 83 | 71#define TD_EXEC (TS_EXEC << TD_SOFT_SHIFT) 72#define TD_REF (TS_REF << TD_SOFT_SHIFT) 73#define TD_PV (TS_PV << TD_SOFT_SHIFT) 74#define TD_SW (TS_W << TD_SOFT_SHIFT) 75#define TD_WIRED (TS_WIRED << TD_SOFT_SHIFT) 76#define TD_L (1UL << 6) 77#define TD_CP (1UL << 5) 78#define TD_CV (1UL << 4) 79#define TD_E (1UL << 3) 80#define TD_P (1UL << 2) 81#define TD_W (1UL << 1) 82#define TD_G (1UL << 0) 83 84#define TV_VPN(va) ((va) >> PAGE_SHIFT) 85 |
84#define TD_GET_SIZE(d) (((d) >> TD_SIZE_SHIFT) & 3) 85#define TD_GET_PA(d) ((d) & TD_PA_MASK) 86#define TD_GET_TLB(d) (((d) & TD_EXEC) ? (TLB_DTLB | TLB_ITLB) : TLB_DTLB) 87#define TV_GET_VA(vpn) ((vpn) << PAGE_SHIFT) | 86#define TTE_GET_SIZE(tp) \ 87 (((tp)->tte_data >> TD_SIZE_SHIFT) & TD_SIZE_MASK) 88#define TTE_GET_PAGE_SHIFT(tp) \ 89 (PAGE_SHIFT + (TTE_GET_SIZE(tp) * TD_SIZE_SPREAD)) 90#define TTE_GET_PAGE_SIZE(tp) \ 91 (1 << TTE_GET_PAGE_SHIFT(tp)) 92#define TTE_GET_PAGE_MASK(tp) \ 93 (TTE_GET_PAGE_SIZE(tp) - 1) |
88 | 94 |
95#define TTE_GET_PA(tp) \ 96 ((tp)->tte_data & (TD_PA_MASK << TD_PA_SHIFT)) 97#define TTE_GET_TLB(tp) \ 98 (((tp)->tte_data & TD_EXEC) ? (TLB_DTLB | TLB_ITLB) : TLB_DTLB) 99#define TTE_GET_VA(tp) \ 100 ((tp)->tte_vpn << PAGE_SHIFT) 101 |
|
89struct tte { 90 u_long tte_vpn; 91 u_long tte_data; 92}; 93 94static __inline int | 102struct tte { 103 u_long tte_vpn; 104 u_long tte_data; 105}; 106 107static __inline int |
95tte_match_vpn(struct tte tte, vm_offset_t vpn) | 108tte_match_vpn(struct tte *tp, vm_offset_t vpn) |
96{ | 109{ |
97 return ((tte.tte_data & TD_V) != 0 && tte.tte_vpn == vpn); | 110 return ((tp->tte_data & TD_V) != 0 && tp->tte_vpn == vpn); |
98} 99 100static __inline int | 111} 112 113static __inline int |
101tte_match(struct tte tte, vm_offset_t va) | 114tte_match(struct tte *tp, vm_offset_t va) |
102{ | 115{ |
103 return (tte_match_vpn(tte, va >> PAGE_SHIFT)); | 116 return (tte_match_vpn(tp, va >> PAGE_SHIFT)); |
104} 105 106#endif /* !_MACHINE_TTE_H_ */ | 117} 118 119#endif /* !_MACHINE_TTE_H_ */ |