From: "Jan Beulich" Subject: Re: [PATCH RFC 1/9] xen: Emulate with no writes; compute current instruction length Date: Wed, 02 Jul 2014 17:08:57 +0100 Message-ID: <53B44AB9020000780001FB8B@mail.emea.novell.com> References: <1404308041-15461-1-git-send-email-rcojocaru@bitdefender.com> <53B43FA1020000780001FA92@mail.emea.novell.com> <53B4288F.8000103@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53B4288F.8000103@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 17:43, wrote: > On 07/02/2014 06:21 PM, Jan Beulich wrote: >>> + struct x86_emulate_ctxt __attribute__((unused)) *ctxt) >> >> We don't mark unused function arguments like this (and if we did, >> we'd want you to use __maybe_unused). > > OK, thanks. What's the proper way to mark them? Should I go with > __maybe_unused then? No - don't mark them. >>> +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? > > For our purposes, yes. That's not really a good answer for code that isn't there to only suit you. > Of course, that means that I can't really explain what the original > author intended (related to the rest of your critique). Which clearly won't help acceptance of this code, assuming that's your goal. Jan