As we saw earlier in Appendix A on the SPARC processor, there are several special registers. To read and write to those registers, we use the following instructions. Table B-18. State register instructions
The write instructions are delayed-write instructions. This means that the changes to the register may not be completed until up to three instructions later! When you encounter write instructions while looking at your running kernel or a system crash dump, you will note that they are usually followed by three nop instructions. This programming practice guarantees that the new value has been written to the specified register before the program moves on to the next task. All but the instructions that address register %y are privileged and therefore are capable of generating privileged instruction traps. Also, these instructions can generate illegal instruction traps under certain conditions. Miscellaneous state register instructionsThe other three SPARC instructions in the state register category are: Table B-19. Miscellaneous SPARC instructions
The unimp instruction is an unimplemented instruction that, when executed, will generate an illegal instruction trap. The stbar instruction forces all pending stores and atomic load-stores to complete prior to moving on to subsequent stores and atomic load-stores. The stbar instruction does not generate any traps. The flush instruction forces all pending memory access instructions involving the specified address to complete before subsequent accesses are attempted. The stbar and flush instructions are made available for memory management implementations that use memory caches, thus not guaranteeing instant modification of memory. |