]> git.saurik.com Git - apple/libc.git/blame - sys/cache.3
Libc-498.1.5.tar.gz
[apple/libc.git] / sys / cache.3
CommitLineData
224c7076
A
1.Dd September 21, 2006
2.Dt CACHE 3
3.Os Darwin
4.Sh NAME
5.Nm sys_cache_control ,
6.Nm sys_icache_invalidate ,
7.Nm sys_dcache_flush
8.Nd cache control
9.Sh LIBRARY
10.Lb libc
11.Sh SYNOPSIS
12.In libkern/OSCacheControl.h
13.Ft int
14.Fn sys_cache_control "int function" "void *start" "size_t len"
15.Ft void
16.Fn sys_icache_invalidate "void *start" "size_t len"
17.Ft void
18.Fn sys_dcache_flush "void *start" "size_t len"
19.Sh DESCRIPTION
20.Pp
21These functions operate on every cache line containing one of the
22.Fa len
23bytes of memory pointed to by
24.Fa start .
25Normally the operations apply to every
26processor in the system, but the exact semantics of these
27operations is platform dependent. They should be used with caution.
28.Pp
29.Fn sys_cache_control
30performs the operation specified by
31.Fa function .
32Refer to the header file for a list of currently supported functions.
33.Pp
34.Fn sys_icache_invalidate
35prepares memory for execution, typically by invalidating the instruction
36cache for the indicated range. This should be called
37after writing machine instructions to memory, and before
38executing them. On IA32 processors this function is a NOP, because
39their instruction caches are coherent.
40.Pp
41.Fn sys_dcache_flush
42writes modified data cache lines to main memory,
43and then invalidates all lines in the range being operated on.
44It can be useful when dealing with cache incoherent
45devices or DMA.
46.Sh RETURN VALUES
47.Fn sys_cache_control
48returns zero on success, ENOTSUP if
49.Fa function
50is not valid.
51.Sh SEE ALSO
52.Xr atomic 3 ,
53.Xr barrier 3
54.Sh HISTORY
55These functions first appeared in Mac OS 10.5 (Leopard).