]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Written by Ralf Baechle (ralf@waldorf-gmbh.de), |
2 | .\" Copyright (c) 1994, 1995 Waldorf GMBH | |
3 | .\" | |
1dd72f9c | 4 | .\" %%%LICENSE_START(GPLv2+_DOC_FULL) |
fea681da MK |
5 | .\" This is free documentation; you can redistribute it and/or |
6 | .\" modify it under the terms of the GNU General Public License as | |
7 | .\" published by the Free Software Foundation; either version 2 of | |
8 | .\" the License, or (at your option) any later version. | |
9 | .\" | |
10 | .\" The GNU General Public License's references to "object code" | |
11 | .\" and "executables" are to be interpreted as the output of any | |
12 | .\" document formatting or typesetting system, including | |
13 | .\" intermediate and printed output. | |
14 | .\" | |
15 | .\" This manual is distributed in the hope that it will be useful, | |
16 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | .\" GNU General Public License for more details. | |
19 | .\" | |
20 | .\" You should have received a copy of the GNU General Public | |
c715f741 MK |
21 | .\" License along with this manual; if not, see |
22 | .\" <http://www.gnu.org/licenses/>. | |
6a8d8745 | 23 | .\" %%%LICENSE_END |
fea681da | 24 | .\" |
4b8c67d9 | 25 | .TH CACHEFLUSH 2 2017-09-15 "Linux" "Linux Programmer's Manual" |
fea681da MK |
26 | .SH NAME |
27 | cacheflush \- flush contents of instruction and/or data cache | |
28 | .SH SYNOPSIS | |
29 | .nf | |
30 | .B #include <asm/cachectl.h> | |
68e4db0a | 31 | .PP |
fea681da MK |
32 | .BI "int cacheflush(char *" addr ", int "nbytes ", int "cache ); |
33 | .fi | |
34 | .SH DESCRIPTION | |
e511ffb6 | 35 | .BR cacheflush () |
988db661 | 36 | flushes the contents of the indicated cache(s) for the |
0cff29b7 MK |
37 | user addresses in the range |
38 | .I addr | |
988db661 | 39 | to |
0cff29b7 | 40 | .IR (addr+nbytes-1) . |
0daa9e92 | 41 | .I cache |
0cff29b7 | 42 | may be one of: |
fea681da MK |
43 | .TP |
44 | .B ICACHE | |
45 | Flush the instruction cache. | |
46 | .TP | |
47 | .B DCACHE | |
48 | Write back to memory and invalidate the affected valid cache lines. | |
49 | .TP | |
50 | .B BCACHE | |
c13182ef | 51 | Same as |
14ee3bff | 52 | .BR (ICACHE|DCACHE) . |
47297adb | 53 | .SH RETURN VALUE |
e511ffb6 | 54 | .BR cacheflush () |
c13182ef MK |
55 | returns 0 on success or \-1 on error. |
56 | If errors are detected, | |
57 | .I errno | |
58 | will indicate the error. | |
fea681da MK |
59 | .SH ERRORS |
60 | .TP | |
61 | .B EFAULT | |
988db661 | 62 | Some or all of the address range |
0cff29b7 | 63 | .I addr |
988db661 | 64 | to |
0cff29b7 MK |
65 | .I (addr+nbytes-1) |
66 | is not accessible. | |
fea681da MK |
67 | .TP |
68 | .B EINVAL | |
0cff29b7 | 69 | .I cache |
988db661 | 70 | is not one of |
0cff29b7 | 71 | .BR ICACHE , |
988db661 MK |
72 | .BR DCACHE , |
73 | or | |
5d28ea3e | 74 | .BR BCACHE |
7949b871 | 75 | (but see BUGS). |
0cff29b7 | 76 | .SH CONFORMING TO |
d5e8624c | 77 | Historically, this system call was available on all MIPS UNIX variants |
7bbc267a RB |
78 | including RISC/os, IRIX, Ultrix, NetBSD, OpenBSD, and FreeBSD |
79 | (and also on some non-UNIX MIPS operating systems), so that | |
80 | the existence of this call in MIPS operating systems is a de-facto | |
81 | standard. | |
82 | .SS Caveat | |
83 | .BR cacheflush () | |
84 | should not be used in programs intended to be portable. | |
266df083 | 85 | On Linux, this call first appeared on the MIPS architecture, |
7bbc267a RB |
86 | but nowadays, Linux provides a |
87 | .BR cacheflush () | |
88 | system call on some other architectures, but with different arguments. | |
fea681da | 89 | .SH BUGS |
7bbc267a | 90 | Linux kernels older than version 2.6.11 ignore the |
c13182ef MK |
91 | .I addr |
92 | and | |
93 | .I nbytes | |
7bbc267a | 94 | arguments, making this function fairly expensive. |
9b8ff97a | 95 | Therefore, the whole cache is always flushed. |
efeece04 | 96 | .PP |
d5e8624c | 97 | This function always behaves as if |
7bbc267a RB |
98 | .BR BCACHE |
99 | has been passed for the | |
100 | .I cache | |
101 | argument and does not do any error checking on the | |
102 | .I cache | |
103 | argument. |