4.5 Compiler intrinsics for controlling IRQ and FIQ interrupts

The intrinsics __disable_irq, __enable_irq, __disable_fiq and __enable_fiq control IRQ and FIQ interrupts.

You cannot use these intrinsics to change any other CPSR bits, including the mode, state, and imprecise data abort setting. This means that the intrinsics can be used only if the processor is already in a privileged mode, because the control bits of the CPSR and SPSR cannot be changed in User mode.

These intrinsics are available for all processor architectures in both ARM and Thumb state, as follows:

  • If you are compiling for processors that support ARMv6 (or later), a CPS instruction is generated inline for these functions, for example:

        CPSID  i
    
  • If you are compiling for processors that support ARMv4 or ARMv5 in ARM state, the compiler inlines a sequence of MRS and MSR instructions, for example:

        MRS  r0, CPSR
        ORR  r0, r0, #0x80
        MSR  CPSR_c, r0
    
  • If you are compiling for processors that support ARMv4 or ARMv5 in Thumb state, or if --compatible is being used, the compiler calls a helper function, for example:

        BL    __ARM_disable_irq
    
Related concepts
4.1 Compiler intrinsics
4.12 NEON intrinsics provided by the compiler
4.9 Compiler support for European Telecommunications Standards Institute (ETSI) basic operations
4.11 Texas Instruments (TI) C55x intrinsics for optimizing C code
Related reference
4.2 Performance benefits of compiler intrinsics
4.3 ARM assembler instruction intrinsics
10.110 __disable_fiq intrinsic
10.111 __disable_irq intrinsic
10.112 __enable_fiq intrinsic
10.113 __enable_irq intrinsic
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.