NASM: parser: instruction expected rep movs

后端 未结 3 1796
故里飘歌
故里飘歌 2021-01-22 04:33

I\'ve been turning an executable into some NASM shellcode (for windows if it\'s relevant) but i\'m encountering \"error: parser: instruction expected\" errors all over the place

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-22 05:10

    NASM will not accept rep movs DWORD es:[edi],DWORD ds:[esi]

    From the NASM Manual; 2.2.3 NASM Doesn't Store Variable Types

    NASM, by design, chooses not to remember the types of variables you declare. Whereas MASM will remember, on seeing var dw 0, that you declared var as a word-size variable, and will then be able to fill in the ambiguity in the size of the instruction mov var,2, NASM will deliberately remember nothing about the symbol var except where it begins, and so you must explicitly code mov word [var],2.

    For this reason, NASM doesn't support the LODS, MOVS, STOS, SCAS, CMPS, INS, or OUTS instructions, but only supports the forms such as LODSB, MOVSW, and SCASD, which explicitly specify the size of the components of the strings being manipulated.

    Thus the code to use is rep movsd

提交回复
热议问题