This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH 2/6] x86/MPX: fix address size handling
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: <kirill dot yukhin at intel dot com>,"Binutils" <binutils at sourceware dot org>
- Date: Wed, 09 Oct 2013 08:30:04 +0100
- Subject: Re: [PATCH 2/6] x86/MPX: fix address size handling
- Authentication-results: sourceware.org; auth=none
- References: <5254349502000078000F9A3D at nat28 dot tlf dot novell dot com> <525435BC02000078000F9A51 at nat28 dot tlf dot novell dot com> <CAMe9rOrZuQRgcaUNgex=MDFjKYxsJimK1aCMqzEyM2XbZXCo4w at mail dot gmail dot com> <52543EE302000078000F9AF4 at nat28 dot tlf dot novell dot com> <CAMe9rOo82eK4oS8YAPKS0DDRktyiCUc16OqxDH4ujihKjmA7vA at mail dot gmail dot com>
>>> On 08.10.13 at 17:32, "H.J. Lu" <email@example.com> wrote:
> On Tue, Oct 8, 2013 at 8:20 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>> On 08.10.13 at 17:15, "H.J. Lu" <firstname.lastname@example.org> wrote:
>>> On Tue, Oct 8, 2013 at 7:41 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> While address overrides are ignored in 64-bit mode (and hence shouldn't
>>>> result in an error), trying to use 16-bit addressing is documented to
>>>> result in #UD, and hence the assembler should reject the attempt.
>>>> 2013-10-08 Jan Beulich <email@example.com>
>>>> * tc-i386.c (md_assemble): Alter address size checking for MPX
>>>> --- 2013-10-07/gas/config/tc-i386.c
>>>> +++ 2013-10-07/gas/config/tc-i386.c
>>>> @@ -3549,10 +3549,15 @@ md_assemble (char *line)
>>>> if (i.bnd_prefix && !i.tm.opcode_modifier.bndprefixok)
>>>> as_bad (_("expecting valid branch instruction after `bnd'"));
>>>> - if (i.tm.cpu_flags.bitfield.cpumpx
>>>> - && flag_code == CODE_64BIT
>>>> - && i.prefix[ADDR_PREFIX])
>>>> - as_bad (_("32-bit address isn't allowed in 64-bit MPX instructions."));
>>> It is done on purpose. When 32-bit address prefix in 64-bit is ignored,
>>> MPX doesn't work correctly for x32.
>> I don't understand: It _is_ being ignored by the hardware as per
>> the documentation. So x32 need to get along with that. Maybe
>> an example would help, so I could understand why you think
>> this _needs_ to be an error...
> X32 won't work with MPX since hardware assumes pointer
> size is always 64 bit in 64-bit mode with or without address
> size prefix. MPX depends on correct pointer size to work.
> I don't want people to use MPX in x32 by accident.
This seems even more odd - why would x32 be excluded from
using MPX? Again - an example might help, as my understanding
so far was that the implicit zero extension of results of 32-bit
operations should guarantee the half width pointers to be quite
fine to use as full width values (i.e. in other memory operands
I don't see why you would want to use 32-bit addressing either,
except when the wraparound case matters, as might e.g. be
the case with EIP-relative addressing).
And in any case - the assembler shouldn't enforce policy, it
should only enforce architectural restrictions.
Bottom line - I continue to be convinced that the diagnostic
we talk about here ought to be a warning, not an error (at
least by default).