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
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?
I am aware of http://ref.x86asm.net/, but looking at 48 opcodes, I don't see anything that resembles a move.
The x86 opcode bytes are 8-bit equivalents of iii field that we discussed in simplified encoding. This provides for up to 512 different instruction classes, although the x86 does not yet use them all.
states that the current x86-64 design “contains 981 unique mnemonics and a total of 3,684 instruction variants” [2]. However they do not specify which features are included in their count.
It is used to produce object code for the x86 class of processors. Regarded as a programming language, assembly is machine-specific and low-level. Like all assembly languages, x86 assembly uses mnemonics to represent fundamental CPU instructions, or machine code.
The x86 instruction set refers to the set of instructions that x86-compatible microprocessors support. The instructions are usually part of an executable program, often stored as a computer file and executed on the processor.
Actually, mov
is 0xc7 there; 0x48 is, in this case, a long mode REX.W prefix.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With