cacheflush(3) – loongson CPU cache synchronization functions
cacheflush(3) – octeon CPU cache synchronization functions
CACHEFLUSH(3) Library Functions Manual (mips64) CACHEFLUSH(3)

cacheflush, _flush_cacheCPU cache synchronization functions

#include <machine/sysarch.h>

int
cacheflush(void *addr, int nbytes, int cache);

int
_flush_cache(char *addr, int nbytes, int cache);

() allows a process to synchronize the contents of the processor caches with main memory. Since MIPS processors have separate instruction and data caches, this function allows for dynamically generated code to run correctly.

cacheflush operates on a contiguous memory range in the current process address space, starting at address addr and nbytes bytes long. The caches to be synchronized are specified in the cache argument with one of the following values:

synchronize the instruction cache
synchronize the data cache
synchronize both the instruction and data caches

_flush_cache is an alias for the cacheflush function.

Upon successful completion, cacheflush returns zero. Otherwise, a value of -1 is returned and errno is set to indicate the error.

cacheflush will fail if:

[]
The address range specified by addr and nbytes is not part of the process allocated address space.
[]
cache is not valid.
September 26, 2010 OpenBSD 7.6