문제

In linux kernel, in file arch/arm/mach-exynos/cpuidle.c, there is the following code:

    local_irq_disable();

    cpu_do_idle();

    local_irq_enable();

where cpu_do_idle is

    dsb         
    wfi
    mov     pc, lr

In cpu_do_idle, it does 'wfi' command which stands for wait for interrupt. But, what I'm not understanding is that it enters cpu_do_idle after disabling irq. How does this happen?

도움이 되었습니까?

해결책

WFI waits for the hardware interrupt, regardless the current interrupt handling state of the CPU. When CPU is woken up, it has the chance to re-enable interrupts and process any pending ones:

WFI suspends execution until one of the following events occurs:

  • an IRQ interrupt, regardless of the CPSR I-bit

  • an FIQ interrupt, regardless of the CPSR F-bit

  • an Imprecise Data abort, unless masked by the CPSR A-bit

  • a Debug Entry request, regardless of whether Debug is enabled.

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/CIHEGBBF.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top