wfi
Wait For Interrupt (A32)
WFI
Enters low-power state until an interrupt occurs.
Details
Suspends execution and transitions the processor to a low-power state until an interrupt is pending. The processor will resume execution when an interrupt is taken or becomes pending, subject to interrupt masking. No condition flags are affected. This is an A32-only hint instruction and typically requires non-user privilege level.
Pseudocode Operation
Wait for interrupt; if interrupt is signaled and unmasked, resume execution
Example
WFI
Encoding
Binary Layout
cond
00110
0
10
00
00
1
1
1
1
000000000011
Operands
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x0320F003 | WFI{<c>}{<q>} | A32 | cond | 00110 | 0 | 10 | 00 | 00 | 1 | 1 | 1 | 1 | 000000000011 | ||
| 0xBF30 | WFI{<c>}{<q>} | T32 | 10111111 | 0011 | 0000 | ||
| 0xF3AF8003 | WFI{<c>}.W | T32 | 111100111010 | 1 | 1 | 1 | 1 | 10 | 0 | 0 | 0 | 000 | 0000 | 0011 |
Description
Wait For Interrupt is a hint instruction that indicates that the PE can enter a low-power state and remain there until a wakeup event occurs. For more information, see Wait For Interrupt.
As described in Wait For Interrupt, the execution of a WFI instruction that would otherwise cause entry to a low-power state can be trapped to a higher Exception level, see:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !InterruptPending() then
if PSTATE.EL == EL0 then
// Check for traps described by the OS.
AArch32.CheckForWFxTrap(EL1, WFxType_WFI);
if PSTATE.EL IN {EL0, EL1} && EL2Enabled() && !IsInHost() then
// Check for traps described by the Hypervisor.
AArch32.CheckForWFxTrap(EL2, WFxType_WFI);
if HaveEL(EL3) && PSTATE.M != M32_Monitor then
// Check for traps described by the Secure Monitor.
AArch32.CheckForWFxTrap(EL3, WFxType_WFI);
integer localtimeout = 1 << 64; // No local timeout event is generated
WaitForInterrupt(localtimeout);