From: "Jan Beulich" Subject: Re: [PATCH RFC 7/9] xen: Handle resumed instruction based on previous mem_event reply Date: Wed, 02 Jul 2014 16:56:10 +0100 Message-ID: <53B447BA020000780001FB54@mail.emea.novell.com> References: <1404308041-15461-1-git-send-email-rcojocaru@bitdefender.com> <1404308041-15461-7-git-send-email-rcojocaru@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1404308041-15461-7-git-send-email-rcojocaru@bitdefender.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Razvan Cojocaru Cc: tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 02.07.14 at 15:33, wrote: > In a scenario where a page fault that triggered a mem_event occured, > p2m_mem_access_check() will now be able to either 1) emulate the > current instruction, 2) skip the current instruction, or 3) emulate > it, but don't allow it to perform any writes. Since some SSE2 > instructions are problematic to emulate (Firefox uses some), > support for setting the A and D (accessed and dirty) bits has been > added (please see p2m_set_ad_bits()). Sadly that reference is useless - the function doesn't have any explanation what all this is about either. > --- a/xen/arch/x86/hvm/emulate.c > +++ b/xen/arch/x86/hvm/emulate.c > @@ -1372,6 +1372,16 @@ void hvm_emulate_one_full(bool_t nowrite) > switch ( rc ) > { > case X86EMUL_UNHANDLEABLE: > + printk("Emulation failed @ %04x:%lx: " > + "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", > + hvmemul_get_seg_reg(x86_seg_cs, ctx)->sel, > + ctx->insn_buf_eip, > + ctx->insn_buf[0], ctx->insn_buf[1], > + ctx->insn_buf[2], ctx->insn_buf[3], > + ctx->insn_buf[4], ctx->insn_buf[5], > + ctx->insn_buf[6], ctx->insn_buf[7], > + ctx->insn_buf[8], ctx->insn_buf[9]); > + > hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); > break; Since this is non-fatal to the guest, this must get its log level lowered. > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -121,6 +121,9 @@ struct vcpu *alloc_vcpu( > v->domain = d; > v->vcpu_id = vcpu_id; > > + v->sse_pg_dirty.eip = 0; > + v->sse_pg_dirty.gla = 0; > + All fields start out as zero already. And this is hardly arch-independent code. Jan