NASM:解析器:指令预期代表动作 [英] NASM: parser: instruction expected rep movs

查看:65
本文介绍了NASM:解析器:指令预期代表动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在将可执行文件转换为某些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选择不记住您声明的变量的类型.尽管MASM会记住,看到var dw 0时,您已将var声明为一个字长的变量,然后可以填充指令mov var,2的大小的歧义,而NASM会刻意记住有关该符号的任何信息var,除非它在哪里开始,所以您必须显式地编写mov word [var],2的代码.

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.

因此,NASM不支持LODSMOVSSTOSSCASCMPSINSOUTS指令,而仅支持以下格式LODSBMOVSWSCASD,它们明确指定要操作的字符串的组成部分的大小.

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:解析器:指令预期代表动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆