xref: /titanic_51/usr/src/uts/intel/ia32/sys/pte.h (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _IA32_SYS_PTE_H
27 #define	_IA32_SYS_PTE_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifndef _ASM
32 #include <sys/types.h>
33 #endif /* _ASM */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #ifndef _ASM
40 
41 #ifdef	PTE36			/* PTE36 ---------------------------- */
42 
43 typedef uint64_t	pteval_t;
44 typedef	pteval_t	*pteptr_t;
45 
46 #define	PRPTEx		"llx"
47 
48 typedef struct pte32 {
49 	uint32_t Present:1;
50 	uint32_t AccessPermissions:2;
51 	uint32_t WriteThru:1;
52 	uint32_t NonCacheable:1;
53 	uint32_t Referenced:1;
54 	uint32_t Modified:1;
55 	uint32_t MustBeZero:1;
56 	uint32_t GlobalEnable:1;
57 	uint32_t OSReserved:3;
58 	uint32_t PhysicalPageNumber:20;
59 } pte32_t;
60 
61 
62 typedef struct pte {
63 	uint32_t Present:1;
64 	uint32_t AccessPermissions:2;
65 	uint32_t WriteThru:1;
66 	uint32_t NonCacheable:1;
67 	uint32_t Referenced:1;
68 	uint32_t Modified:1;
69 	uint32_t MustBeZero:1;
70 	uint32_t GlobalEnable:1;
71 	uint32_t OSReserved:3;
72 	uint32_t PhysicalPageNumberL:20;
73 	uint32_t PhysicalPageNumberH;
74 					/*
75 					 * An easy way to ensure that
76 					 * reserved bits are zero.
77 					 */
78 } pte_t;
79 
80 struct  pte64 {
81 	uint32_t	pte64_0_31;
82 	uint32_t	pte64_32_64;
83 };
84 
85 #define	NPTESHIFT	9
86 #define	NPTEPERPT	512	/* entries in page table */
87 #define	PTSIZE		(NPTEPERPT * MMU_PAGESIZE)	/* bytes mapped */
88 
89 
90 #else		/* PTE36 */
91 				/* PTE32 ---------------------------- */
92 
93 
94 typedef uint32_t	pteval_t;
95 typedef	pteval_t	*pteptr_t;
96 
97 #define	PRPTEx		"x"
98 
99 typedef struct pte {
100 	uint_t Present:1;
101 	uint_t AccessPermissions:2;
102 	uint_t WriteThru:1;
103 	uint_t NonCacheable:1;
104 	uint_t Referenced:1;
105 	uint_t Modified:1;
106 	uint_t MustBeZero:1;
107 	uint_t GlobalEnable:1;
108 	uint_t OSReserved:3;
109 	uint_t PhysicalPageNumber:20;
110 } pte_t;
111 
112 #define	pte32_t		pte_t
113 
114 #define	NPTESHIFT	10
115 #define	NPTEPERPT	1024	/* entries in page table */
116 #define	PTSIZE		(NPTEPERPT * MMU_PAGESIZE)	/* bytes mapped */
117 
118 #endif	/* PTE36 */
119 
120 #define	PTE_VALID	0x01
121 #define	PTE_LARGEPAGE	0x80
122 #define	PTE_SRWX	0x02
123 
124 #endif /* !_ASM */
125 
126 
127 #ifdef	__cplusplus
128 }
129 #endif
130 
131 #endif /* !_IA32_SYS_PTE_H */
132