linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: Michael Kerrisk <mtk.manpages@gmail.com>,
	Dave Martin <Dave.Martin@arm.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	linux-man@vger.kernel.org, Martin Sebor <msebor@redhat.com>
Cc: Alejandro Colomar <alx.manpages@gmail.com>,
	Vineet Gupta <vgupta@synopsys.com>,
	linux-snps-arc@lists.infradead.org, Guo Ren <guoren@kernel.org>,
	linux-csky@vger.kernel.org,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-mips@vger.kernel.org, Nick Hu <nickhu@andestech.com>,
	Greentime Hu <green.hu@gmail.com>,
	Vincent Chen <deanbo422@gmail.com>,
	gcc-patches@gcc.gnu.org, cfe-users@lists.llvm.org,
	cfe-dev@lists.llvm.org
Subject: [PATCH v6] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative
Date: Tue, 15 Dec 2020 14:30:20 +0100	[thread overview]
Message-ID: <20201215133019.14411-1-alx.manpages@gmail.com> (raw)
In-Reply-To: <e2424619-2a5a-a44a-2dc0-a16310725250@gmail.com>

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Martin Sebor <msebor@redhat.com>
Cc: Dave Martin <Dave.Martin@arm.com>
---

v6:
- GCC has always exposed 'void *', as Martin Sebor noted.
  It's Clang (and maybe others) that (following GCC's docs)
  exposed 'char *'.

 man2/cacheflush.2 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
index aba625721..7a2eed506 100644
--- a/man2/cacheflush.2
+++ b/man2/cacheflush.2
@@ -86,6 +86,30 @@ 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
+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
-- 
2.29.2


  parent reply	other threads:[~2020-12-15 13:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 18:04 cacheflush.2 Heinrich Schuchardt
2020-12-09 18:34 ` cacheflush.2 Alejandro Colomar (man-pages)
2020-12-09 18:48   ` cacheflush.2 Heinrich Schuchardt
2020-12-09 19:15     ` cacheflush.2 Alejandro Colomar (man-pages)
2020-12-11 18:14       ` cacheflush.2 Alejandro Colomar (man-pages)
2020-12-14 21:13         ` cacheflush.2 Martin Sebor
2020-12-14 22:34           ` cacheflush.2 Alejandro Colomar (man-pages)
2020-12-18 10:42             ` Ping: cacheflush.2 Alejandro Colomar (man-pages)
2020-12-18 16:51               ` Martin Sebor
2020-12-19 14:04                 ` Alejandro Colomar (man-pages)
2020-12-10 18:17   ` cacheflush.2 Dave Martin
2020-12-10 19:20     ` cacheflush.2 Heinrich Schuchardt
2020-12-10 20:56       ` RFC v2: cacheflush.2 Alejandro Colomar (man-pages)
2020-12-11  8:15         ` Michael Kerrisk (man-pages)
2020-12-11 18:02           ` Alejandro Colomar (man-pages)
2020-12-11 18:22             ` RFC v3: " Alejandro Colomar (man-pages)
2020-12-11 18:26               ` RFC v4: " Alejandro Colomar (man-pages)
2020-12-14 11:43                 ` [PATCH v5] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative Alejandro Colomar
2020-12-14 12:00                   ` Heinrich Schuchardt
2020-12-15 13:30                 ` Alejandro Colomar [this message]
2020-12-20 15:35                   ` Ping: [PATCH v6] " Alejandro Colomar (man-pages)
2020-12-20 20:48                   ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201215133019.14411-1-alx.manpages@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=Dave.Martin@arm.com \
    --cc=cfe-dev@lists.llvm.org \
    --cc=cfe-users@lists.llvm.org \
    --cc=deanbo422@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=green.hu@gmail.com \
    --cc=guoren@kernel.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=msebor@redhat.com \
    --cc=mtk.manpages@gmail.com \
    --cc=nickhu@andestech.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vgupta@synopsys.com \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).