From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH, v2] x86-64: correct segment override prefix generation
Date: Tue, 07 Aug 2012 14:03:00 -0000 [thread overview]
Message-ID: <CAMe9rOo_yqJtGqZZih2vRYCVKxhgWM+V6k=qhWdw4n+UfT4udg@mail.gmail.com> (raw)
In-Reply-To: <5021389B0200007800093459@nat28.tlf.novell.com>
On Tue, Aug 7, 2012 at 6:47 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 07.08.12 at 15:44, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>> On Tue, Aug 7, 2012 at 3:32 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>>> On 30.07.12 at 19:03, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>>>> Please provide a testcase to show the correct behavior.
>>>
>>> Here you go.
>>>
>>> Jan
>>>
>>> Despite them being ignored by the CPU, gas issues segment override
>>> prefixes for other than FS/GS in 64-bit mode. If doing so at all, it
>>> should clearly do this correctly. Determining the default segment,
>>> however, requires to take into consideration RegRex (so far, RSP, RBP,
>>> R12, and R13 were all treated equally here).
>>>
>>> gas/
>>> 2012-08-07 Jan Beulich <jbeulich@suse.com>
>>> * config/tc-i386-intel.c (build_modrm_byte): Split determining
>>> default segment from figuring out encoding. Honor RegRex for
>>> the former.
>>>
>>> gas/testsuite/
>>> 2012-08-07 Jan Beulich <jbeulich@suse.com>
>>>
>>> * gas/i386/x86-64-segovr.{s,l}: New.
>>> * gas/i386/i386.exp: Run new test.
>>>
>>> --- 2012-08-07/gas/config/tc-i386.c 2012-07-31 09:45:03.000000000 +0200
>>> +++ 2012-08-07/gas/config/tc-i386.c 2012-08-07 12:13:39.000000000 +0200
>>> @@ -5729,18 +5729,14 @@ build_modrm_byte (void)
>>> i.sib.base = i.base_reg->reg_num;
>>> /* x86-64 ignores REX prefix bit here to avoid decoder
>>> complications. */
>>> - if ((i.base_reg->reg_num & 7) == EBP_REG_NUM)
>>> - {
>>> + if (!(i.base_reg->reg_flags & RegRex)
>>> + && (i.base_reg->reg_num == EBP_REG_NUM
>>> + || i.base_reg->reg_num == ESP_REG_NUM))
>>> default_seg = &ss;
>>> - if (i.disp_operands == 0)
>>> - {
>>> - fake_zero_displacement = 1;
>>> - i.types[op].bitfield.disp8 = 1;
>>> - }
>>> - }
>>> - else if (i.base_reg->reg_num == ESP_REG_NUM)
>>> + if (i.base_reg->reg_num == 5 && i.disp_operands == 0)
>>
>> Please use EBP_REG_NUM instead 5 here.
>
> But that change was intentional - we're _not_ looking for EBP here,
> we're looking for "EBP or R13". The previous use of EBP_REG_NUM
> was part of why this was broken imo.
>
>> OK with the EBP_REG_NUM change above if Linux x86-64 kernel
>> compiles and runs.
>
> Sure, that has been the case for many weeks already.
>
OK then.
Thanks.
--
H.J.
prev parent reply other threads:[~2012-08-07 14:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 15:28 [PATCH] " Jan Beulich
2012-07-30 17:04 ` H.J. Lu
2012-08-07 10:42 ` [PATCH, v2] " Jan Beulich
2012-08-07 13:46 ` H.J. Lu
2012-08-07 13:56 ` Jan Beulich
2012-08-07 14:03 ` H.J. Lu [this message]
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='CAMe9rOo_yqJtGqZZih2vRYCVKxhgWM+V6k=qhWdw4n+UfT4udg@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=JBeulich@suse.com \
--cc=binutils@sourceware.org \
/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).