0

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.

Linus Kleen
  • 33,871
  • 11
  • 91
  • 99
user1097772
  • 3,499
  • 15
  • 59
  • 95

2 Answers2

5

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.
Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180
0

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

TEOUltimus
  • 184
  • 8