Updated: April 19, 2023 |
Flush cache lines associated with a data buffer
#include <sys/cache.h> CACHE_FLUSH(struct cache_ctrl *cinfo, void *vaddr, uint64_t paddr, size_t len);
This macro is used to flush any cache lines associated with a data buffer out to memory. This routine ensures that any modifications that have been made to the data by the CPU will be reflected by the contents of memory, and thus an external device reading the data won't retrieve stale data. For more information about cache coherency, see the entry for cache_init().
Depending on the architecture and the cache callouts (see Cache control in the Kernel Callouts chapter of Building Embedded Systems), the calling thread might need to obtain I/O privileges before using the CACHE_*() macros. If so, then:
ThreadCtl( _NTO_TCTL_IO_LEVEL, (void*)_NTO_IO_LEVEL_1 );
Failing to do so may result in a SIGILL (illegal instruction) signal.
The following environment variables, if they exist, affect the behavior of this function:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |
CACHE_FLUSH() is implemented as a macro.