.Bf -symbolic This API is deprecated. Use mutexes to protect data structures instead. See mutex(9) for more information.
The spl function family sets the interrupt priority "level" of the CPU. This prevents interrupt handlers of the blocked priority level from being run. This is used in the "synchronous" part of a driver (the part that runs on behalf of the user process) to examine or modify data areas that might be examined or modified by interrupt handlers.
Each driver that uses interrupts is normally assigned to an interrupt priority group by a keyword in its config line. For example:
device foo0 at isa? port 0x0815 irq 12 tty
assigns interrupt 12 to the "tty" priority group. The system automatically arranges for interrupts in the xxx group to be called at a priority >= spl xxx ().
The function splx sets the interrupt priority to an absolute value. The intent is that the value returned by the other functions should be saved in a local variable, and later passed to splx in order to restore the previous priority.
The function spl0 lowers the priority to a value where all interrupt handlers are unblocked, but ASTs (asynchronous system traps) remain blocked until the system is about to return to user mode.
The traditional assignment of the various device drivers to the interrupt priority groups can be roughly classified as: