CACHEFLUSH(2) CACHEFLUSH(2)
cacheflush, _flush_cache - flush contents of instruction and/or data
cache
#include <sys/cachectl.h>
int cacheflush (void *addr, int nbytes, int cache);
int _flush_cache (char *addr, int nbytes, int cache);
cacheflush and _flush_cache are different names for the same function.
They flush the contents of the indicated cache(s) for user addresses in
the range addr to (addr+nbytes-1). The cache parameter may be one of:
ICACHE Flush only the instruction cache
DCACHE Flush only the data cache
BCACHE Flush both the instruction and the data cache
cacheflush and _flush_cache return 0 when no errors are detected. If
errors are detected, they return -1 with the error cause indicated in
errno. For IP19, IP21 and IP25, the following describes the action of
this command on any physical lines corresponding to the input virtual
address range that may be present in the caches. On IP19 and IP25,
DCACHE flushing writes back any dirty data and invalidates the cache line
in the data and the secondary cache. ICACHE flushing on the IP19 and IP25
consists of invalidating the line in the icache and the secondary cache.
Additionally, prior to this, if the line is dirty in the dcache and/or
secondary, it is written back. On IP21s, DCACHE flushing is a no op, and
ICACHE flushing does not affect the gcache directly, but loads in a set
of different instructions into the icache. The BCACHE option in all
cases writes back the lines if they are dirty, and then invalidates them
if they are present in any of the caches (except for IP21s, where the
lines are displaced from the icache).
[EINVAL] The cache parameter is not one of ICACHE, DCACHE, or
BCACHE.
[EFAULT] Some or all of the address range addr to (addr+nbytes-1)
is not accessible.
cachectl(2)
PPPPaaaaggggeeee 1111 [ Back ]
|