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

Abort some questions of arm interrupt

Note: This was originally posted on 20th June 2008 at http://forums.arm.com

I try to understand arm interrupt,there are some questions I don't know,
  1.   Why the nested interrupt has to switch out of irq mode to svc mode?  I think  it only pushes the r14_irq into the irq stack.
   2.    The basic difference between a reentrant interrupt handler and a nested interrupt han-dler is that the interrupts are reenabled early on in the reentrant interrupt handler, which can reduce interrupt latency.
    I can't understand that ?

   thanks!
Parents
  • Note: This was originally posted on 30th June 2008 at http://forums.arm.com

    To answer the question in the original post:

    You need to switch to system mode / supervisor mode
    before enabling nested interrupt. Otherwise you might
    lose your LR after a BL instruction. For example, if
    you stay in IRQ state and you execute a BL instruction
    inside the handler, the value of LR is updated. At the
    same time if a new IRQ come in, this overwrite the new
    LR content before you have any chance to save it to
    the stack.

    By switching over to system or supervisor mode, the BL
    instruction will update the LR for system/supervisor mode,
    which will not be overriden when a new IRQ come in. 
    The new IRQ handler can save the LR (and other registers)
    to the stack before switching to system/supervisor mode
    again. This applied to ARM7/ARM9, etc.

    ----

    Regarding reentrant interrupts in ARM7/ARM9, it also
    depends on the interrupt controller. If you are using
    VIC (PL192/PL190), it has priority logic inside which
    will stop reentrant interrupts (similar to the case
    in Cortex-M3).

    ----
    Regarding Cortex-M3:
    Technically it is possible to create re-entry interrupt
    using non-base thread enable and clear the IPSR value
    by a extra layer of exception (and manually manipulate stack
    frames) so that the interrupt masking is removed. But
    this is really a pain to setup. Therefore I wouldn't recommend
    this to anyone  B)
Reply
  • Note: This was originally posted on 30th June 2008 at http://forums.arm.com

    To answer the question in the original post:

    You need to switch to system mode / supervisor mode
    before enabling nested interrupt. Otherwise you might
    lose your LR after a BL instruction. For example, if
    you stay in IRQ state and you execute a BL instruction
    inside the handler, the value of LR is updated. At the
    same time if a new IRQ come in, this overwrite the new
    LR content before you have any chance to save it to
    the stack.

    By switching over to system or supervisor mode, the BL
    instruction will update the LR for system/supervisor mode,
    which will not be overriden when a new IRQ come in. 
    The new IRQ handler can save the LR (and other registers)
    to the stack before switching to system/supervisor mode
    again. This applied to ARM7/ARM9, etc.

    ----

    Regarding reentrant interrupts in ARM7/ARM9, it also
    depends on the interrupt controller. If you are using
    VIC (PL192/PL190), it has priority logic inside which
    will stop reentrant interrupts (similar to the case
    in Cortex-M3).

    ----
    Regarding Cortex-M3:
    Technically it is possible to create re-entry interrupt
    using non-base thread enable and clear the IPSR value
    by a extra layer of exception (and manually manipulate stack
    frames) so that the interrupt masking is removed. But
    this is really a pain to setup. Therefore I wouldn't recommend
    this to anyone  B)
Children
No data