Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WFE instruction handling in ARM

Tags:

arm

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 ?

like image 668
user970251 Avatar asked Jan 12 '23 09:01

user970251


1 Answers

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.

like image 129
Gilles 'SO- stop being evil' Avatar answered Mar 07 '23 21:03

Gilles 'SO- stop being evil'