cpu: add malformed legacy-prefix VEX negative controls for BMI2 #494
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/500"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by agilesh08 on 2026-11-22T07:54:54Z.
Change
Adds malformed legacy-prefix/VEX (
0x66-prefixed VEX) negative controls for the 8 BMI2 instructions (BZHI,MULX,PDEP,PEXT,RORX,SARX,SHLX,SHRX) intests/cpu/bmi2.py:iced-x86that each0x66-prefixed VEX byte sequence decodes asMnemonic.INVALIDand is rejected by the lifter's invalid-instruction diagnostic.iced-x86that stripping the leading0x66byte decodes to the valid unprefixed 32-bit BMI2 neighbor (bzhi eax, ecx, eax, etc.).Verification
tests/cpu/bmi2.pywith"D:\XboxToWin repo\.venv\Scripts\python.exe" -B(passed, exit code 0).python -B tests/form_coverage_check.py: passed (exit code 0).python -B tests/docs_links_check.pyandtests/bidi_controls_check.py: 0 errors.git -c core.whitespace=cr-at-eol diff --check: 0 errors.Evidence and follow-up
Uses 100% synthetic in-memory byte sequences decoded with
iced-x86. No commercial binaries or copyrighted dumps are included.Assisted by AI.
Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T08:08:09Z.
Review: CHANGES_REQUESTED
I reproduced this on 910f407 with the repository's iced-x86 decoder. The first word sequence starts with an invalid instruction: removing 66h decodes as
bzhi eax,ecx,eax. The new check therefore passes on the generic invalid-opcode diagnostic, before reaching the BMI2 lowering. The diff also introduces no new positive input vectors or flag comparisons. Please describe these as malformed legacy-prefix/VEX controls, assert that decode result explicitly with the valid unprefixed neighbor for each case, and correct the PR description (or add the advertised differential vectors). This keeps the negative coverage reproducible without claiming an encodable 16-bit BMI2 operation.Imported from R0Y00/Xbox2Windows. Originally posted by agilesh08 on 2026-11-22T09:44:05Z.
@R0Y00 Updated
feat/cpu-bmi2-followupand PR #500's title/description per your review:0x66-prefixed VEX) negative controls rather than encodable 16-bit BMI2 forms.iced-x86assertions verifying that each0x66-prefixed sequence decodes asMnemonic.INVALID(and triggers the invalid-instruction diagnostic), while stripping0x66decodes to its valid unprefixed 32-bit BMI2 neighbor.