public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>, Michael Matz <matz@suse.de>
Subject: Re: [committed, PATCH] Remove Disp16|Disp32 from 64-bit direct branches
Date: Wed, 13 May 2015 11:35:00 -0000	[thread overview]
Message-ID: <CAMe9rOrNtj+emYh-=1YRKrb7vuDPOAbdSWeX21JWABtATWaOfg@mail.gmail.com> (raw)
In-Reply-To: <555308DB0200007800079CDA@mail.emea.novell.com>

On Tue, May 12, 2015 at 11:18 PM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 12.05.15 at 18:08, <hjl.tools@gmail.com> wrote:
>> On Tue, May 12, 2015 at 9:03 AM, Michael Matz <matz@suse.de> wrote:
>>> Hi,
>>>
>>> On Tue, 12 May 2015, H.J. Lu wrote:
>>>
>>>> On Tue, May 12, 2015 at 8:47 AM, Michael Matz <matz@suse.de> wrote:
>>>> > Hi,
>>>> >
>>>> > On Tue, 12 May 2015, H.J. Lu wrote:
>>>> >
>>>> >> > Actually also that one is correctly printed I think (from a hello world
>>>> >> > main, where I added a jmprel16 +0):
>>>> >> >
>>>> >> > 000000000040055c <main>:
>>>> >> >   40055c:       55                      push   %rbp
>>>> >> >   40055d:       48 89 e5                mov    %rsp,%rbp
>>>> >> >   400560:       48 83 ec 30             sub    $0x30,%rsp
>>>> >> >   400564:       c6 45 d1 00             movb   $0x0,-0x2f(%rbp)
>>>> >> >   400568:       c6 45 d0 61             movb   $0x61,-0x30(%rbp)
>>>> >> >   40056c:       48 8d 45 d0             lea    -0x30(%rbp),%rax
>>>> >> >   400570:       48 89 c2                mov    %rax,%rdx
>>>> >> >   400573:       be 44 06 40 00          mov    $0x400644,%esi
>>>> >> >   400578:       66 e9 00 00             jmpw   57c <_init-0x3ffe8c>
>>>> >> >
>>>> >> > 000000000040057c <next>:
>>>> >> >   40057c:       bf 52 06 40 00          mov    $0x400652,%edi
>>>> >> >   ...
>>>> >> >
>>>> >> > It shows that rip is going to be truncated.
>>>> >> >
>>>> >>
>>>> >> This is the same issue as
>>>> >>
>>>> >> https://sourceware.org/bugzilla/show_bug.cgi?id=18386
>>>> >>
>>>> >> On Intel processors, 0x66 prefix before direct 32-bit unconditional
>>>> >> call/jmp is ignored.  Whatever we do is wrong on AMD or Intel
>>>> >> processors.
>>>> >
>>>> > Well, in that case I'd say the correct thing to do is to _not_ do any
>>>>
>>>> This is NO correct thing to do.
>>>
>>> Well, what do you suggest?  Your change is clearly wrong as well.
>>
>> I won't call it wrong since it implies there is a right.  Given that
>>
>> 0x66 jmp/call rel32
>>
>> works on Intel processors and crashes on AMD processors.
>
> What _works_ on Intel processors is secondary here. Fact is that
> the x86-64 design came from AMD, and hence Intel CPUs doing
> things differently than AMD's is - be honest - a flaw. The more

I don't think who came first is relevant here.  What relevant are

1. AMD and Intel specs are different.
2. There is no real usage for AMD spec.
3. There is a bug report against Intel spec.

> that by analogy with 32-bit mode, an operand size prefix on
> branches ought to truncate rIP. Plus (other than my own testing
> says) you seem to suggest that this isn't even consistent on Intel
> CPUs, as you specifically say "unconditional" above and you also
> only changed those.

Please open a bug report against Jcc and I will look into it.

>> I will keep my change in unlessl someone can show a real usage of
>>
>> 066 jmp/call rel16
>>
>> on AMD processors.
>
> That's the wrong position, you have to show that the change is
> useful - I certainly can't see why you'd need the operand size

https://sourceware.org/bugzilla/show_bug.cgi?id=18386

> prefix when (on Intel CPUs) it has no effect whatsoever.
> Together with it not being generally usable (due to the vendor
> differences), I view the change as pointless _and_ breaking
> compatibility (i.e. both by themselves a reason to revert).
>


-- 
H.J.

  reply	other threads:[~2015-05-13 11:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 21:23 H.J. Lu
2015-05-12 10:41 ` Jan Beulich
2015-05-12 11:54   ` H.J. Lu
2015-05-12 12:20     ` Jan Beulich
2015-05-12 12:37       ` H.J. Lu
2015-05-12 13:03         ` Jan Beulich
2015-05-12 13:37           ` H.J. Lu
2015-05-12 13:49             ` Michael Matz
2015-05-12 13:57               ` H.J. Lu
2015-05-12 14:31                 ` Michael Matz
2015-05-12 14:49                   ` H.J. Lu
2015-05-12 15:14                     ` Michael Matz
2015-05-12 15:21                       ` H.J. Lu
2015-05-12 15:32                         ` Michael Matz
2015-05-12 14:59             ` Jan Beulich
2015-05-12 15:03               ` H.J. Lu
2015-05-12 15:09                 ` Jan Beulich
2015-05-12 15:11                   ` H.J. Lu
2015-05-12 15:17                     ` Jan Beulich
2015-05-12 15:37                       ` Michael Matz
2015-05-12 15:43                         ` H.J. Lu
2015-05-12 15:47                           ` Michael Matz
2015-05-12 16:00                             ` H.J. Lu
2015-05-12 16:03                               ` Michael Matz
2015-05-12 16:08                                 ` H.J. Lu
2015-05-13  6:18                                   ` Jan Beulich
2015-05-13 11:35                                     ` H.J. Lu [this message]
2015-05-13 12:27                                       ` Jan Beulich
2015-05-13 13:15                                         ` H.J. Lu
2015-05-13 12:34                                   ` Michael Matz
2015-05-13 13:32                                     ` H.J. Lu
2015-05-13 16:50                                       ` Maciej W. Rozycki
2015-05-13 16:53                                         ` H.J. Lu
2015-05-15  6:39                                           ` Jan Beulich
2015-05-15 16:52                                             ` H.J. Lu
2015-05-18  7:05                                               ` Jan Beulich
2015-05-18 11:22                                                 ` H.J. Lu
2015-05-18 11:48                                                   ` Jan Beulich
2015-05-18 12:18                                                     ` H.J. Lu

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='CAMe9rOrNtj+emYh-=1YRKrb7vuDPOAbdSWeX21JWABtATWaOfg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=matz@suse.de \
    /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).