From: Guillaume T. <gui...@ex...> - 2008-04-18 14:05:04
|
On Fri, 18 Apr 2008 08:23:07 -0500 Anthony Liguori <an...@co...> wrote: > This doesn't seem right. You should have been able to break out of the > emulator long before encountering an out instruction. The next > instruction you encounter should be a mov instruction. Are you sure > you're updating eip correctly? I think that eip is updated correctly but you're right, I think that the condition to stop emulation is not well implemented. I emulate a lot of mov instructions and I remain blocked in the emulation loop until I reach the "out" instruction. The loop is the following: [...] cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & SELECTOR_RPL_MASK; ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & SELECTOR_RPL_MASK; while (cs_rpl != ss_rpl) { if (emulate_instruction(vcpu, NULL, 0,0, 0) == EMULATE_FAIL) { printk(KERN_INFO "%s: emulation of 0x%x failed\n", __FUNCTION__, vcpu->arch.emulate_ctxt.decode.b); return -1; } cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & SELECTOR_RPL_MASK; ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & SELECTOR_RPL_MASK; } printk(KERN_INFO "%s: VMX friendly state recovered\n", __FUNCTION__); // I never reach this point Maybe CS and SS selector are not well updated. I will add trace to see their values before and after the emulation. Regards, Guillaume |