8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / uts / intel / ia32 / sys / pte.h
blob138647347a712dc1b0a0c2963a019669994aaab7
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _IA32_SYS_PTE_H
27 #define _IA32_SYS_PTE_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #ifndef _ASM
32 #include <sys/types.h>
33 #endif /* _ASM */
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 #ifndef _ASM
41 #ifdef PTE36 /* PTE36 ---------------------------- */
43 typedef uint64_t pteval_t;
44 typedef pteval_t *pteptr_t;
46 #define PRPTEx "llx"
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;
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;
75 * An easy way to ensure that
76 * reserved bits are zero.
78 } pte_t;
80 struct pte64 {
81 uint32_t pte64_0_31;
82 uint32_t pte64_32_64;
85 #define NPTESHIFT 9
86 #define NPTEPERPT 512 /* entries in page table */
87 #define PTSIZE (NPTEPERPT * MMU_PAGESIZE) /* bytes mapped */
90 #else /* PTE36 */
91 /* PTE32 ---------------------------- */
94 typedef uint32_t pteval_t;
95 typedef pteval_t *pteptr_t;
97 #define PRPTEx "x"
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;
112 #define pte32_t pte_t
114 #define NPTESHIFT 10
115 #define NPTEPERPT 1024 /* entries in page table */
116 #define PTSIZE (NPTEPERPT * MMU_PAGESIZE) /* bytes mapped */
118 #endif /* PTE36 */
120 #define PTE_VALID 0x01
121 #define PTE_LARGEPAGE 0x80
122 #define PTE_SRWX 0x02
124 #endif /* !_ASM */
127 #ifdef __cplusplus
129 #endif
131 #endif /* !_IA32_SYS_PTE_H */