Hi,
I noticed that the flags register is being stored before doing 'cli' and then restored after calling 'sti'. - eg. in local_irq_save and local_irq_restore Can someone tell me the scenario that is being guarded against by backing up flags?
There are many functions in the kernel that can be accessed with interrupts enabled or disabled. A function X has no handy way to know whether its caller or another function has already disabled interrupts. However if X unconditionally re-enables interrupts at the end of its body, a caller that has disabled interrupts prior to calling it will find that interrupts are enabled once X returns - something unexpected and unacceptable. local_irq_save and local_irq_restore ensure that interrupts are re-enabled by the function of the call stack that actually disabled them. Alex.