How does a WFE instruction work ? What I have read is that it makes processor wait for an IRQ /FIQ/event/....
But what happens when you get an IRQ, does the irq_fault_handler vector executes on getting an interrupt or instruction subsequent to the WFE is executed ?
WFE is conceptually equivalent to
while (!event_has_occurred) /*do nothing*/;
except that it turns the CPU off instead of running a tight loop.
Several things that can interrupt a WFE, including not only an interrupt but also an explicit wake up event from another CPU (in a multicore processor).
If an interrupt happens during WFE, the usual things happens. The processor switches to IRQ or FIQ mode, jumps to the IRQ or FIQ handler, and the address of the WFE instruction (plus the usual offset of 8) is placed in lr
.
If the CPU was waken up by an explicit wake up event, the execution proceeds with the next instruction after the WFE.
Think of WFE as a very long NOP which only completes when some external event happens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With