CACHEFLUSH(3)             OpenBSD Programmer's Manual            CACHEFLUSH(3)

NAME
     cacheflush, _flush_cache - CPU cache synchronization functions

SYNOPSIS
     #include <machine/sysarch.h>

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

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

DESCRIPTION
     cacheflush() allows a process to synchronize the contents of the proces-
     sor caches with main memory.  Since MIPS processors have separate in-
     struction 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:

        ICACHE     synchronize the instruction cache
        DCACHE     synchronize the data cache
        BCACHE     synchronize both the instruction and data caches

     _flush_cache is an alias for the cacheflush function.

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

ERRORS
     cacheflush will fail if:

     [EFAULT]      The address range specified by addr and nbytes is not part
                   of the process allocated address space.

     [EINVAL]      cache is not valid.

OpenBSD 4.7                   September 27, 2009                             1
