将较小的操作数移入较大的操作数 [英] Move smaller operand into larger operand

查看:138
本文介绍了将较小的操作数移入较大的操作数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在想像如何将数据移入RAX寄存器时遇到了一些麻烦。

I'm having a little trouble with imagining how data moves into the RAX register.

以下是汇编语言:

.data
dwordVal DWORD 94326732h
.code
mov rax, 0FFFFFFFF00000000h
mov rax, dwordVal

我读到不能用MOV将较小的操作数移动到较大的操作数。在我看来,dwordVal只会填充64位rax寄存器的下半部分,因此这是不允许的。

I read that you cannot move a smaller operand into a larger operand with MOV. It seems to me that dwordVal would only fill the lower half of the 64 bit rax register, so this would not be permitted. Please correct me if I'm wrong.

推荐答案

A mov 指令始终会用一个与目标操作数大小完全相同的完整值填充目标操作数。

A mov instruction will always fill the destination operand with a complete value, of exactly the same size as the destination operand.

因此,您的理解是错误的。您不能用 mov 填充 rax 的一部分。

So, your understanding is incorrect. You cannot fill part of rax with a mov.

正如Jester在评论中已经说过的那样, mov rax,dwordVal 的确切结果取决于汇编程序遵循的约定,而某些汇编程序实际上会

As Jester has already said in a comment, precisely what will happen as a result of that mov rax, dwordVal depends on the conventions followed by your assembler, and some assemblers would actually reject such a thing as illegal.

我可以告诉你的一件事是, rax 来自先前加载到其中的 0FFFFFFFF00000000h

One thing I can tell you is that there will be absolutely nothing left in rax from that 0FFFFFFFF00000000h that was previously loaded into it.

这篇关于将较小的操作数移入较大的操作数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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