Mail Archives: djgpp/1998/04/20/04:31:37
lou smith wrote:
>
> hi
>
> i dont quite understand how segment overrides work..
> does one have call ".byte 0x64" before EVERY SINGLE memory access..
> Does that mean a instruction like "rep
> stosl"
> is impossible - because each of those stores should have been
> preceded by a "byte 0x64" bytecode -- requiring an explicit ecx-type
> loop ???
In addition to what John M. Aldrich wrote:
you can write:
rep
.byte 0x64
movsl
And it will work as you would want it to (moving %ecx bytes from
%fs:%esi to %es:%edi), because ".byte 0x64" and "rep" are both prefix
bytes (that's how the CPU sees them) and not instructions of their own.
However, when the default segment register to be used is %es instead,
you cannot override, and therefore your above "rep; stosl" was a bad
example because stos[bwl] use %es. If you would want to use a different
segment register with stos[bwl] (or scas[bwl] or ins[bwl]) for some
reason, you need to rewrite it as an explicit ecx-type loop after all
indeed.
--
\ Vik /-_-_-_-_-_-_/
\___/ Heyndrickx /
\ /-_-_-_-_-_-_/
- Raw text -