-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve intel instruction & operand formatting #1463
improve intel instruction & operand formatting #1463
Conversation
This fixes three issues when formatting an x86_64 instruction or its operands: 1) Fix the order of operands when formatting the instruction to be the AT&T syntax order. If the instruction had three or more operands. Conversion from the internal (Intel) order rotated right by 1 instead of reversing the operands. 2) Eliminate special treatment of register %kN as the first operand as mask registers in Instruction::format as Operand::format already formats these as masks (enclosed in braces) and not all uses of mask registers are as a mask. 3) Fix Operand::format to produce the correct disassembly operand string. The formatting of the internal Expression needs to be done for some indirect values. This was done in the Instruction::format instead of directly in Operand::format * x86Formatter::getInstructionString - fixes 1, 2, 3 * Operand::format - fixes 3 * x86Formatter::formatRegister - cleanup, remove malloc that could leak
} else { | ||
source_ops += "," + op; | ||
} | ||
std::string s; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a quick comment with an example? On first pass, I missed the 'r' in crbegin
.
Since we're in here fixing things, we might as well change the param to a const&
. But I'll let you decide if you want to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment. What type of example are looking for?
I was going to update the ArchSpecificFormatter interface to use const refs for vectors and strings for all the methods in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess an example wouldn't really be helpful here.
} else { | ||
source_ops += "," + op; | ||
} | ||
std::string s; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess an example wouldn't really be helpful here.
This fixes three issues when formatting an x86_64 instruction or its operands:
Fix the order of operands when formatting the instruction to be the
AT&T syntax order. If the instruction had three or more operands.
Conversion from the internal (Intel) order rotated right by 1 instead
of reversing the operands.
Fixes Fix x86_64 instruction formatting for >2 operands #1459
Eliminate special treatment of register %kN as the first operand as
mask registers in Instruction::format as Operand::format already
formats these as masks (enclosed in braces) and not all uses of mask
registers are as a mask.
Fixes formatting x86_64 instruction incorrectly makes kN registers masks in some cases #1461
Fix Operand::format to produce the correct disassembly operand
string. The formatting of the internal Expression needs to be done
for some indirect values. This was done in the Instruction::format
instead of directly in Operand::format
Fixes Intel X86_64 operand formatting is incorrect #1460
Methods changed: