Fix disassembly error in issue #193 #195
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The specific issue was caused by incorrect placement of operands in is_class in disasm.c
The issue fixes the specific bug shown in the issue as well as for the same instructions with a larger register size. The initial push itself has a commit with more technical details:
3ec5afd
"Fixed issue #193 by switching operand order of is_class at disasm/disasm.c:1519
Incorrect ordering led to specific encoding for implicit shift by one (M1 - UNITY from include/opflags.h & x86/insnsd.c) being skipped over in disasm.c:1519.
The skip over the UNITY block would lead to the code ending up at disasm.c:1569, adding 0x0 to the end of the instruction and moving onwards having emitted the incorrect instruction.
The correction of is_class is consistent with other usage of is_class in the disasm.c file and its signature in include/opflags.h ( static inline bool is_class(opflags_t class, opflags_t op) ); the error was placement of t in class and unity in op respectively."
Thank you for reading this and let me know if you need any changes or anything else involving this. I did forget to turn on the workflow runner when I forked this repository so I needed to just make a push to the branch so it would run and test the changes, so those are the extra two commits after the first commit.