Temporarily disable interrupts on ARM
问题 I am starting working with the ARM platform (specifically the TI TMS570 family). I have some code with critical regions where I don't want an exception to occur. So I want to save the IRQ and FIR enabled flags on entering the regions and restore them on exiting. How do I do that? 回答1: To temporarily mask IRQs and FIQs at the CPU, the nicest option for ARMv7 is to use cps: // assembly code assuming interrupts unmasked on entry cpsid if // mask IRQ and FIQ ... // do critical stuff cpsie if //