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