the basic world switch flow is:
set FIQ to monitor mode
- normal world -> FIQ triggered
- -> enter monitor mode (do switch to Secure world, restore Secure world context)
- -> in Secure world sys mode
- -> FIQ is not clear, enter FIQ handler in Secure world
step3 and step 4, after we restore the target context, arm will trigger the exception to enter the exception is the behavior correct? (if we dont branch to FIQ handle in monitor mode vector table)
we need flow like below: (no world context switch case, just enter monitor mode to check if we need world switch, and enter irq exception from monitor mode directly. we need this because of our hw limitation, we only have IRQ in our chip)
set IRQ to monitor mode
- normal world user mode -> IRQ triggered
- -> enter monitor, do something we want to hook, check if we need context switch, prepare some spsr/lr for IRQ mode
- -> enter normal world IRQ mode, irq handling
- -> irq done, return back to user mode
for non-world switch case, we would like to let the normal world os does not know about the monitor mode, just though he enters the irq mode directly and return from irq mode. for world switch case, just switch it in the monitor mode.
or it's just do the irq_handle in the monitor mode?
eq.
normal world OS usr mode -> irq -> usr mode
normal world OS usr mode -> monitor to irq handler -> usr mode
is the flow possible and well design?