Skip to content

Commit

Permalink
feat: clarify xp-4
Browse files Browse the repository at this point in the history
  • Loading branch information
natalieagus committed Apr 15, 2024
1 parent dbae68b commit 0afaee2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions docs/Software/o_virtualmachine.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,7 @@ Then, the handler will figure out which specific **service routine** needs to be
> What is the value of `Reg[XP]-4`?
<div cursor="pointer" class="collapsible">Show Answer</div><div class="content_answer"><p>
It depends. The **service routine** may or may not change the value of `Reg[XP]` before returning to the interrupt handler.
If the value of `Reg[XP]` is unchanged, then the interrupted program resumes. Else, it means that the CPU executes another program.
In any case, `Reg[XP]-4` **always** contains the address of instruction that the CPU should execute when the interrupt handler returns.
`Reg[XP]` contains the **next** address of the interrupted instruction. When we resume the interrupted process, we would like to re-execute this interrupted instruction. Hence, `Reg[XP]-4` **always** contains the address of that interrupted instruction that the CPU should execute when the interrupt handler returns.
</p></div><br>
Expand Down

0 comments on commit 0afaee2

Please sign in to comment.