Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interrupt during the context switching

Status
Not open for further replies.

BenzT

Junior Member level 3
Joined
Mar 24, 2017
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
224
Hi,

If a high priority interrupt triggers while context switch for the low priority interrupt is in process(not completed), what will happen?

For the following scenario.

main program executing..
low priority interrupt triggers..
PC pushed to stack
Status register moved to Stack
How priority interrupt triggers..


What will happen now..
 

Hi,

No problem.
The new PC is pushed onto stack
New SR is puhed onto stack
High priority ISR is executed
SR is fetched from stack
PC is fetched from stack
..and it will continue low priority ISR
...

Klaus
 

Hi,

No problem.
The new PC is pushed onto stack

Klaus

Since the PC is not loaded with the vector address of low priority interrupt(low priority isr has not yet started to execute), how does it will be pushed into stack?
 

Hi,

Pushing the PC to stack usually is a hardware process. There is no instruction involved. It can not be interrupted.

So either the the low priority has been started yet....then the PC is already pushed on the stack ... or not.

Klaus
 
  • Like
Reactions: BenzT

    BenzT

    Points: 2
    Helpful Answer Positive Rating
So either the the low priority has been started yet....then the PC is already pushed on the stack ... or not.

Klaus

I am not getting it. Can you pls elaborate it..

- - - Updated - - -

So either the the low priority has been started yet....then the PC is already pushed on the stack ... or not.

Klaus

I am not getting it. Can you pls elaborate it..
 

Hi,

main program executing..
low priority interrupt triggers..
PC pushed to stack
Status register moved to Stack
How priority interrupt triggers..
..then the actual PC again is pushed on stack.

If this is not what you need to know, then draw a timing diagram...with reference to the system clock
Maybe it's a good idea to say what controller you are talking about.

Klaus
 

Handling an interrupt is a 'hardware' thing that the processor does.
Typically when the hardware sees the signal that an interrupt needs to be serviced, it will complete the current instruction, push the PC and status register (whichever that is for your device - normally holds the current state of the CPU in some way) onto the stack and then loads the ISR address into the PC and configures the status register to show that it is processing an interrupt.
IT is similar to a subroutine call *BUT* more is pushed to the stack. This is why the compiler/assembler needs to told that it is handling an ISR as there is a separate 'return from interrupt' instruction that needs to be executed to restore the PC and the CPU state to that before the interrupt is serviced.
If you have a processor that has multiple priority interrupts then the process is exactly the same except that a high priority interrupt is allowed to interrupt a lower priority one. If a lower priority interrupt is executing then, when the higher priority one is triggered, the 'status' register that is saved will remember the lower priority state and that is the state that will be restored when the higher priority ISR completes.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top