NASM: parser: instruction expected rep movs

后端 未结 3 1755
故里飘歌
故里飘歌 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:00

    That just looks like some overly verbose outout from a disassembler.

    Quoting from Intel's manual (the section named String Instructions):

    By default, the ESI register addresses the segment identified with the DS segment register. ... The EDI register addresses the segment identified with the ES segment register.
    ...
    The MOVS instruction moves the string element addressed by the ESI register to the location addressed by the EDI register. The assembler recognizes three “short forms” of this instruction, which specify the size of the string to be moved: MOVSB (move byte string), MOVSW (move word string), and MOVSD (move doubleword string).

    So if we apply that information we end up with:

    ; DWORD operands means movsd, ds:[esi] is the default source, and
    ; es:[edi] is the default destination
    rep movsd
    

    Note: in the description for MOVS in Intel's manual, MOVS m32, m32 is listed as supported. They call this the “explicit-operands” form of the instruction. It only serves a documentational purpose, since the only allowed source is [(R|E)SI] and the only allowed destination is [(R|E)DI]. I don't know whether or not NASM supports the explicit-operands form, or what the syntax for it is in that case.

提交回复
热议问题