[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 05/17] x86emul: add XOP decoding
On 08/09/16 14:11, Jan Beulich wrote: > This way we can at least size (and e.g. skip) them if needed, and we > also won't raise the wrong fault due to not having read all relevant > bytes. > > Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> > > --- a/xen/arch/x86/x86_emulate/x86_emulate.c > +++ b/xen/arch/x86/x86_emulate/x86_emulate.c > @@ -279,6 +279,12 @@ static const opcode_desc_t twobyte_table > ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ModRM, ModRM > }; > > +static const opcode_desc_t xop_table[] = { > + DstReg|SrcImmByte|ModRM, > + DstReg|SrcMem|ModRM, > + DstReg|SrcImm|ModRM, > +}; > + > #define REX_PREFIX 0x40 > #define REX_B 0x01 > #define REX_X 0x02 > @@ -1580,6 +1586,9 @@ struct x86_emulate_state { > ext_0f = vex_0f, > ext_0f38 = vex_0f38, > ext_0f3a = vex_0f3a, > + ext_8f08 = 8, > + ext_8f09, > + ext_8f0a, What is this = 8 for? I presume you didn't slip it in accidentally, but I still can't figure out why. > } ext; > uint8_t opcode; > uint8_t modrm, modrm_mod, modrm_reg, modrm_rm; > @@ -1802,7 +1811,7 @@ x86_decode( > modrm = insn_fetch_type(uint8_t); > modrm_mod = (modrm & 0xc0) >> 6; > > - if ( !ext && ((b & ~1) == 0xc4) ) > + if ( !ext && ((b & ~1) == 0xc4 || (b == 0x8f && (modrm & 0x18))) ) > switch ( def_ad_bytes ) > { > default: > @@ -1816,11 +1825,11 @@ x86_decode( > break; > /* fall through */ > case 8: > - /* VEX */ > + /* VEX / XOP */ > generate_exception_if(rex_prefix || vex.pfx, EXC_UD, -1); > > vex.raw[0] = modrm; > - if ( b & 1 ) > + if ( b == 0xc5 ) > { > vex.raw[1] = modrm; > vex.opcx = vex_0f; > @@ -1848,18 +1857,30 @@ x86_decode( > rex_prefix |= REX_R; > > b = insn_fetch_type(uint8_t); > - switch ( ext = vex.opcx ) > + ext = vex.opcx; > + if ( b != 0x8f ) > + { > + switch ( ext ) > + { > + case vex_0f: > + d = twobyte_table[b]; > + break; > + case vex_0f38: > + d = twobyte_table[0x38]; > + break; > + case vex_0f3a: > + d = twobyte_table[0x3a]; > + break; > + default: > + rc = X86EMUL_UNHANDLEABLE; > + goto done; > + } > + } > + else if ( ext < ext_8f08 + > + sizeof(xop_table) / sizeof(*xop_table) ) ARRAY_SIZE() ? ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |