From: "Jan Beulich" Subject: Re: [PATCH RFC 1/9] xen: Emulate with no writes; compute current instruction length Date: Thu, 03 Jul 2014 09:05:34 +0100 Message-ID: <53B52AEE020000780001FF55@mail.emea.novell.com> References: <1404308041-15461-1-git-send-email-rcojocaru@bitdefender.com> <53B43FA1020000780001FA92@mail.emea.novell.com> <53B5086A.8060002@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53B5086A.8060002@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 03.07.14 at 09:38, wrote: > On 07/02/2014 06:21 PM, Jan Beulich wrote: >>> +void hvm_emulate_one_full(bool_t nowrite) >>> +{ >>> + struct hvm_emulate_ctxt ctx[1] = {}; >>> + int rc = X86EMUL_RETRY; >>> + >>> + hvm_emulate_prepare(ctx, guest_cpu_user_regs()); >>> + >>> + while ( rc == X86EMUL_RETRY ) >>> + { >>> + if ( nowrite ) >>> + rc = hvm_emulate_one_no_write(ctx); >>> + else >>> + rc = hvm_emulate_one(ctx); >>> + } >>> + >>> + switch ( rc ) >>> + { >>> + case X86EMUL_UNHANDLEABLE: >>> + hvm_inject_hw_exception(TRAP_invalid_op, > HVM_DELIVER_NO_ERROR_CODE); >> >> Is it certain that #UD is always the right exception here? > > I'll make that configurable (extra parameters to > hvm_emulate_one_full()), would that work for you? Yes, that would seem reasonable to me. Jan