NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
49.09k stars 5.65k forks source link

x86: Add constraint to mod field of instructions that can only encode registers #6565

Open Sleigh-InSPECtor opened 1 month ago

Sleigh-InSPECtor commented 1 month ago

The 0fc5 encoding for PEXTRW can only encode register values so ModRM.mod must be equal to 3. Currently, the SLEIGH specification just ignores the ModRM.mod field when decoding PEXTRW, however any case where ModRM.mod!=1 should be treated as invalid instruction. The same thing is also true for the MOVQ2DQ instruction.

This PR adds the additional constraint to the PEXTRW and MOVQ2DQ constructors.

e.g.,