x86汇编中的mov指令 [英] mov instruction in x86 assembly

查看:916
本文介绍了x86汇编中的mov指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我对mov的了解,它将第二个参数复制到第一个参数中.然后,这是做什么用的?

From what I've read about mov, it copies the second argument into the first argument. Then, what does this do?


movl    8(%ebp),    %edx

它将edx中的内容复制到函数的第一个参数中(因为与ebp的偏移为+8是一个参数)?

It copies whatever is in edx to the first parameter of the function (since an offset of +8 from ebp is a parameter)?

我觉得这实际上意味着将第一个参数移到edx寄存器中,但是我在Wikipedia上读到了相反的意思吗?

I feel like what this really means is moving the first parameter into the edx register, but I read on Wikipedia that it is the other way around?

推荐答案

movl 8(%ebp), %edx

位于"AT& T语法"中;按照这种语法,源是第一位,目标是第二位.是的,您的信念是正确的.大多数文档使用"Intel语法",其顺序相反.对于x86汇编新手来说,这是一个很大的困惑.

is in "AT&T Syntax"; in this syntax, the source comes first and the destination second. So yes, your belief is correct. Most documentation uses the "Intel Syntax", which has the reverse ordering. This is a source of considerable confusion for people new to x86 assembly.

在Intel语法中,您的指令将写为:

In Intel Syntax, your instruction would be written:

mov edx, [ebp + 8]

请注意,寄存器名称前没有%,地址使用方括号而不是括号,并且指令上没有l后缀.这些都是无用的赠品,可让您知道您要查看的是哪种组装形式.

Note the absence of % before the register names, and the use of square brackets instead of parentheses for the address, and the lack of an l suffix on the instruction. These are dead giveaways to know which form of assembly you are looking at.

这篇关于x86汇编中的mov指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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