Question

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.

Était-ce utile?

La solution

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.

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top