[PATCH] X86: Disassemble primary opcode map's group 2 ModRM.reg == 6 aliases correctly

Jan Beulich JBeulich@suse.com
Tue May 30 15:05:00 GMT 2017


>>> On 30.05.17 at 16:53, <hjl.tools@gmail.com> wrote:
> On Tue, May 30, 2017 at 7:52 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Tue, May 30, 2017 at 7:48 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>>> On 30.05.17 at 16:43, <hjl.tools@gmail.com> wrote:
>>>> On Tue, May 30, 2017 at 7:41 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>>>>> On 30.05.17 at 16:35, <hjl.tools@gmail.com> wrote:
>>>>>> On Tue, May 30, 2017 at 1:37 AM, Borislav Petkov <bp@suse.de> wrote:
>>>>>>> On Tue, May 30, 2017 at 02:34:28AM -0600, Jan Beulich wrote:
>>>>>>>> which I think should read
>>>>>>>>
>>>>>>>> "The CF flag contains the value of the last bit shifted out of the
>>>>>>>>  destination operand; for instructions other than SAR it is undefined
>>>>>>>>  when the count is greater than or equal to the size (in bits) of
>>>>>>>>  the destination operand."
>>>>>>>
>>>>>>> Makes sense.
>>>>>>
>>>>>> I look another look.  Disassembler always display "shl".  Please
>>>>>> don't use "sal" now.
>>>>>
>>>>> Which disassembler are you talking about, as you can't mean
>>>>> objdump or anything else that's libopcode-based?
>>>>
>>>> [hjl@gnu-6 tmp]$ cat x.s
>>>> shl %cl, %eax
>>>> sal %cl, %eax
>>>> shl $1, %eax
>>>> sal $1, %eax
>>>> [hjl@gnu-6 tmp]$ gcc -c x.s
>>>> [hjl@gnu-6 tmp]$ objdump -dw x.o
>>>>
>>>> x.o:     file format elf64-x86-64
>>>>
>>>>
>>>> Disassembly of section .text:
>>>>
>>>> 0000000000000000 <.text>:
>>>>    0: d3 e0                 shl    %cl,%eax
>>>>    2: d3 e0                 shl    %cl,%eax
>>>>    4: d1 e0                 shl    %eax
>>>>    6: d1 e0                 shl    %eax
>>>> [hjl@gnu-6 tmp]$ objdump -dw -Mintel x.o
>>>>
>>>> x.o:     file format elf64-x86-64
>>>>
>>>>
>>>> Disassembly of section .text:
>>>>
>>>> 0000000000000000 <.text>:
>>>>    0: d3 e0                 shl    eax,cl
>>>>    2: d3 e0                 shl    eax,cl
>>>>    4: d1 e0                 shl    eax,1
>>>>    6: d1 e0                 shl    eax,1
>>>> [hjl@gnu-6 tmp]$
>>>
>>> Right, but here all instructions use the /4 encoding. We're talking
>>> about how to display the /6 encoding, though, and I think it would
>>> be helpful to the user if she could distinguish one from the other
>>> without having to look at the opcode bytes.
>>
>> This is adjust an opcode alias.  These aren't the only instructions with
>> identical opcodes.
>>
> 
> II meant "the same instruction with different opcodes".

But here we have the obvious opportunity to make the difference
visible. In other cases we simply have no suitable second mnemonic.

Jan



More information about the Binutils mailing list