我一直在将可执行文件转换为一些 NASM shellcode(对于 Windows,如果它是相关的)但我遇到了来自 rep 指令的“错误:解析器:预期指令”错误。
label_0000641:
lea edi,[esp+0x164]
label_0000648:
rep movs DWORD es:[edi],DWORD ds:[esi]
label_000064a:
and DWORD [esp+0x168],0x0
是否有一些特殊的 nasm 语法?我犯了一个愚蠢的错误吗? 我不知道如何着手解决这些错误,真的很想得到一些指导。
(我正在用 nasm -f bin -o out.bin test.asm 编译)
谢谢。
最佳答案
NASM 将不接受 rep movs DWORD es:[edi],DWORD ds:[esi]
来自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 instructionmov var,2
, NASM will deliberately remember nothing about the symbol var except where it begins, and so you must explicitly codemov word [var],2
.For this reason, NASM doesn't support the
LODS
,MOVS
,STOS
,SCAS
,CMPS
,INS
, orOUTS
instructions, but only supports the forms such asLODSB
,MOVSW
, andSCASD
, which explicitly specify the size of the components of the strings being manipulated.
因此要使用的代码是rep movsd
关于assembly - NASM:解析器:指令预期 rep movs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31364332/