On Fri, 18 Apr 2008 10:25:15 -0500
Anthony Liguori <[EMAIL PROTECTED]> wrote:

> I'd prefer you not do an emulate_instruction loop at all.  Just emulate 
> one instruction on vmentry failure and let VT tell you what instructions 
> you need to emulate.
> 
> It's only four instructions so I don't think the performance is going to 
> matter.  Take a look at the patch I posted previously.

you were right, I not updated eip correctly. It is fixed now with the
following code:


  case 0xea: /* jmp (far, absolute) */ {
            struct kvm_segment kvm_seg;
            uint16_t eip;
            uint16_t sel;
            int ret;

            eip = insn_fetch(u16, 2, c->eip);
            sel = insn_fetch(u16, 2, c->eip);
            kvm_x86_ops->get_segment(ctxt->vcpu, &kvm_seg, VCPU_SREG_CS);
            kvm_seg.selector = sel;
            ret = load_segment_descriptor(ctxt->vcpu, kvm_seg.selector, 9,
                                          VCPU_SREG_CS);
            if (ret < 0 ) {
                   printk(KERN_INFO "%s: Failed to load CS selector\n",
                                    __FUNCTION__);
                   goto cannot_emulate;  
            }

            c->eip = eip;
            break;


I print the instruction to be emulated and it seems ok. I have the following 
outputs:

[24203.663324] vmentry_failure: emulation at (46e53) rip 6e13: ea 18 6e 18
[24203.664668] vmentry_failure: emulation at (46e58) rip 6e18: 66 b8 20 00
[24203.668650] vmentry_failure: emulation failed (vmentry failure) rip 6e18 66 
b8 20 00

So the emulation that failed is "mov $0x20, %ax". It needs to be
emulated. As you said Anthony it's only four instructions that need to
be emulated, shouldn't be a big issue. 


Best regards,
Guillaume

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to