Re: [PATCH 4/4] KVM: x86 emulator: Avoid pushing back ModRM byte in decode_opcode()

Takuya Yoshikawa
2012-04-24T14:27:41Z

On Tue, 24 Apr 2012 17:10:08 +0300
Avi Kivity <avi@redhat.com> 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