I'm having trouble understanding a very basic x86 instruction. The instruction is
0x080491d7 <+1>: mov %esp,%ebp
I know that it moves the value of esp into ebp. But I'm trying to understand the opcodes. The instruction is 2 bytes long, not 1 which I'm confused about. I would've thought it would only be 1 byte.
The memory for this instruction is:
0x80491d7 <main+1>: 0x89 0xe5
I know that 0x89 is one of the opcodes for MOV. I've been reading the Intel manuals. I don't know what 0xe5 is for. Is it like a suffix or another opcode value or something else? The Intel manual is a little confusing.
The c program is compiled for x86 32 bit and the Linux server is x86_64.
Yes, looking into the description of the mov instruction in the Intel Developer Manual volume 2 one may see that encoding is
8B /r, which, according to the chapter 3.1.1.1 "Opcode Column in the Instruction Summary Table" has the following meaning:/r — Indicates that the ModR/M byte of the instruction contains a register operand and an r/m operand.So the second byte is the ModR/M byte. Its meaning can be found in the Table 2-2 "32-Bit Addressing Forms with the ModR/M Byte".