summaryrefslogtreecommitdiffstats
path: root/man2/cacheflush.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/cacheflush.2')
-rw-r--r--man2/cacheflush.261
1 files changed, 59 insertions, 2 deletions
diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
index c687db242..d445befd8 100644
--- a/man2/cacheflush.2
+++ b/man2/cacheflush.2
@@ -22,7 +22,7 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
-.TH CACHEFLUSH 2 2017-09-15 "Linux" "Linux Programmer's Manual"
+.TH CACHEFLUSH 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.SH NAME
cacheflush \- flush contents of instruction and/or data cache
.SH SYNOPSIS
@@ -31,6 +31,10 @@ cacheflush \- flush contents of instruction and/or data cache
.PP
.BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
.fi
+.PP
+.IR Note :
+On some architectures,
+there is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
.BR cacheflush ()
flushes the contents of the indicated cache(s) for the
@@ -86,6 +90,59 @@ On Linux, this call first appeared on the MIPS architecture,
but nowadays, Linux provides a
.BR cacheflush ()
system call on some other architectures, but with different arguments.
+.SH NOTES
+.SS Architecture-specific variants
+Glibc provides a wrapper for this system call,
+with the prototype shown in SYNOPSIS,
+for the following architectures:
+ARC, CSKY, MIPS, and NIOS2.
+.PP
+On some other architectures,
+Linux provides this system call, with different arguments:
+.TP
+M68K:
+.nf
+.BI "int cacheflush(unsigned long " addr ", int " scope ", int " cache ,
+.BI " unsigned long " len );
+.fi
+.TP
+SH:
+.nf
+.BI "int cacheflush(unsigned long " addr ", unsigned long " len ", int " op );
+.fi
+.TP
+NDS32:
+.nf
+.BI "int cacheflush(unsigned int " start ", unsigned int " end ", int " cache );
+.fi
+.PP
+On the above architectures,
+glibc does not provide a wrapper for this system call; call it using
+.BR syscall (2).
+.SS GCC alternative
+Unless you need the finer grained control that this system call provides,
+you probably want to use the GCC built-in function
+.BR __builtin___clear_cache (),
+which provides a portable interface
+across platforms supported by GCC and compatible compilers:
+.PP
+.in +4n
+.EX
+.BI "void __builtin___clear_cache(void *" begin ", void *" end );
+.EE
+.in
+.PP
+On platforms that don't require instruction cache flushes,
+.BR __builtin___clear_cache ()
+has no effect.
+.PP
+.IR Note :
+On some GCC-compatible compilers,
+the prototype for this built-in function uses
+.I char *
+instead of
+.I void *
+for the parameters.
.SH BUGS
Linux kernels older than version 2.6.11 ignore the
.I addr
@@ -102,7 +159,7 @@ argument and does not do any error checking on the
.I cache
argument.
.SH COLOPHON
-This page is part of release 5.09 of the Linux
+This page is part of release 5.10 of the Linux
.I man-pages
project.
A description of the project,