#include <libkern/OSCacheControl.h>

libkern/OSCacheControl.h

Functions performed by sys_cache_control():
includes: stddef.h, sys/cdefs.h, stdint.h, Availability.h
3 functions · 2 macros

macrokCacheFunctionPrepareForExecution

Prepare memory for execution. This should be called after writing machine instructions to memory, before executing them. It syncs the dcache and icache. On IA32 processors this function is a NOP, because no synchronization is required.
#define kCacheFunctionPrepareForExecution 1

macrokCacheFunctionFlushDcache

Flush data cache(s). This ensures that cached data makes it all the way out to DRAM, and then removes copies of the data from all processor caches. It can be useful when dealing with cache incoherent devices or DMA.
#define kCacheFunctionFlushDcache 2

functionsys_cache_control

__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0)
int sys_cache_control(int function, void *start, size_t len)
perform one of the above cache functions:
man page · September 21, 2006
sys_cache_control(3) — cache control

functionsys_icache_invalidate

__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0)
void sys_icache_invalidate(void *start, size_t len)
equivalent to sys_cache_control(kCacheFunctionPrepareForExecution):
man page · September 21, 2006
sys_icache_invalidate(3) — cache control

functionsys_dcache_flush

__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0)
void sys_dcache_flush(void *start, size_t len)
equivalent to sys_cache_control(kCacheFunctionFlushDcache):
man page · September 21, 2006
sys_dcache_flush(3) — cache control