00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
#include "mi.h"
00024 
00025 
00026  
00027 
00028 
00029 
00030 
00031 typedef enum _MEM_TYPES {
00032     
RegularMemory,
00033     
MemoryMappedIo,
00034     
VideoDisplayBuffer,
00035     
IoPort,
00036     
RomMemory
00037 } 
MEM_TYPES;
00038 
00039 
00040 typedef struct _CACHE_ATTRIBUTE_DESCRIPTOR {
00041     LIST_ENTRY 
ListEntry;
00042     MEM_TYPES MemTypes;
00043     ULONG 
CacheAttribute;
00044     PFN_NUMBER 
BasePage;
00045     PFN_NUMBER 
PageCount;
00046 } 
CACHE_ATTRIBUTE_DESCRIPTOR, *
PCACHE_ATTRIBUTE_DESCRIPTOR;
00047 
00048 
00049 LIST_ENTRY 
MmCacheAttributeDescriptorListHead;
00050 
00051 
00052 
00053 
00054 
00055 ULONG 
MmDefaultCacheAttribute = MM_PTE_MA_WBU;   
00056 
00057 
00058 
00059 ULONG
00060 MiCheckMemoryAttribute(
00061    IN PFN_NUMBER PageFrameNumber
00062    )
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 {
00099    PLIST_ENTRY NextMd;
00100 
00101    NextMd = 
MmCacheAttributeDescriptorListHead.Flink;
00102 
00103    While (NextMd != 
MmCacheAttributeDescriptorListHead) {
00104 
00105        CacheAttributeDescriptor = CONTAINING_RECORD(NextMd,
00106                                                      
CACHE_ATTRIBUTE_DESCRIPTOR,
00107                                                      ListEntry);
00108 
00109        
if ((PageFrameNumber >= CacheAttributeDescriptor.BasePage) ||
00110            (PageFrameNumber < CacheAttributeDescriptor.PageCount)) {
00111 
00112            
return (CacheAttributeDescriptor.CacheAttribute);
00113            
00114        }
00115 
00116        NextMd = CacheAttributeDescriptor->ListEntry.Flink;
00117    }
00118 
00119    
00120    
00121    
00122    
00123           
00124    
return (
MmDefaultCacheAttribute);
00125 
00126 }
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 UCHAR 
MmDisableCache[16] = {0, 0, 0, 0, 0, 0, 0, 0
00135                            1, 1, 0, 1, 0, 1, 0, 0};
00136         
00137 
00138 
00139 MiDisableCaching(
00140     IN 
PMMPTE PointerPte;
00141     )
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 {
00165     ULONG CacheAttribute;
00166 
00167     CacheAttribute = 
MiCheckMemoryAttribute(TempPte.u.Hard.PageFrameNumber);
00168 
00169     
if (
MmDisableCache[CacheAttribute]) {
00170         
00171         
00172         
00173         
00174 
00175         PointerPte->u.Hard.MemAttribute = CacheAttribute;
00176 
00177     } 
else {
00178 
00179         
00180         
00181         
00182         
00183         
00184         
00185         PointerPte->u.Hard.MemAttribute = MM_PTE_MA_UCO;
00186 
00187     }
00188 }
00189 
00190 
00191 
00192