On Fri, Apr 12, 2013 at 03:14:48PM -0700, Anand Brooks wrote:
> Hello All,
> 
> I ran into an error when testing some code that would generate protection
> faults. I had my exception handler setup so that it expected the EIP and
> Stack not to change, standard behavior on native CPU. But on QEMU both the
> ESP and EIP are changed at fault generation time.

  I remember if exception occured, QEMU have to re-translate the translation
block to locate what PC triggers that exception. The reason behind that is QEMU
won't keep exact PC during the translation (you have to update PC after each
guest instruction, which cost too much). So I guess you can check follow
the control flow and see when/where QEMU get the correct PC, then call your
exception handler instead, not QEMU's one.

HTH,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

Reply via email to