diff mbox series

[v6] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative

Message ID 20201215133019.14411-1-alx.manpages@gmail.com
State New
Headers show
Series [v6] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative | expand

Commit Message

Alejandro Colomar Dec. 15, 2020, 1:30 p.m. UTC
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(+)

Comments

Alejandro Colomar Dec. 20, 2020, 3:35 p.m. UTC | #1
Ping

On 12/15/20 2:30 PM, Alejandro Colomar wrote:
> 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
>
Michael Kerrisk \(man-pages\) Dec. 20, 2020, 8:48 p.m. UTC | #2
On 12/15/20 2:30 PM, Alejandro Colomar wrote:
> 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 *'.

Thanks, Alex. Patch applied.

Cheers,

Michael

>  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
>
diff mbox series

Patch

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