Razvan Cojocaru
2013-May-16 15:04 UTC
What''s a good way of skipping an instruction for a HVM guest?
Hello, how do I skip the current instruction from the HV? That is, how do I know what instruction length to add to guest_cpu_user_regs()->eip to achieve this? Could this be done by hvm_emulate_one() with a copy of guest_cpu_user_regs() and then setting guest_cpu_user_regs()->eip to the eip in the hvmemul_ctxt? Would this have side-effects? Thanks, Razvan Cojocaru
Keir Fraser
2013-May-16 15:49 UTC
Re: What''s a good way of skipping an instruction for a HVM guest?
On 16/05/2013 16:04, "Razvan Cojocaru" <rzvncj@gmail.com> wrote:> Hello, > > how do I skip the current instruction from the HV? That is, how do I > know what instruction length to add to guest_cpu_user_regs()->eip to > achieve this? > > Could this be done by hvm_emulate_one() with a copy of > guest_cpu_user_regs() and then setting guest_cpu_user_regs()->eip to > the eip in the hvmemul_ctxt? Would this have side-effects?You would also need to provide a set of x86_emulate_ops that are side-effect free (e.g., to avoid modifying CRn, DRn, memory, MSRs, ...). There is no other fully generic way to do it though. VMX provides the trapping instruction length on vmexit, but not in all cases. Our SVM code also has a limited instruction-length helper function, but only for a few instructions for which it is required. -- Keir> > Thanks, > Razvan Cojocaru > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel