April 2012
Intermediate to advanced
352 pages
8h
English
Sequences of read and write instructions can often be executed more quickly if run in an order that’s different from the program text (Corbet et al., 2005). As a result, modern processors customarily reorder read and write instructions. However, this optimization can foul up drivers performing PMIO and MMIO. To prevent instruction reordering, memory barriers are employed. Memory barriers ensure that all instructions before the barrier conclude before any instruction after the barrier. For PMIO and MMIO operations, the bus_barrier function provides this ability:
#include <sys/bus.h>
#include <machine/bus.h>
void
bus_barrier(struct resource *r, bus_size_t offset, bus_size_t length,
int flags);The bus_barrier function inserts a memory ...
Read now
Unlock full access