Annotation of sys/arch/alpha/include/pte.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: pte.h,v 1.8 2000/11/08 21:27:23 ericj Exp $ */
2: /* $NetBSD: pte.h,v 1.26 1999/04/09 00:38:11 thorpej Exp $ */
3:
4: /*-
5: * Copyright (c) 1998 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to The NetBSD Foundation
9: * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
10: * NASA Ames Research Center.
11: *
12: * Redistribution and use in source and binary forms, with or without
13: * modification, are permitted provided that the following conditions
14: * are met:
15: * 1. Redistributions of source code must retain the above copyright
16: * notice, this list of conditions and the following disclaimer.
17: * 2. Redistributions in binary form must reproduce the above copyright
18: * notice, this list of conditions and the following disclaimer in the
19: * documentation and/or other materials provided with the distribution.
20: * 3. All advertising materials mentioning features or use of this software
21: * must display the following acknowledgement:
22: * This product includes software developed by the NetBSD
23: * Foundation, Inc. and its contributors.
24: * 4. Neither the name of The NetBSD Foundation nor the names of its
25: * contributors may be used to endorse or promote products derived
26: * from this software without specific prior written permission.
27: *
28: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38: * POSSIBILITY OF SUCH DAMAGE.
39: */
40:
41: /*
42: * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
43: * All rights reserved.
44: *
45: * Author: Chris G. Demetriou
46: *
47: * Permission to use, copy, modify and distribute this software and
48: * its documentation is hereby granted, provided that both the copyright
49: * notice and this permission notice appear in all copies of the
50: * software, derivative works or modified versions, and any portions
51: * thereof, and that both notices appear in supporting documentation.
52: *
53: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
54: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
55: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
56: *
57: * Carnegie Mellon requests users of this software to return to
58: *
59: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
60: * School of Computer Science
61: * Carnegie Mellon University
62: * Pittsburgh PA 15213-3890
63: *
64: * any improvements or extensions that they make and grant Carnegie the
65: * rights to redistribute these changes.
66: */
67:
68: #ifndef _ALPHA_PTE_H_
69: #define _ALPHA_PTE_H_
70:
71: /*
72: * Alpha page table entry.
73: * Things which are in the VMS PALcode but not in the OSF PALcode
74: * are marked with "(VMS)".
75: *
76: * This information derived from pp. (II) 3-3 - (II) 3-6 and
77: * (III) 3-3 - (III) 3-5 of the "Alpha Architecture Reference Manual" by
78: * Richard L. Sites.
79: */
80:
81: /*
82: * Alpha Page Table Entry
83: */
84:
85: #include <machine/alpha_cpu.h>
86:
87: typedef alpha_pt_entry_t pt_entry_t;
88:
89: #define PT_ENTRY_NULL ((pt_entry_t *) 0)
90: #define PTESHIFT 3 /* pte size == 1 << PTESHIFT */
91:
92: #define PG_V ALPHA_PTE_VALID
93: #define PG_NV 0
94: #define PG_FOR ALPHA_PTE_FAULT_ON_READ
95: #define PG_FOW ALPHA_PTE_FAULT_ON_WRITE
96: #define PG_FOE ALPHA_PTE_FAULT_ON_EXECUTE
97: #define PG_ASM ALPHA_PTE_ASM
98: #define PG_GH ALPHA_PTE_GRANULARITY
99: #define PG_KRE ALPHA_PTE_KR
100: #define PG_URE ALPHA_PTE_UR
101: #define PG_KWE ALPHA_PTE_KW
102: #define PG_UWE ALPHA_PTE_UW
103: #define PG_PROT ALPHA_PTE_PROT
104: #define PG_RSVD 0x000000000000cc80 /* Reserved for hardware */
105: #define PG_WIRED 0x0000000000010000 /* Wired. [SOFTWARE] */
106: #define PG_PVLIST 0x0000000000020000 /* on pv list [SOFTWARE] */
107: #define PG_EXEC 0x0000000000040000 /* execute perms [SOFTWARE] */
108: #define PG_FRAME ALPHA_PTE_RAME
109: #define PG_SHIFT 32
110: #define PG_PFNUM(x) ALPHA_PTE_TO_PFN(x)
111:
112: /*
113: * These are the PALcode PTE bits that we care about when checking to see
114: * if a PTE has changed in such a way as to require a TBI.
115: */
116: #define PG_PALCODE(x) ((x) & ALPHA_PTE_PALCODE)
117:
118: #if defined(_KERNEL) || defined(__KVM_ALPHA_PRIVATE)
119: #define NPTEPG_SHIFT (PAGE_SHIFT - PTESHIFT)
120: #define NPTEPG (1L << NPTEPG_SHIFT)
121:
122: #define PTEMASK (NPTEPG - 1)
123:
124: #define l3pte_index(va) \
125: (((vaddr_t)(va) >> PAGE_SHIFT) & PTEMASK)
126:
127: #define l2pte_index(va) \
128: (((vaddr_t)(va) >> (PAGE_SHIFT + NPTEPG_SHIFT)) & PTEMASK)
129:
130: #define l1pte_index(va) \
131: (((vaddr_t)(va) >> (PAGE_SHIFT + 2 * NPTEPG_SHIFT)) & PTEMASK)
132:
133: #define VPT_INDEX(va) \
134: (((vaddr_t)(va) >> PAGE_SHIFT) & ((1 << 3 * NPTEPG_SHIFT) - 1))
135:
136: /* Space mapped by one level 1 PTE */
137: #define ALPHA_L1SEG_SIZE (1L << ((2 * NPTEPG_SHIFT) + PAGE_SHIFT))
138:
139: /* Space mapped by one level 2 PTE */
140: #define ALPHA_L2SEG_SIZE (1L << (NPTEPG_SHIFT + PAGE_SHIFT))
141:
142: #define alpha_trunc_l1seg(x) (((u_long)(x)) & ~(ALPHA_L1SEG_SIZE-1))
143: #define alpha_trunc_l2seg(x) (((u_long)(x)) & ~(ALPHA_L2SEG_SIZE-1))
144: #endif /* _KERNEL || __KVM_ALPHA_PRIVATE */
145:
146: #ifdef _KERNEL
147: extern pt_entry_t *kernel_lev1map; /* kernel level 1 page table */
148: #endif /* _KERNEL */
149:
150: #endif /* ! _ALPHA_PTE_H_ */
CVSweb