syscall makes it failed to build on mips64 for mipsel:
compiler-rt/lib/builtins/clear_cache.c:97:3: error: call to undeclared function 'syscall'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] syscall(__NR_cacheflush, start, (end_int - start_int), BCACHE);
In this patch, we use rdhwr to get synci_step.
If synci_step is zero, it means that the hardware will maintain the coherence. We need to do nothing.
Then for r6+, synci is required to keep icache global.
So we can use synci to flush icache.
The ISA documents ask a sync and a jr.hb after synci.
For pre-r6, we can use cacheflush libc function, which is same on Linux and FreeBSD.
.
We don't need \n\t.
(It has some usefulness for multi-line asm but that cosmetic effect may not be needed)
Use asm volatile