00001 00002 #define MAX_IDENTITYMAP_ALLOCATIONS 30 00003 00004 typedef struct _IDENTITY_MAP { 00005 PHARDWARE_PTE TopLevelDirectory; 00006 ULONG IdentityCR3; 00007 ULONG IdentityAddr; 00008 ULONG PagesAllocated; 00009 PVOID PageList[ MAX_IDENTITYMAP_ALLOCATIONS ]; 00010 } IDENTITY_MAP, *PIDENTITY_MAP; 00011 00012 00013 VOID 00014 Ki386ClearIdentityMap( 00015 PIDENTITY_MAP IdentityMap 00016 ); 00017 00018 VOID 00019 Ki386EnableTargetLargePage( 00020 PIDENTITY_MAP IdentityMap 00021 ); 00022 00023 BOOLEAN 00024 Ki386CreateIdentityMap( 00025 IN OUT PIDENTITY_MAP IdentityMap, 00026 IN PVOID StartVa, 00027 IN PVOID EndVa 00028 ); 00029 00030 BOOLEAN 00031 Ki386EnableCurrentLargePage ( 00032 IN ULONG IdentityAddr, 00033 IN ULONG IdentityCr3 00034 ); 00035 00036 extern PVOID Ki386EnableCurrentLargePageEnd; 00037 00038 #if defined(_X86PAE_) 00039 #define PPI_BITS 2 00040 #define PDI_BITS 9 00041 #define PTI_BITS 9 00042 #else 00043 #define PPI_BITS 0 00044 #define PDI_BITS 10 00045 #define PTI_BITS 10 00046 #endif 00047 00048 #define PPI_MASK ((1 << PPI_BITS) - 1) 00049 #define PDI_MASK ((1 << PDI_BITS) - 1) 00050 #define PTI_MASK ((1 << PTI_BITS) - 1) 00051 00052 #define KiGetPpeIndex(va) ((((ULONG)(va)) >> PPI_SHIFT) & PPI_MASK) 00053 #define KiGetPdeIndex(va) ((((ULONG)(va)) >> PDI_SHIFT) & PDI_MASK) 00054 #define KiGetPteIndex(va) ((((ULONG)(va)) >> PTI_SHIFT) & PTI_MASK)