public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Roland McGrath <mcgrathr@google.com>
Cc: Victor Khimenko <khim@google.com>, binutils@sourceware.org
Subject: Re: [RFC PATCH] Fix decoding of superfluous data32 prefix before superfluous rex.W prefix before push.
Date: Sat, 04 Aug 2012 00:30:00 -0000	[thread overview]
Message-ID: <CAMe9rOqLJ+vb2HoP_jQk-PDqMcdqwKVKA=-20S85wM9bmvFd0w@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOoDxX0hY-AUTJY1N69CwRfyVof06Rrc0z0f3Su2R-J1Ag@mail.gmail.com>

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.

  reply	other threads:[~2012-08-03 23:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03 18:47 Roland McGrath
2012-08-03 18:54 ` H.J. Lu
2012-08-03 19:52   ` H.J. Lu
2012-08-03 21:55     ` Roland McGrath
2012-08-03 22:10       ` H.J. Lu
2012-08-03 23:24   ` Roland McGrath
2012-08-03 23:36     ` H.J. Lu
2012-08-04  0:30       ` H.J. Lu [this message]
2012-08-06 20:02         ` Roland McGrath
2012-08-06 20:20           ` H.J. Lu
2012-08-06 20:34             ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOqLJ+vb2HoP_jQk-PDqMcdqwKVKA=-20S85wM9bmvFd0w@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=khim@google.com \
    --cc=mcgrathr@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).