assembly - NASM:解析器:指令预期 rep movs

标签 assembly x86 nasm

我一直在将可执行文件转换为一些 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 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.

因此要使用的代码是rep movsd

关于assembly - NASM:解析器:指令预期 rep movs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31364332/

相关文章:

io - 内存和 IO 带宽之间有什么区别,我们如何测量它们?

java - Java 中的连续页面/物理内存

assembly - 为什么这不打印 X?集会

linux - 如何在汇编 NASM 中打印数字?

linux - basic linux x86 assembly minimum number 返回不正确

c - MASM 函数未返回正确的值

assembly - 使用 nasm 在程序集中调用 fscanf

c++ - 如何为c++代码找到对应的程序集

c++ - 为什么这个汇编代码更快?