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

What happens to the Instructions already in pipeline when interrupt occurs ?

Hello Community,

Recently I was going through some code and has this doubt.

My Pseudocode

============

CPSID I - Disable interrupts

Do critical work

CPSIE I - Enable interrupts

Do non critical work.

After I enabled interrupts and if there is pending interrupt , Does the exception handler will execute right after CPSIE I instruction ? What happens to the instructions that are already there in pipeline ?  I am looking for CM0/CM0+ behavior.

Regards.

Vijay.

Parents
  •   - Thanks for the valuable information. While i was going through Memory barriers programming guide for Cortex - M (https://static.docs.arm.com/dai0321/a/DAI0321A_programming_guide_memory_barriers_for_m_profile.pdf) I found something surprising. In section 4.7, it is mentioned that 

    "If an interrupt was already in the pending state, the processor accepts the interrupt after the “CPSIE I” is executed. However, additional instructions can be executed before the processor enters the exception handler: • for Cortex-M3 or Cortex-M4, the processor can execute up to TWO additional instructions before entering the interrupt service routine • for Cortex-M0, the processor can execute up to ONE additional instruction before entering the interrupt service routine." 

    So, I was wondering in which case processor can execute ONE additional instruction. Do you have any info related to this ?

    Regards,

    Vijay.

Reply
  •   - Thanks for the valuable information. While i was going through Memory barriers programming guide for Cortex - M (https://static.docs.arm.com/dai0321/a/DAI0321A_programming_guide_memory_barriers_for_m_profile.pdf) I found something surprising. In section 4.7, it is mentioned that 

    "If an interrupt was already in the pending state, the processor accepts the interrupt after the “CPSIE I” is executed. However, additional instructions can be executed before the processor enters the exception handler: • for Cortex-M3 or Cortex-M4, the processor can execute up to TWO additional instructions before entering the interrupt service routine • for Cortex-M0, the processor can execute up to ONE additional instruction before entering the interrupt service routine." 

    So, I was wondering in which case processor can execute ONE additional instruction. Do you have any info related to this ?

    Regards,

    Vijay.

Children