Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

flush.c File Reference

#include "ki.h"

Go to the source code of this file.

Functions

VOID KeInvalidateAllCachesTarget (IN PKIPI_CONTEXT SignalDone, IN PVOID Parameter1, IN PVOID Parameter2, IN PVOID Parameter3)
BOOLEAN KeInvalidateAllCaches (IN BOOLEAN AllProcessors)

Variables

ULONG KeI386CpuType


Function Documentation

BOOLEAN KeInvalidateAllCaches IN BOOLEAN  AllProcessors  ) 
 

Definition at line 187 of file i386/flush.c.

References _KPROCESS::ActiveProcessors, FALSE, KeActiveProcessors, KeGetCurrentPrcb, KeI386CpuType, KeInvalidateAllCachesTarget(), KiIpiStallOnPacketTargets(), KiLockContextSwap, KiUnlockContextSwap, NULL, and TRUE.

Referenced by MiMapLockedPagesInUserSpace(), MiMapSinglePage(), MiMapViewOfPhysicalSection(), MmMapIoSpace(), and MmMapLockedPagesSpecifyCache().

00192 : 00193 00194 This function writes back and invalidates the cache on all processors 00195 that are currently running threads which are children of the current 00196 process or on all processors in the host configuration. 00197 00198 Arguments: 00199 00200 AllProcessors - Supplies a boolean value that determines which data 00201 caches are flushed. 00202 00203 Return Value: 00204 00205 TRUE if the invalidation was done, FALSE otherwise. 00206 00207 --*/ 00208 { 00209 PKPRCB Prcb; 00210 PKPROCESS Process; 00211 KIRQL OldIrql; 00212 KAFFINITY TargetProcessors; 00213 00214 // 00215 // Support for wbinvd on Pentium based platforms is vendor dependent. 00216 // Check for family first and support on Pentium Pro based platforms 00217 // onward. 00218 // 00219 00220 if (KeI386CpuType < 6 ) { 00221 return FALSE; 00222 } 00223 00224 #ifndef NT_UP 00225 // 00226 // Compute target set of processors. 00227 // 00228 00229 KiLockContextSwap(&OldIrql); 00230 Prcb = KeGetCurrentPrcb(); 00231 if (AllProcessors) { 00232 TargetProcessors = KeActiveProcessors; 00233 } else { 00234 Process = Prcb->CurrentThread->ApcState.Process; 00235 TargetProcessors = Process->ActiveProcessors; 00236 } 00237 00238 TargetProcessors &= ~Prcb->SetMember; 00239 00240 // 00241 // If any target processors are specified, then send writeback 00242 // invalidate packet to the target set of processors. 00243 // 00244 00245 if (TargetProcessors != 0) { 00246 KiIpiSendSynchronousPacket(Prcb, 00247 TargetProcessors, 00248 KeInvalidateAllCachesTarget, 00249 (PVOID)&Prcb->ReverseStall, 00250 NULL, 00251 NULL); 00252 00253 KiIpiStallOnPacketTargets(TargetProcessors); 00254 } 00255 00256 // 00257 // All target processors have written back and invalidated caches and 00258 // are waiting to proceed. Write back invalidate current cache and 00259 // then continue the execution of target processors. 00260 // 00261 #endif 00262 _asm { 00263 ; 00264 ; wbinvd 00265 ; 00266 00267 _emit 0Fh 00268 _emit 09h 00269 } 00270 00271 #ifndef NT_UP 00272 // 00273 // Wait until all target processors have finished and completed packet. 00274 // 00275 00276 if (TargetProcessors != 0) { 00277 Prcb->ReverseStall += 1; 00278 } 00279 00280 // 00281 // Release the context swap lock. 00282 // 00283 00284 KiUnlockContextSwap(OldIrql); 00285 00286 #endif 00287 00288 return TRUE; 00289 }

VOID KeInvalidateAllCachesTarget IN PKIPI_CONTEXT  SignalDone,
IN PVOID  Parameter1,
IN PVOID  Parameter2,
IN PVOID  Parameter3
 

Definition at line 292 of file i386/flush.c.

Referenced by KeInvalidateAllCaches().

00300 : 00301 00302 This is the target function for writing back and invalidating the cache. 00303 00304 Arguments: 00305 00306 SignalDone - Supplies a pointer to a variable that is cleared when the 00307 requested operation has been performed. 00308 00309 Proceed - pointer to flag to syncronize with 00310 00311 Return Value: 00312 00313 None. 00314 00315 --*/ 00316 { 00317 // 00318 // Write back invalidate current cache 00319 // 00320 00321 _asm { 00322 ; 00323 ; wbinvd 00324 ; 00325 00326 _emit 0Fh 00327 _emit 09h 00328 00329 } 00330 00331 KiIpiSignalPacketDoneAndStall (SignalDone, Proceed); 00332 } }


Variable Documentation

ULONG KeI386CpuType
 

Definition at line 41 of file i386/flush.c.


Generated on Sat May 15 19:43:43 2004 for test by doxygen 1.3.7