Which instruction is run after an exception was handled?

I'm reading about HWSW interrupts and something isn't clear to me:

When the normal flow is interrupted by an exception ("software interrupt"), the address of the instruction which caused the interrupt is saved, and then the OS gives the exception handler a chance to handle it.

The point I'm not sure about is which instruction is processed after the handler finishes:

  • If the same "faulty" instruction in run again, it might cause the same exception.
  • If the next instruction is run, aren't we losing the affect of the previous instruction (which might cause a "normal" exception, such as page fault)?

  • The instruction that caused the fault is executed again. The idea is that the handler should make appropriate changes so that the instruction will be able to execute properly.

    For instance, if an instruction causes a page fault because it tries to access virtual memory that's paged out, the OS will load the page from backing store, update the page table, and then restart the instruction. This time it will succeed because the page is in RAM.

    If the handler doesn't fix things, you'll get another interrupt when it's restarted, and the process will repeat.

    链接地址: http://www.djcxy.com/p/80356.html

    上一篇: 程序计数器返回中断处理程序后的位置?

    下一篇: 处理异常后运行哪条指令?