Updated: April 19, 2023 |
Invalidate cache lines associated with a data buffer
#include <sys/cache.h> CACHE_INVAL(struct cache_ctrl *cinfo, void *vaddr, uint64_t paddr, size_t len);
This macro is used to invalidate any cache lines associated with a data buffer. This routine ensures that any subsequent modifications that are made to the data by an external device will be not be corrupted by the CPU writing back cached data to the memory, and ensures that once the data has been modified, the CPU will fetch the updated data from memory, instead of retrieving stale data from the cache.
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_INVAL() is implemented as a macro.