Re: [PATCH v2 07/42] Enforce VEX encoding restrictions

2022-04-27 Thread Paolo Bonzini
On 4/25/22 00:01, Paul Brook wrote: +/* If a VEX prefix is used then it must have V=b */ +#define CHECK_AVX_V0(s) do { \ +CHECK_AVX(s); \ +if ((s->prefix & PREFIX_VEX) && (s->vex_v != 0)) \ +goto illegal_op; \ +} while (0) + What do you think about #define CHECK_AVX(s,

Re: [PATCH v2 07/42] Enforce VEX encoding restrictions

2022-04-25 Thread Richard Henderson
On 4/24/22 15:01, Paul Brook wrote: Add CHECK_AVX* macros, and use them to validate VEX encoded AVX instructions All AVX instructions require both CPU and OS support, this is encapsulated by HF_AVX_EN. Some also require specific values in the VEX.L and VEX.V fields. Some (mostly integer

Re: [PATCH v2 07/42] Enforce VEX encoding restrictions

2022-04-25 Thread Richard Henderson
On 4/24/22 15:01, Paul Brook wrote: +/* + * VEX encodings require AVX + * Allow legacy SSE encodings even if AVX not enabled + */ +#define CHECK_AVX(s) do { \ +if ((s->prefix & PREFIX_VEX) \ +&& !(env->hflags & HF_AVX_EN_MASK)) \ +goto illegal_op; \ +} while (0)

[PATCH v2 07/42] Enforce VEX encoding restrictions

2022-04-24 Thread Paul Brook
Add CHECK_AVX* macros, and use them to validate VEX encoded AVX instructions All AVX instructions require both CPU and OS support, this is encapsulated by HF_AVX_EN. Some also require specific values in the VEX.L and VEX.V fields. Some (mostly integer operations) also require AVX2