summaryrefslogtreecommitdiffstats
path: root/upstream/mageia-cauldron/man9/save_flags.9
blob: da290dd70f93c520823f2d48307c267072adde33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
.\" -*- 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 <asm/system.h>
.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?