Typically, it's the core kernel (and/or arch-specific) code that handles low-level interrupt management. This includes doing things such as masking them as and when required. Nevertheless, some drivers, as well as the OS, require fine-grained control when enabling/disabling hardware interrupts. As your driver or module code runs with kernel privileges, the kernel provides (exported) helper routines that allow you to do exactly this:
Brief comment | API or helper routine |
Disable/enable all interrupts on the local processor | |
Unconditionally disables all interrupts on the local (current) processor core. | local_irq_disable() |
Unconditionally enables all interrupts on the local (current) processor core. | local_irq_enable() |
Saves the state (interrupt mask) of, and then disables all interrupts on the local (current) processor core. The state is saved in the flags parameter that's passed. | local_irq_save(unsigned long flags); |
Restores the... |