.\" -*- nroff -*- .TH save_flags 9 "$Date:$" "Linux DDI" "Linux Kernel Functions" .SH NAME save_flags, restore_flags \- save/restore processor state and irq mask .SH SYNOPSIS .B #include .sp .BI "unsigned long " flags ";" .br .BI "void save_flags(" flags ")" .br .BI "void restore_flags(" flags ")" .SH DESCRIPTION The .B save_flags and .B restore_flags macros cooperate with the .B cli function to provide interrupt protection to critical sections of code. The .B save_flags function saves the current processor state, most specifically the interrupt priority level, in the .I flags value (which must be an l-value). The flags must be passed to a subsequent call to .B restore_flags to restore the processor state. .PP The .B save_flags macro does not affect the processor state, but drivers may use the .BR cli (9) and .B sti functions to disable and enable interrupts after saving the current flags. When the critical section of code is passed, the .B restore_flags returns the processor to its state at the point where the matching .B save_flags was called. .PP Only values returned by .B save_flags can be passed to .B restore_flags. Any other values may cause unpredictable results, and are certainly not portable. .SH "RETURN VALUE" The .B restore_flags macro saves the processor state in the .I flags parameter, which must be a non-const l-value. .SH AVAILABILITY Linux 1.0+ .SH "SEE ALSO" .BR "cli" (9) .SH AUTHOR Stephen Williams (steve@icarus.com) .SH BUGS How does all this react with symmetric multiprocessor machines?