[PATCH 4/6] x86/MPX: bndmk, bndldx, and bndstx only allow a memory operand

H.J. Lu hjl.tools@gmail.com
Wed Oct 9 15:17:00 GMT 2013


On Wed, Oct 9, 2013 at 12:24 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 08.10.13 at 17:28, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>> On Tue, Oct 8, 2013 at 7:43 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>> bndmk, bndldx, and bndstx only allow memory operands, so decoding should
>>> use OP_M() instead of OP_E().
>>
>> The change isn't wrong.  But register operand will never be used since
>> MOD != 3.  Also, in this case, only register operand is possible for nop
>> since MOD == 0x3.  If we want to make the change, we should also
>> replace Ev with Gv.
>
> Looks like I didn't look at mod_table[]'s usage closely enough - I
> guess for consistency reasons I'll withdraw the patch rather than
> extending it (even though performance would perhaps be slightly
> improved by using the more specific operand handling routines
> here, but that would be the case for various other code paths /
> table entries too I believe).
>

We have

static void
OP_M (int bytemode, int sizeflag)
{
  if (modrm.mod == 3)
    /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
    BadOp ();
  else
    OP_E (bytemode, sizeflag);
}

OP_M will be slower than OP_E.  With mod_table, we can get rid
rid of OP_M.  A patch is welcome.

-- 
H.J.



More information about the Binutils mailing list