OEMCacheRangeFlush (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This function is used by the kernel to flush or invalidate a certain range of the cache or translation look-aside buffer (TLB). OEMs must implement this function in the OAL.

void OEMCacheRangeFlush(
  LPVOID pAddr,
  DWORD dwLength,
  DWORD dwFlags 


[in] Starting virtual address where the cache operation is to be performed. The cache operation is specified by the value in the dwFlags parameter.
[in] Specifies the length, in bytes.
[in] Specifies the operations to be performed.

You can specify the following values for the dwFlags parameter.

CACHE_SYNC_WRITEBACKWrite back cached data.
CACHE_SYNC_DISCARDWrite back and discard cached data.
CACHE_SYNC_INSTRUCTIONSDiscard all cached instructions.
CACHE_SYNC_FLUSH_I_TLBFlush the instruction TLB.
CACHE_SYNC_FLUSH_TLBFlush both the instruction and data TLBs.
CACHE_SYNC_L2_WRITEBACKWrite back the L2 cache.
CACHE_SYNC_L2_DISCARDWrite back and discard the L2 cache.
CACHE_SYNC_ALLPerform all of the above operations.

Return Values



This function replaces calls to FlushDCache, FlushICache, and TLBClear in Windows CE .NET 4.2 and later.

pAddr=NULL and dwLength=0 is a special case, which means all addresses.

For example, the call OEMCacheRangeFlush(NULL, 0, CACHE_SYNC_FLUSH_TLB) flushes the data in the TLB. OEMCacheRangeFlush(NULL, 0, CACHE_SYNC_DISCARD) writes back and discards everything in the data cache.

Operations can also be combined. For example, the call OEMCacheRangeFlush(NULL, 0, CACHE_SYNC_FLUSH_TLB | CACHE_SYNC_DISCARD | CACHE_SYNC_INSTRUCTIONS) writes back and discards the entire data cache, invalidates the entire instruction cache, and flushes the instruction and data TLBs.

If the memory management unit (MMU) supports probing, the special case where dwLength==PAGE_SIZE might be useful because it is commonly used when paging code.

In general, if you are implementing this function you should perform TLB flushes at the end of the function. For example, if dwFlags==(CACHE_SYNC_DISCARD|CACHE_SYNC_FLUSH_TLB), the cache discard operation is usually performed before the TLB flush.


OS Versions: Windows CE .NET 4.2 and later.
Header: Developer defined.
Link Library: Not applicable.

See Also

CacheRangeFlush | FlushDCache | FlushICache | TLBClear | Cache Flush Routines | OEMCacheRangeFlush Function Implementation

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.