From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] KVM: x86 emulator: emulate RETF imm Date: Mon, 9 Sep 2013 16:10:56 +0300 Message-ID: <20130909131056.GU17294@redhat.com> References: <1378237329-18630-1-git-send-email-brogers@suse.com> <20130908131349.GI17294@redhat.com> <522D741B02000048000E388A@novprvoes0310.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: pbonzini@redhat.com, kvm@vger.kernel.org To: Bruce Rogers Return-path: Received: from mx1.redhat.com ([209.132.183.28]:19494 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751181Ab3IINLB (ORCPT ); Mon, 9 Sep 2013 09:11:01 -0400 Content-Disposition: inline In-Reply-To: <522D741B02000048000E388A@novprvoes0310.provo.novell.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Sep 09, 2013 at 07:09:15AM -0600, Bruce Rogers wrote: > >>> On 9/8/2013 at 07:13 AM, Gleb Natapov wrote: > > On Tue, Sep 03, 2013 at 01:42:09PM -0600, Bruce Rogers wrote: > >> Opcode CA > >> > >> This gets used by a DOS based NetWare guest. > >> > >> Signed-off-by: Bruce Rogers > >> --- > >> arch/x86/kvm/emulate.c | 23 ++++++++++++++++++++++- > >> 1 files changed, 22 insertions(+), 1 deletions(-) > >> > >> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > >> index 2bc1e81..aee238a 100644 > >> --- a/arch/x86/kvm/emulate.c > >> +++ b/arch/x86/kvm/emulate.c > >> @@ -2025,6 +2025,26 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) > >> return rc; > >> } > >> > >> +static int em_ret_far_imm(struct x86_emulate_ctxt *ctxt) > >> +{ > >> + int rc; > >> + unsigned long cs; > >> + > >> + rc = emulate_pop(ctxt, &ctxt->_eip, ctxt->op_bytes); > >> + if (rc != X86EMUL_CONTINUE) > >> + return rc; > >> + if (ctxt->op_bytes == 4) > >> + ctxt->_eip = (u32)ctxt->_eip; > >> + rc = emulate_pop(ctxt, &cs, ctxt->op_bytes); > >> + if (rc != X86EMUL_CONTINUE) > >> + return rc; > >> + rc = load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS); > >> + if (rc != X86EMUL_CONTINUE) > >> + return rc; > >> + rsp_increment(ctxt, ctxt->src.val); > >> + return X86EMUL_CONTINUE; > >> +} > >> + > > Why not: > > > > static int em_ret_far_imm(struct x86_emulate_ctxt *ctxt) > > { > > int rc; > > rc = em_ret_far(struct x86_emulate_ctxt *ctxt); > > if (rc != X86EMUL_CONTINUE) > > return rc; > > rsp_increment(ctxt, ctxt->src.val); > > return X86EMUL_CONTINUE; > > } > > > > -- > > Gleb. > > Yes, that does seem better. Ack. > Somebody still needs to write a proper patch :) Can you do it please? -- Gleb.