unsigned long flags; void save_flags(flags) void restore_flags(flags)
DESCRIPTION
The
save_flags
and
restore_flags
macros cooperate with the
cli
function to provide interrupt protection to critical sections of
code. The
save_flags
function saves the current processor state, most specifically the
interrupt priority level, in the
flags
value (which must be an l-value). The flags must be passed to a
subsequent call to
restore_flags
to restore the processor state.
The
save_flags
macro does not affect the processor state, but drivers may use the
cli(9)
and
sti
functions to disable and enable interrupts after saving the current
flags. When the critical section of code is passed, the
restore_flags
returns the processor to its state at the point where the matching
save_flags
was called.
Only values returned by
save_flags
can be passed to
restore_flags.
Any other values may cause unpredictable results, and are
certainly not portable.
RETURN VALUE
The
restore_flags
macro saves the processor state in the
flags
parameter, which must be a non-const l-value.