我如何解释这个 x86_64 汇编操作码? [英] How do I interpet this x86_64 assembly opcode?
问题描述
在我的 Mac 上查看 x86_64 的一些汇编代码,我看到以下说明:
Looking at some assembly code for x86_64 on my Mac, I see the following instruction:
48 c7 c0 01 00 00 00 movq $0x1,%rax
但是我在任何地方都找不到分解操作码的参考.好像 48c7 是一个移动指令,c0 定义了 %rax 寄存器,等等.
But nowhere can I find a reference that breaks down the opcode. It seems like 48c7 is a move instruction, c0 defines the %rax register, etc.
那么,我在哪里可以找到告诉我所有这些的参考资料?
So, where can I find a reference that tells me all that?
我知道 http://ref.x86asm.net/,但是查看了 48 个操作码,我没有看到任何类似于移动的东西.
I am aware of http://ref.x86asm.net/, but looking at 48 opcodes, I don't see anything that resembles a move.
推荐答案
实际上,mov
是 0xc7 在那里;在这种情况下,0x48 是一个长模式 REX.W 前缀.
Actually, mov
is 0xc7 there; 0x48 is, in this case, a long mode REX.W prefix.
也在评论中回答问题:0xc0 是 b11000000.这里你可以用REX.B = 0code>(因为 REX 前缀是 0x48,.B 位未设置),0xc0 表示RAX 是第一个操作数"(在 Intel 语法中;
mov rax, 1
,RAX 是第一个,或者,如果mov
,输出操作数).您可以在此处了解如何阅读 ModR/M.
Answering also the question in comments: 0xc0 is b11000000. Here you can find out that with REX.B = 0
(as REX prefix is 0x48, the .B bit is unset), 0xc0 means "RAX is first operand" (in Intel syntax; mov rax, 1
, RAX is first, or, in case of mov
, output operand). You can find out how to read ModR/M here.
这篇关于我如何解释这个 x86_64 汇编操作码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!