1CACHEFLUSH(2) Linux Programmer's Manual CACHEFLUSH(2)
2
3
4
6 cacheflush - flush contents of instruction and/or data cache
7
9 #include <asm/cachectl.h>
10
11 int cacheflush(char *addr, int nbytes, int cache);
12
14 cacheflush() flushes the contents of the indicated cache(s) for the
15 user addresses in the range addr to (addr+nbytes-1). cache may be one
16 of:
17
18 ICACHE Flush the instruction cache.
19
20 DCACHE Write back to memory and invalidate the affected valid cache
21 lines.
22
23 BCACHE Same as (ICACHE|DCACHE).
24
26 cacheflush() returns 0 on success or -1 on error. If errors are
27 detected, errno will indicate the error.
28
30 EFAULT Some or all of the address range addr to (addr+nbytes-1) is not
31 accessible.
32
33 EINVAL cache is not one of ICACHE, DCACHE, or BCACHE (but see BUGS).
34
36 Historically, this system call was available on all MIPS UNIX variants
37 including RISC/os, IRIX, Ultrix, NetBSD, OpenBSD, and FreeBSD (and also
38 on some non-UNIX MIPS operating systems), so that the existence of this
39 call in MIPS operating systems is a de-facto standard.
40
41 Caveat
42 cacheflush() should not be used in programs intended to be portable.
43 On Linux, this call first appeared on the MIPS architecture, but nowa‐
44 days, Linux provides a cacheflush() system call on some other architec‐
45 tures, but with different arguments.
46
48 Linux kernels older than version 2.6.11 ignore the addr and nbytes
49 arguments, making this function fairly expensive. Therefore, the whole
50 cache is always flushed.
51
52 This function always behaves as if BCACHE has been passed for the cache
53 argument and does not do any error checking on the cache argument.
54
56 This page is part of release 5.02 of the Linux man-pages project. A
57 description of the project, information about reporting bugs, and the
58 latest version of this page, can be found at
59 https://www.kernel.org/doc/man-pages/.
60
61
62
63Linux 2017-09-15 CACHEFLUSH(2)