On 12/10/20 7:17 PM, Dave Martin wrote:
On Wed, Dec 09, 2020 at 07:34:09PM +0100, Alejandro Colomar (man-pages) wrote:
Hi Heinrich & Michael,
What about the following?:
[
NOTES
GCC provides a similar function, which may be useful on archi‐
tectures that lack this system call:
void __builtin___clear_cache(void *begin, void *end);
]
Cheers,
Alex
Maybe we should discourage people from calling the cacheflush syscall?
I think that people shouldn't be using the syscall unless they really
need the finer grained control it provides, and are prepared to take a
hit to portability.
(On arches where userspace is allowed to do cache flushing directly,
__builtin___clear_cache() should transparently do the right thing, with
no syscall overhead -- if not, that's probably a bug in the toolchain or
compiler support library.)
What the compiler builtin does depends on the architecture (e.g. nothing
for x86, cacheflush() for MIPS, a private syscall (0xf0002) on ARM,
assembly code on ARM64, ...) and on the the operating system (Linux,
BSD, OS X). For portable code the builtin is really the best choice.
Best regards
Heinrich
[...]
Cheers
---Dave