问题描述
我一直在将可执行文件转换为某些NASM shellcode(如果相关,则用于Windows),但是我在rep指令中到处都遇到错误:解析器:预期指令"错误.
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 from rep instructions.
label_0000641:
lea edi,[esp+0x164]
label_0000648:
rep movs DWORD es:[edi],DWORD ds:[esi]
label_000064a:
and DWORD [esp+0x168],0x0
是否有一些特殊的nasm语法?我是在犯一个愚蠢的错误吗?我不知道该如何解决这些错误,真的想要一些指导.
Is there some special nasm syntax for this? Am I making a stupid mistake?I have no idea how to go about fixing these errors and would really like some guidance.
(我正在使用nasm -f bin -o out.bin test.asm进行编译)
(I'm compiling with nasm -f bin -o out.bin test.asm)
谢谢.
推荐答案
NASM将不接受rep movs DWORD es:[edi],DWORD ds:[esi]
从 NASM手册中获取; 2.2.3 NASM不存储变量类型
因此,NASM不支持LODS
,MOVS
,STOS
,SCAS
,CMPS
,INS
或OUTS
指令,而仅支持以下格式LODSB
,MOVSW
和SCASD
,它们明确指定要操作的字符串的组成部分的大小.
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
这篇关于NASM:解析器:指令预期代表动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!