-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[MC] Disassembler does not support x86 instruction prefixes #8081
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
Comments
This is still broken. |
disclaimer: my knowledge of llvm internals is almost non-existent. The issue here might be this: REP/REPNE/etc are treated as instruction and instruction modifiers (ATTR_XS). So X86DisassemblerDecoder.c:readPrefixes consumes the prefix byte, and later the prefix is converted into an ATTR flag. Commenting I don't see any straightforward solution to this conundrum. It seems that, to properly fix this, the readPrefixes would have to check following bytes and if they match one of those instructions that use prefix (ex. XS) attribute, it should consume the prefix. In all other cases it should unconsumeByte. This solution is very yucky, since it would require X86DisassemblerDecoder.c to know things that only *.td files should know :( |
More test cases for rep prefix from the Intel ISA ref, p 4-316: With r140997: |
Kevin Enderby has provided a partial fix for "lock": Although it looks like "lock" is printed before the instruction rather than as a prefix. |
Yep the problem is that in the translation from the internal form to an MCINST there is no way to represent as part of the MCINST. So my partial fix was to pick off the lock prefix if it is the first prefix and let it get created as its own MCINST which will get it to print. |
Also the segment override prefix gets ignored |
All these issues were fixed before Revision: 312105. |
Correct me if I'm wrong, but: So we need to reopen this bug. |
You're right: it will be fixed when D37262 is committed. |
Fixed with rL315899. |
Extended Description
Following instructions from http://blog.llvm.org/2010/01/x86-disassembler.html:
echo '0xF3 0xAD' | llvm-mc -disassemble -triple=x86_64-apple-darwin9
outputs:
lodsl
instead of the correct sequence
rep lodsl
The text was updated successfully, but these errors were encountered: