BinaryAnalysisPlatform / bap

Binary Analysis Platform
MIT License
2.07k stars 273 forks source link

fixes register assignments in p-code semantics #1455

Closed ivg closed 2 years ago

ivg commented 2 years ago

In p-code the lower parts of registers are referenced as variables with the same name as the base register but with the size equal to the size of the referenced part, e.g., YMM0:64 refers to the lower 64 bits of the YMM0 register. The semantics of assignemnt assumes that the upper parts are preserved.

This commit implements the proper semantics of the set# operator, i.e., it extends the right-hand side to the size of the base register, and properly ORs it with the left-hand side.

Note, the fix also touches the setw macro from #1454. It was still correct, since all uses of setw was properly typed (unlike p-code), but the new version is more consistent and more general as it now allows the right-hand side to have a different type.