OSStatus SetProcessorCacheMode(
AddressSpaceID theAddressSpace,
void *theBase,
ByteCount theLength,
ProcessorCacheMode theMode);
typedef unsigned long ProcessorCacheMode;
enum {
kProcessorCacheModeDefault = 0,
kProcessorCacheModeInhibited = 1,
kProcessorCacheModeWriteThrough = 2,
kProcessorCacheModeCopyBack = 3
};
The SetProcessorCacheMode function sets the cache mode of a specified range of address space. The theAddressSpace parameter specifies the address space containing the logical ranges to be set. Current versions of the Mac OS provide only one address space, which it automatically passes to native drivers through DoDriverIO. In general, a driver should always pass the address space it received as a parameter to its DoDriverIO routine in this field. Otherwise, the address space must be specified as kCurrentAddressSpaceID.
In early versions of the PCI-based Mac OS, SetProcessorCacheMode can be used on only one card in any given 256 MB segment of the effective address space above 0x7FFF FFFF. For example, if two PCI cards were configured at addresses 0x8001 2000 and 0x8034 5000, SetProcessorCacheMode could set the cache mode of only one card's address space. However, it could also set the mode of a card at 0xA001 0000, because that card's space lies in a different 256 MB segment of the system's effective address space. This restriction will be relaxed in future versions of Mac OS.
SetProcessorCacheMode may be called only from task level, not from secondary or hardware interrupt level.