Pergunta

I am trying to run an instruction which I took from GAS style but when I ported this instruction to intel style, I get error like:

"error: parser: instruction expected"

I tried with various combination like REP movsl, REP loadsl but all giving the same problem, Can anybody tell this right command equivalent to REP stosl in x86

Foi útil?

Solução 2

The rep ist just a prefix to indicate that the following instruction has to be repeated (E)CX times. This is only valid for a limited set of instructions though. The actual instruction is the stos in your case and it needs a type operand. b for bytes, w for word and d for dword operand size.

In your case d should be the correct operand size.

Outras dicas

I believe it is

rep stosd

For repeated store string DWORD (32 bits).

(On CPUs with the ERMSB feature, rep stosb is efficient so you don't need to imul eax, 0x01010101 to set up for rep stosd if you have a byte value instead of a dword pattern.)

You can find the stos_ instructions in the Intel instruction set reference. They use the suffixes b for 1-byte, w for 2-byte, d for 4-byte, and q for 8-byte string operations.

There's a separate manual entry for rep/repe/repne which documents every instruction it's valid with as an actual repeat prefix.

(But note that only rep stos_ and rep movs_ have Fast Strings microcode; all the conditional repe/ne cmps/scas instructions are slow on modern CPUs, only going 1 count per 1 or even 2 clocks.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top