<div dir="ltr">Wouldn't changing<br><br><div style="color:rgb(80,0,80);font-size:13px">    case TYPE_MM:                                         \</div><div style="color:rgb(80,0,80);font-size:13px">      if (index > 7)                                      \</div><div style="color:rgb(80,0,80);font-size:13px">        *valid = 0;                                       \</div><div style="color:rgb(80,0,80);font-size:13px">      return prefix##_MM0 + index;<br><br><br>to<br><br><div>    case TYPE_MM:                                         \</div><div>      return prefix##_MM0 + (index & 0x7);</div><div><br></div><div><br></div><div>Fix the issue for both rex.b and rex.r?</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 23, 2014 at 10:54 PM, Jun Koi <span dir="ltr"><<a href="mailto:junkoi2004@gmail.com" target="_blank">junkoi2004@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Dec 24, 2014 at 2:43 PM, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I believe this particular error is caused by this. That seems easy enough to just drop the bit. Do you have other non-mmx examples?<div><br></div><div><div>    case TYPE_MM:                                         \</div><div>      if (index > 7)                                      \</div><div>        *valid = 0;                                       \</div><div>      return prefix##_MM0 + index;</div></div></div></blockquote><div><br></div></span><div>yes, exactly this place. but the question is: how do we know when to drop the REX.B?<br><br><br></div><div>i dont know any non-MMX examples. it seems only MMX related instructions have this issue.<br><br></div><div>thanks,<br></div><div>Jun<br><br><br> <br></div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div><div><br><div class="gmail_quote">On Tue, Dec 23, 2014 at 10:17 PM, Jun Koi <span dir="ltr"><<a href="mailto:junkoi2004@gmail.com" target="_blank">junkoi2004@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>hi,<br><br></div>i think the current X86 disassembler is quite broken and fails badly on handling REX for x86_64 code.<br><br></div>below are some examples:<br><br>$ echo "0x0f,0xeb,0xc3"|./Release+Asserts/bin/llvm-mc -disassemble -triple=x86_64<br>    .text<br>    por    %mm3, %mm0<br><br>$ echo "0x40,0x0f,0xeb,0xc3"|./Release+Asserts/bin/llvm-mc -disassemble -triple=x86_64<br>    .text<br>    por    %mm3, %mm0<br><br>$ echo "0x41,0x0f,0xeb,0xc3"|./Release+Asserts/bin/llvm-mc -disassemble -triple=x86_64<br>    .text<br><stdin>:1:1: warning: invalid instruction encoding<br>0x41,0x0f,0xeb,0xc3<br>^<br><br><br></div>the last example should also return "por %mm3, %mm0", but it fails to understand the input.<br><br>the reason stays with this line in X86DisassemblerDecoder.cpp:<br><br>    rm  |= bFromREX(insn->rexPrefix) << 3;<br><br></div>we can see that we take into account REX.B, but for "por" (0F EB), this should be ignored.<br><br></div>there are quite a lot of other instructions taking into account REX like this, while according to the manual, REX should be ignored.<br><br></div>i dont see any clean solution for this issue without some significant changes into the way we decode ModRM & providing more information to .td files.<br><br>any idea?<br><br></div>thanks.<span><font color="#888888"><br></font></span></div><span><font color="#888888">Jun<br></font></span></div>
</blockquote></div><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div>~Craig</div>
</font></span></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature">~Craig</div>
</div>