'\"macro stdmacro .TH CACHEFLUSH 2 .SH NAME cacheflush, _flush_cache \- flush contents of instruction and/or data cache .SH SYNOPSIS .B "#include " .sp .B "int cacheflush (void \(**addr, int nbytes, int cache);" .sp .B "int _flush_cache (char \(**addr, int nbytes, int cache);" .SH DESCRIPTION \f2cacheflush\f1 and \f2_flush_cache\f1 are different names for the same function. They flush the contents of the indicated cache(s) for user addresses in the range \f2addr\f1 to (\f2addr\f1+\f2nbytes\f1-1). The .I cache parameter may be one of: .TP 17 .B ICACHE Flush only the instruction cache .TP .B DCACHE Flush only the data cache .TP .B BCACHE Flush both the instruction and the data cache .SH "RETURN VALUE" .I cacheflush and .I _flush_cache return 0 when no errors are detected. If errors are detected, they return \-1 with the error cause indicated in \f2errno\f1. 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). .SH ERRORS .TP 17 .SM [EINVAL] The .I cache parameter is not one of ICACHE, DCACHE, or BCACHE. .TP .SM [EFAULT] Some or all of the address range .I addr to (\f2addr\f1+\f2nbytes\f1-1) is not accessible. .SH "SEE ALSO" cachectl(2)