[NDK]
[reactos.git] / reactos / include / ndk / arm / mmtypes.h
1 /*++ NDK Version: 0095
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 mmtypes.h (ARM)
8
9 Abstract:
10
11 ARM Type definitions for the Memory Manager
12
13 Author:
14
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16
17 --*/
18
19 #ifndef _ARM_MMTYPES_H
20 #define _ARM_MMTYPES_H
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 //
27 // Dependencies
28 //
29
30 //
31 // Page-related Macros
32 //
33 #ifndef PAGE_SIZE
34 #define PAGE_SIZE 0x1000
35 #endif
36 #define PAGE_SHIFT 12L
37 #define MM_ALLOCATION_GRANULARITY 0x10000
38 #define MM_ALLOCATION_GRANULARITY_SHIFT 16L
39 #define MM_PAGE_FRAME_NUMBER_SIZE 20
40
41 //
42 // Sanity checks for Paging Macros
43 //
44 #ifdef C_ASSERT
45 C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT));
46 C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT));
47 C_ASSERT(MM_ALLOCATION_GRANULARITY &&
48 !(MM_ALLOCATION_GRANULARITY & (MM_ALLOCATION_GRANULARITY - 1)));
49 C_ASSERT(MM_ALLOCATION_GRANULARITY >= PAGE_SIZE);
50 #endif
51
52 //
53 // Page Table Entry Definitions
54 //
55 typedef struct _HARDWARE_PDE_ARMV6
56 {
57 ULONG Valid:1; // Only for small pages
58 ULONG LargePage:1; // Note, if large then Valid = 0
59 ULONG Buffered:1;
60 ULONG Cached:1;
61 ULONG NoExecute:1;
62 ULONG Domain:4;
63 ULONG Ecc:1;
64 ULONG PageFrameNumber:22;
65 } HARDWARE_PDE_ARMV6, *PHARDWARE_PDE_ARMV6;
66
67 typedef struct _HARDWARE_LARGE_PTE_ARMV6
68 {
69 ULONG Valid:1; // Only for small pages
70 ULONG LargePage:1; // Note, if large then Valid = 0
71 ULONG Buffered:1;
72 ULONG Cached:1;
73 ULONG NoExecute:1;
74 ULONG Domain:4;
75 ULONG Ecc:1;
76 ULONG Sbo:1;
77 ULONG Owner:1;
78 ULONG CacheAttributes:3;
79 ULONG ReadOnly:1;
80 ULONG Shared:1;
81 ULONG NonGlobal:1;
82 ULONG SuperLagePage:1;
83 ULONG Reserved:1;
84 ULONG PageFrameNumber:12;
85 } HARDWARE_LARGE_PTE_ARMV6, *PHARDWARE_LARGE_PTE_ARMV6;
86
87 typedef struct _HARDWARE_PTE_ARMV6
88 {
89 ULONG NoExecute:1;
90 ULONG Valid:1;
91 ULONG Buffered:1;
92 ULONG Cached:1;
93 ULONG Sbo:1;
94 ULONG Owner:1;
95 ULONG CacheAttributes:3;
96 ULONG ReadOnly:1;
97 ULONG Shared:1;
98 ULONG NonGlobal:1;
99 ULONG PageFrameNumber:20;
100 } HARDWARE_PTE_ARMV6, *PHARDWARE_PTE_ARMV6;
101
102 C_ASSERT(sizeof(HARDWARE_PDE_ARMV6) == sizeof(ULONG));
103 C_ASSERT(sizeof(HARDWARE_LARGE_PTE_ARMV6) == sizeof(ULONG));
104 C_ASSERT(sizeof(HARDWARE_PTE_ARMV6) == sizeof(ULONG));
105
106 typedef struct _MMPTE_SOFTWARE
107 {
108 ULONG Valid:2;
109 ULONG PageFileLow:4;
110 ULONG Protection:4;
111 ULONG Prototype:1;
112 ULONG Transition:1;
113 ULONG PageFileHigh:20;
114 } MMPTE_SOFTWARE;
115
116 typedef struct _MMPTE_TRANSITION
117 {
118 ULONG Valid:2;
119 ULONG Buffered:1;
120 ULONG Cached:1;
121 ULONG Owner:1;
122 ULONG Protection:4;
123 ULONG ReadOnly:1;
124 ULONG Prototype:1;
125 ULONG Transition:1;
126 ULONG PageFrameNumber:20;
127 } MMPTE_TRANSITION;
128
129 typedef struct _MMPTE_PROTOTYPE
130 {
131 ULONG Valid:2;
132 ULONG ProtoAddressLow:7;
133 ULONG ReadOnly:1;
134 ULONG Prototype:1;
135 ULONG ProtoAddressHigh:21;
136 } MMPTE_PROTOTYPE;
137
138 typedef struct _MMPTE_SUBSECTION
139 {
140 ULONG Valid:2;
141 ULONG SubsectionAddressLow:4;
142 ULONG Protection:4;
143 ULONG Prototype:1;
144 ULONG SubsectionAddressHigh:20;
145 ULONG WhichPool:1;
146 } MMPTE_SUBSECTION;
147
148 typedef struct _MMPTE_LIST
149 {
150 ULONG Valid:2;
151 ULONG OneEntry:1;
152 ULONG filler0:8;
153 ULONG NextEntry:20;
154 ULONG Prototype:1;
155 } MMPTE_LIST;
156
157 typedef union _MMPTE_HARDWARE
158 {
159 ULONG NoExecute:1;
160 ULONG Valid:1;
161 ULONG Buffered:1;
162 ULONG Cached:1;
163 ULONG Sbo:1;
164 ULONG Owner:1;
165 ULONG CacheAttributes:3;
166 ULONG ReadOnly:1;
167 ULONG Prototype:1;
168 ULONG NonGlobal:1;
169 ULONG PageFrameNumber:20;
170 } MMPTE_HARDWARE, *PMMPTE_HARDWARE;
171
172 typedef union _MMPDE_HARDWARE
173 {
174 ULONG Valid:1;
175 ULONG LargePage:1;
176 ULONG Buffered:1;
177 ULONG Cached:1;
178 ULONG NoExecute:1;
179 ULONG Domain:4;
180 ULONG Ecc:1;
181 ULONG PageFrameNumber:22;
182 } MMPDE_HARDWARE, *PMMPDE_HARDWARE;
183
184 typedef struct _MMPDE
185 {
186 union
187 {
188 MMPDE_HARDWARE Hard;
189 ULONG Long;
190 } u;
191 } MMPDE, *PMMPDE;
192
193 //
194 // Use the right PTE structure
195 //
196 #define HARDWARE_PTE HARDWARE_PTE_ARMV6
197 #define PHARDWARE_PTE PHARDWARE_PTE_ARMV6
198
199 #ifdef __cplusplus
200 }; // extern "C"
201 #endif
202
203 #endif