> +    case 0x62: /* EVEX */
> +        if (CODE32(s) && !VM86(s)) {
> +            int evex2 = x86_ldub_code(env, s);
> +
> +            if (!CODE64(s) && (evex2 & 0xc0) != 0xc0) {
> +                s->pc--; /* rewind the advance_pc() x86_ldub_code() did */
> +                break;
> +            }
> +            if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ
> +                             | PREFIX_LOCK | PREFIX_DATA)) {
> +                goto illegal_op;
> +            }

Just a nit, per APX spec (section 3.1.2.3):

The prefix rules for the extended EVEX prefix are the same as for the
current EVEX prefix. The extended EVEX prefix must be the last prefix
preceding the main opcode byte. The only prefixes which may precede the
extended EVEX prefix are ASIZE override (0x67) and segment overrides.
The presence of any other prefix triggers #UD.

So we can also reject REX prefix like VEX did:

#ifdef TARGET_X86_64
            if (rex != -1) {
                goto illegal_op;
            }
#endif

Thanks,
Zhao


Reply via email to