From: Takuya Yoshikawa Subject: Re: [PATCH 4/4] KVM: x86 emulator: Avoid pushing back ModRM byte in decode_opcode() Date: Tue, 24 Apr 2012 23:27:36 +0900 Message-ID: <20120424232736.91d7c5fe3ae27393ac41f36d@gmail.com> References: <20120424003159.4fd245ec18b0b3eeddbea553@gmail.com> <20120424003713.57df702ddb13d745466a524c@gmail.com> <4F96B440.1030106@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp To: Avi Kivity Return-path: Received: from mail-pb0-f46.google.com ([209.85.160.46]:58876 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755087Ab2DXO1l (ORCPT ); Tue, 24 Apr 2012 10:27:41 -0400 Received: by pbbro12 with SMTP id ro12so158314pbb.19 for ; Tue, 24 Apr 2012 07:27:41 -0700 (PDT) In-Reply-To: <4F96B440.1030106@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 24 Apr 2012 17:10:08 +0300 Avi Kivity wrote: > > + if (!modrm_fetched && (ctxt->d & ModRM)) > > + ctxt->modrm = insn_fetch(u8, ctxt); > > Instead of adding yet another conditional, how about doing something like > > if ((c->d & ModRM) || (gtype == Group) || (gtype == GroupDual)) > ctxt->modrm = insn_fetch(u8, ctxt); > > somewhere early? Looks nicer than mine. > In fact even that is too much. All groups have ModRM somewhere in their > encoding; all we have to do is move it to the main tables (opcode_table > or twobyte_table) and just move the existing modrm fetch before group > parsing. I see. Then, the best way to go seems to be drop patch-4 and work on the ModRM fetch issue separately. Modifying the tables needs some care. Thanks, Takuya