This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Trapping IRQ from Secure World Firmware to Normal World Rich OS over Monitor Vector Table

I am trapping IRQs that are prompted in Secure World to a Rich OS in Non Secure World over the Monitor IRQ-Handler. The Rich OS should not notice that the Interrupt was catched by the Monitor, therefore the Monitor IRQ-Handler branches, after storing and loading registers, directly to the IRQ section of the Normal World`s interrupt vector table. After executing the Normal World IRQ-Handler I want to resume in Normal World where it stopped execution at the last World switch. Therefore I am saving the respective address in the link register when switching to the Normal World IRQ-Handler. The switching is done via "MOVS pc, lr" since I need to switch from Monitor-Mode to IRQ-Mode and execute the branch atomically. However MOVS is updating the link register of the IRQ-Mode which I need to return into normal World Supervisor Mode. With the wrong value in lr I cannot properly return from Normal World IRQ-Handler.

Why is MOVS updating lr? I could not find this behavior in the ARM specs on MOVS.

Did anybody implement something like this before? What instruction could I use instead of MOVS which does not perform an update on the link register? How would you recommend trapping Interrupts to Non Secure World over Monitor whithout the Rich OS in Non Secure World knowing or caring that the Interrupt was originally catched in Monitor IRQ-Handler? Is there any template code describing handling of secure (FIQ) and non-secure (IRQ) interrupts?

Any help is appreciated. Thank you.

Parents
  • Are you talking about Cortex-M or Cortex-A? Cortex-M has no FIQ.
    At least for Cortex-A I do not think it will work, as the normal world would not see the interrupt any more in the GIC.
    I think the "normal" way is to trap IRQs into monitor whilst running in secure world and trap FIQs into monitor whilst in normal world.
    I am not sure what you really want to achieve? Have some kind of supervision of normal-world interrupts and therefore trap them always into monitor?
    I do not think "movs pc,lr" is updating LR but this opcode leaves the monitor mode and switches back to the last mode (see SPSR).
Reply
  • Are you talking about Cortex-M or Cortex-A? Cortex-M has no FIQ.
    At least for Cortex-A I do not think it will work, as the normal world would not see the interrupt any more in the GIC.
    I think the "normal" way is to trap IRQs into monitor whilst running in secure world and trap FIQs into monitor whilst in normal world.
    I am not sure what you really want to achieve? Have some kind of supervision of normal-world interrupts and therefore trap them always into monitor?
    I do not think "movs pc,lr" is updating LR but this opcode leaves the monitor mode and switches back to the last mode (see SPSR).
Children