14.2.8 Device Operations
Keywords: perfbook_html

##
14.2.8 Device Operations

Some devices present their control interfaces as collections of memory locations, but the order in which the control registers are accessed is very important. For instance, imagine an Ethernet card with a set of internal registers that are accessed through an address port register (A) and a data port register (D). To read internal register 5, the following code might then be used:

    *A = 5;
    x = *D;

but this might show up as either of the following two sequences:

    STORE *A = 5, x = LOAD *D
    x = LOAD *D, STORE *A = 5

the second of which will almost certainly result in a malfunction, since it set the address after attempting to read the register.