man-pages/man2/cacheflush.2.html
2021-03-31 01:06:50 +01:00

170 lines
3.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CACHEFLUSH</TITLE>
</HEAD><BODY>
<H1>CACHEFLUSH</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
cacheflush - flush contents of instruction and/or data cache
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/asm/cachectl.h">asm/cachectl.h</A>&gt;</B>
<B>int cacheflush(char *</B><I>addr</I><B>, int nbytes</B><I>, int cache</I><B>);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>cacheflush</B>()
flushes the contents of the indicated cache(s) for the
user addresses in the range
<I>addr</I>
to
<I>(addr+nbytes-1)</I>.
<I>cache</I>
may be one of:
<DL COMPACT>
<DT id="1"><B>ICACHE</B>
<DD>
Flush the instruction cache.
<DT id="2"><B>DCACHE</B>
<DD>
Write back to memory and invalidate the affected valid cache lines.
<DT id="3"><B>BCACHE</B>
<DD>
Same as
<B>(ICACHE|DCACHE)</B>.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<B>cacheflush</B>()
returns 0 on success or -1 on error.
If errors are detected,
<I>errno</I>
will indicate the error.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="4"><B>EFAULT</B>
<DD>
Some or all of the address range
<I>addr</I>
to
<I>(addr+nbytes-1)</I>
is not accessible.
<DT id="5"><B>EINVAL</B>
<DD>
<I>cache</I>
is not one of
<B>ICACHE</B>,
<B>DCACHE</B>,
or
<B>BCACHE</B>
(but see BUGS).
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>CONFORMING TO</H2>
Historically, this system call was available on all MIPS UNIX variants
including RISC/os, IRIX, Ultrix, NetBSD, OpenBSD, and FreeBSD
(and also on some non-UNIX MIPS operating systems), so that
the existence of this call in MIPS operating systems is a de-facto
standard.
<A NAME="lbAH">&nbsp;</A>
<H3>Caveat</H3>
<B>cacheflush</B>()
should not be used in programs intended to be portable.
On Linux, this call first appeared on the MIPS architecture,
but nowadays, Linux provides a
<B>cacheflush</B>()
system call on some other architectures, but with different arguments.
<A NAME="lbAI">&nbsp;</A>
<H2>BUGS</H2>
Linux kernels older than version 2.6.11 ignore the
<I>addr</I>
and
<I>nbytes</I>
arguments, making this function fairly expensive.
Therefore, the whole cache is always flushed.
<P>
This function always behaves as if
<B>BCACHE</B>
has been passed for the
<I>cache</I>
argument and does not do any error checking on the
<I>cache</I>
argument.
<A NAME="lbAJ">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="6"><A HREF="#lbAB">NAME</A><DD>
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="9"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="10"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="11"><A HREF="#lbAG">CONFORMING TO</A><DD>
<DL>
<DT id="12"><A HREF="#lbAH">Caveat</A><DD>
</DL>
<DT id="13"><A HREF="#lbAI">BUGS</A><DD>
<DT id="14"><A HREF="#lbAJ">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:32 GMT, March 31, 2021
</BODY>
</HTML>