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 // User space range limit 43 // 44 #define MI_HIGHEST_USER_ADDRESS (PVOID)0x7FFEFFFF 45 46 // 47 // Address of the shared user page 48 // 49 #define MM_SHARED_USER_DATA_VA 0x7FFE0000 50 51 // 52 // Sanity checks for Paging Macros 53 // 54 #ifdef C_ASSERT 55 C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT)); 56 C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT)); 57 C_ASSERT(MM_ALLOCATION_GRANULARITY && 58 !(MM_ALLOCATION_GRANULARITY & (MM_ALLOCATION_GRANULARITY - 1))); 59 C_ASSERT(MM_ALLOCATION_GRANULARITY >= PAGE_SIZE); 60 #endif 61 62 // 63 // Page Table Entry Definitions 64 // 65 typedef struct _HARDWARE_PDE_ARMV6 66 { 67 ULONG Valid:1; // Only for small pages 68 ULONG LargePage:1; // Note, if large then Valid = 0 69 ULONG Buffered:1; 70 ULONG Cached:1; 71 ULONG NoExecute:1; 72 ULONG Domain:4; 73 ULONG Ecc:1; 74 ULONG PageFrameNumber:22; 75 } HARDWARE_PDE_ARMV6, *PHARDWARE_PDE_ARMV6; 76 77 typedef struct _HARDWARE_LARGE_PTE_ARMV6 78 { 79 ULONG Valid:1; // Only for small pages 80 ULONG LargePage:1; // Note, if large then Valid = 0 81 ULONG Buffered:1; 82 ULONG Cached:1; 83 ULONG NoExecute:1; 84 ULONG Domain:4; 85 ULONG Ecc:1; 86 ULONG Sbo:1; // ULONG Accessed:1;? 87 ULONG Owner:1; 88 ULONG CacheAttributes:3; 89 ULONG ReadOnly:1; 90 ULONG Shared:1; 91 ULONG NonGlobal:1; 92 ULONG SuperLagePage:1; 93 ULONG Reserved:1; 94 ULONG PageFrameNumber:12; 95 } HARDWARE_LARGE_PTE_ARMV6, *PHARDWARE_LARGE_PTE_ARMV6; 96 97 typedef struct _HARDWARE_PTE_ARMV6 98 { 99 ULONG NoExecute:1; 100 ULONG Valid:1; 101 ULONG Buffered:1; 102 ULONG Cached:1; 103 ULONG Sbo:1; // ULONG Accessed:1;? 104 ULONG Owner:1; 105 ULONG CacheAttributes:3; 106 ULONG ReadOnly:1; 107 ULONG Shared:1; 108 ULONG NonGlobal:1; 109 ULONG PageFrameNumber:20; 110 } HARDWARE_PTE_ARMV6, *PHARDWARE_PTE_ARMV6; 111 112 C_ASSERT(sizeof(HARDWARE_PDE_ARMV6) == sizeof(ULONG)); 113 C_ASSERT(sizeof(HARDWARE_LARGE_PTE_ARMV6) == sizeof(ULONG)); 114 C_ASSERT(sizeof(HARDWARE_PTE_ARMV6) == sizeof(ULONG)); 115 116 typedef struct _MMPTE_SOFTWARE 117 { 118 ULONG Valid:2; 119 ULONG PageFileLow:4; 120 ULONG Protection:4; 121 ULONG Prototype:1; 122 ULONG Transition:1; 123 ULONG PageFileHigh:20; 124 } MMPTE_SOFTWARE; 125 126 typedef struct _MMPTE_TRANSITION 127 { 128 ULONG Valid:2; 129 ULONG Buffered:1; 130 ULONG Cached:1; 131 ULONG Owner:1; 132 ULONG Protection:4; 133 ULONG ReadOnly:1; 134 ULONG Prototype:1; 135 ULONG Transition:1; 136 ULONG PageFrameNumber:20; 137 } MMPTE_TRANSITION; 138 139 typedef struct _MMPTE_PROTOTYPE 140 { 141 ULONG Valid:2; 142 ULONG ProtoAddressLow:7; 143 ULONG ReadOnly:1; 144 ULONG Prototype:1; 145 ULONG ProtoAddressHigh:21; 146 } MMPTE_PROTOTYPE; 147 148 typedef struct _MMPTE_SUBSECTION 149 { 150 ULONG Valid:2; 151 ULONG SubsectionAddressLow:4; 152 ULONG Protection:4; 153 ULONG Prototype:1; 154 ULONG SubsectionAddressHigh:20; 155 ULONG WhichPool:1; 156 } MMPTE_SUBSECTION; 157 158 typedef struct _MMPTE_LIST 159 { 160 ULONG Valid:2; 161 ULONG OneEntry:1; 162 ULONG filler0:8; 163 ULONG NextEntry:20; 164 ULONG Prototype:1; 165 } MMPTE_LIST; 166 167 typedef struct _MMPTE_HARDWARE 168 { 169 ULONG NoExecute:1; 170 ULONG Valid:1; 171 ULONG Buffered:1; 172 ULONG Cached:1; 173 ULONG Sbo:1; 174 ULONG Owner:1; 175 ULONG CacheAttributes:3; 176 ULONG ReadOnly:1; 177 ULONG Prototype:1; 178 ULONG NonGlobal:1; 179 ULONG PageFrameNumber:20; 180 } MMPTE_HARDWARE, *PMMPTE_HARDWARE; 181 182 183 // 184 // Use the right PTE structure 185 // 186 #define HARDWARE_PTE HARDWARE_PTE_ARMV6 187 #define PHARDWARE_PTE PHARDWARE_PTE_ARMV6 188 189 typedef struct _MMPTE 190 { 191 union 192 { 193 ULONG_PTR Long; 194 HARDWARE_PTE Flush; 195 MMPTE_HARDWARE Hard; 196 MMPTE_PROTOTYPE Proto; 197 MMPTE_SOFTWARE Soft; 198 MMPTE_TRANSITION Trans; 199 MMPTE_SUBSECTION Subsect; 200 MMPTE_LIST List; 201 } u; 202 } MMPTE, *PMMPTE; 203 204 typedef union _MMPDE_HARDWARE 205 { 206 ULONG Valid:1; 207 ULONG LargePage:1; 208 ULONG Buffered:1; 209 ULONG Cached:1; 210 ULONG NoExecute:1; 211 ULONG Domain:4; 212 ULONG Ecc:1; 213 ULONG PageFrameNumber:22; 214 } MMPDE_HARDWARE, *PMMPDE_HARDWARE; 215 216 typedef struct _MMPDE 217 { 218 union 219 { 220 MMPDE_HARDWARE Hard; 221 ULONG Long; 222 } u; 223 } MMPDE, *PMMPDE; 224 225 #ifdef __cplusplus 226 }; // extern "C" 227 #endif 228 229 #endif 230