This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH] Fix decoding of superfluous data32 prefix before superfluous rex.W prefix before push.


On Fri, Aug 3, 2012 at 4:24 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Aug 3, 2012 at 3:59 PM, Roland McGrath <mcgrathr@google.com> wrote:
>> I noticed that since you used #pass in the .d files, one could add more
>> cases to the end of x86-64-stack.s and not notice if one failed to update
>> all the .d files appropriately.  So I added a nop at the end, to make sure
>> that's matched last.
>>
>> What I was hoping is that you could tell me how to change:
>>
>>    0:   66 48 6a ff             data32 pushq $0xffffffffffffffff
>>    4:   66 48 68 01 02 03 04    data32 pushq $0x4030201
>>
>> into:
>>
>>    0:   66 48 6a ff             data32 rex.W pushq $0xffffffffffffffff
>>    4:   66 48 68 01 02 03 04    data32 rex.W pushq $0x4030201
>>
>> i.e., recognize that the rex.W prefix was not used, as it already
>> does when there is no data32 prefix before it.  Do you have an idea
>> to fix that?
>>
>
> There are
>
> /* Bits of REX we've already used.  */
> static int rex_used;
>
> Please make sure that it isn't set for push.

This seems to work:

diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 685e968..ed79d92 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -12275,7 +12275,7 @@ case_L:
   case 'T':
     if (!intel_syntax
         && address_mode == mode_64bit
-        && (sizeflag & DFLAG))
+        && ((rex & REX_W) || (sizeflag & DFLAG)))
       {
         *obufp++ = 'q';
         break;

We need to update some testcases.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]