This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: as/i386 all versions a bit too permissive with ins/outs/lods/stos


On Fri, May 17, 2002 at 04:40:15PM +0200, Etienne Lorrain wrote:
>   Just for info, if someone has time:
>   "ins" only possible with %[e]di
>   "outs" only possible with %[e]si
>   I did not find a version of "as" complaining, even if they
>   analyse this part of the instruction for segment overwrite.
> 
>   The "89 F6" at end is just a nop.
> 
> etienne@Fulbert:~$ cat tmp.s
> .text
>         insw %dx,%es:(%edi)
>         insw %dx,%es:(%esi)
> 
>         outsw %es:(%esi),%dx
>         outsw %es:(%edi),%dx

This behaviour is deliberate.  The IA-32 Intel Architecture Software
Developer's Manual says:

At the assembly-code level, two forms of this instruction are allowed:
the explicit-operands form and the no-operands form.  The explicit-
operands form (specified with the INS mnemonic) allows the source and
destination operands to be specified explicitly.  Here, the source
operand must be DX, and the destination operand should be a symbol
that indicates the size of the I/O port and the destination address.
This explicit-operands form is provided to allow documentation;
however, note that the documentation provided by this form can be
misleading.  That is, the destination operand symbol must specify the
correct type (size) of the operand (byte, word, or doubleword), but it
does not have to specify the correct location.  The location is always
specified by the ES:(E)DI registers, which must be loaded correctly
before the INS instruction is executed.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]