Program Counter changes

458 views Asked by At

Of all possibilities in which the PC (program counter) register changes I found these:

1) PC increases its value with loading new instruction
2) with jumps and branches
3) with calling subroutine
4) with return from subroutine

Are those all or am I missing something?

I come from this article.

2

There are 2 answers

2
Alexey Frunze On BEST ANSWER

There are a few more:

  • Hardware interrupts change PC to execute interrupt service routines and then return to the interrupted program.
  • Exceptional situations (exceptions like division by 0 or page fault) change PC in a similar fashion.
  • Debug interrupts do that too.
  • System calls (their invocation and return) change PC as well.
0
TEOUltimus On

I believe that that is all, assuming non-local jumps are included as part of 2 (e.g. setjmp, longjmp).