Messages in this thread | | | From | Keith Owens <> | Subject | Re: cli() and sti() | Date | Mon, 03 Mar 1997 02:32:34 +1100 |
| |
On Sun, 2 Mar 1997 20:46:55 +0800 (GMT+0800), Duan Zhenhai <ccdzh@shoukui.pku.edu.cn> wrote: >Hello, > I read some code that like: > > save_flags(..); > cli(); > ............. > restore_flags(..); > > and did not find they use sti.
Restore_flags puts the cpu flags back to what was were saved before cli(). This includes resetting the interrupt flag to whatever it was before cli() was issued. In some cases sti() is not safe because IF may already be masked, safer to save the current state then restore it instead of assuming IF was already 1.
| |