This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] i386-dis: fix decoding of excess prefixes on push segment register
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Roland McGrath <mcgrathr at google dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 6 Aug 2012 14:09:30 -0700
- Subject: Re: [PATCH] i386-dis: fix decoding of excess prefixes on push segment register
- References: <x57jobmnag6f.fsf@frobland.mtv.corp.google.com>
On Mon, Aug 6, 2012 at 2:01 PM, Roland McGrath <mcgrathr@google.com> wrote:
> objdump produces:
>
> 0: 0f a8 pushq %gs
> 2: 41 0f a8 pushq %bx,%di
>
> The rex.B (0x41) prefix is ignored by the hardware.
>
> The exact failure mode may differ in different builds. The bogon arises
> from reading off the end of the names_seg[] array, where what happens to
> follow is the index16[] array.
>
> After fixing that, I noticed more bugs in the separate printing of excess
> prefixes and fixed those too.
>
> With these fixes, it produces:
>
> 0: 0f a8 pushq %gs
> 2: 41 0f a8 rex.B pushq %gs
> 5: 48 0f a8 rex.W pushq %gs
> 8: 66 48 0f a8 data32 rex.W pushq %gs
> c: 48 rex.W
> d: 41 0f a8 rex.B pushq %gs
> 10: 66 48 data16 rex.W
> 12: 41 0f a8 rex.B pushq %gs
>
> I don't really understand what determines whether excess prefixes are
> printed as a separate line or before the instruction, and what
> distinguishes data32 from data16. But at least the distinction between
> what is the actual instruction and what are the unused prefixes is now
> correct.
>
> There are no other 'make check' regressions for x86_64-linux-gnu.
>
> Ok for trunk?
>
>
> Thanks,
> Roland
>
...
> opcodes/
> * i386-dis.c (print_insn): Print spaces between multiple excess
> prefixes.
Does your patch contain a testcase for this change?
--
H.J.