movq和64位数字 [英] movq and 64 bit numbers

查看:212
本文介绍了movq和64位数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我写一个寄存器时,一切都很好,

When I write to a register, everything is fine,

movq  $0xffffffffffffffff, %rax

但是我收到错误消息:当我写入内存位置时,操作数大小不匹配

But I get Error: operand size mismatch when I write to a memory location,

movq  $0xffffffffffffffff, -8(%rbp)

那是为什么?我在经过编译的C代码中看到,在asm中,这些数字被分为两个,并且显示了两个movl指令.

Why is that? I see in compiled C code that in asm these numbers are split in two and two movl instructions show up.

也许您可以告诉我有关mowq和其他说明的地方.

Maybe you can tell me where the mowq and other instructions are documented.

推荐答案

那是为什么?

因为MOV r64, imm64是有效的x86指令,但MOV r/m64, imm64不是(没有编码).

Because MOV r64, imm64 is a valid x86 instruction, but MOV r/m64, imm64 is not (there's no encoding for it).

我在编译后的C代码中看到,在asm中,这些数字被分为两个,并且显示了两个movl指令.

I see in compiled C code that in asm these numbers are split in two and two movl instructions show up.

MOV r/m64, imm32是有效的x86指令,这就是为什么您看到其中两个被用来将64位立即数存储到内存中的原因.

MOV r/m64, imm32 is a valid x86 instruction, which is why you see two of them being used to store a 64-bit immediate to memory.

也许您可以告诉我有关mowq和其他说明的地方

Maybe you can tell me where the mowq and other instructions are documented

英特尔的软件开发人员手册中.

这篇关于movq和64位数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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