> Followup to: <Pine.LNX.3.95.991028082803.6412A-100000@chaos.analogic.com>
> By author: "Richard B. Johnson" <root@chaos.analogic.com>
> In newsgroup: linux.dev.kernel
> >
> > It is perfectly correct to move a longword to a segment register. This
> > removes the generation of the 0x66 prefix which is more code which
> > has to be fetched, slowing down execution.
> >
>
> Actually, it's not. It's just that gas improperly thinks there is a
> distinction. I consider this to be a gas bug.
>
> movw %ax,%es
>
> ... should be the *only* legal form, and it should *never* generate a
> prefix.
>
Not. Look at page 26-210, the '*'. About protected mode moves to
segment registers, of the Intel Rag., ISBN 1-55512-159-4, Intel 486
Programmer's reference manual. Also page 26-2, Table 26-1, Effective
size attributes.
There is no movw in Intel syntax nor is there a movl.
In Intel, if the segment size (the D bit in the segment descriptor),
is set to 32 bits, every instruction that uses 16 bit registers requires
the address-size prefix because this is the only thing that shows
the processor the difference.
If a move to a segment register does not require a segment-override,
then the address-size prefix is not required. This saves an opcode.
For instance,
(Intel dest<-source) 32-bit operation.
mov ds,eax ; Is allowed (no prefix generated)
mov ds,ax ; Is allowed (prefix is generated)
mov ds, cs:[foo] ; A prefix is generated and required.
mov ds, [foo] ; A prefix is not generated nor required
In all cases, only the low 16-bits are moved into the
segment register. And, in protected mode, this must
refer to a valid segment descriptor.
I'm sure Intel would like to hear from you if you have a devised
a better way to use their processors, or if you have discovered
that their documentation is wrong.
Cheers,
Dick Johnson
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/