Re: Why is flags being backed up before calling cli

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kashyap,

Sending to the group this time.

On Thu, Jan 20, 2011 at 11:00 PM, C K Kashyap <ckkashyap@xxxxxxxxx> wrote:
> 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?

The flags typically includes the interrupt status register.

If you have nested calls to local_irq_save/restore, like follows

assume interrupts are enabled here
local_irq_save
 interrupts are now disabled
 local_irq_save
   interrupts should continue to be disabled
 local_irq_restore
 At this point interrupts should be restored to the state they were
at save time (i.e. disabled)
  If you didn't save the flags, then you wouldn't know whether to
enable or disable interrupts at this point.
local_irq_restore
At this point interrupts should be restored to the state they were at
save time (i.e. enabled).

Dave Hylands

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux