I'm trying to understand how the /d affects the opcode.
Example: FF /6 PUSH r/m16 M Valid Valid Push r/m16.
How meaning is expressed?
Can anyone give me an example of the difference?
Thanks!
I'm trying to understand how the /d affects the opcode.
Example: FF /6 PUSH r/m16 M Valid Valid Push r/m16.
How meaning is expressed?
Can anyone give me an example of the difference?
Thanks!
There are actually many instructions using FF
as opcode:
INC rm16 FF /0
INC rm32 FF /0
INC rm64 FF /0
DEC rm16 FF /1
DEC rm32 FF /1
DEC rm64 FF /1
CALL rm16 FF /2
CALL rm32 FF /2
CALL rm64 FF /2
CALL FAR mem16:16 FF /3
CALL FAR mem16:32 FF /3
JMP rm16 FF /4
JMP rm32 FF /4
JMP rm64 FF /4
JMP FAR mem16:16 FF /5
JMP FAR mem16:32 FF /5
PUSH rm16 FF /6
PUSH rm32 FF /6
PUSH rm64 FF /6
As you may see, the /d part is a 3 bit sequence held in the byte following the opcode (the so called ModR/M byte), which help discriminate the correct instruction.
From the Intel reference documentation:
Many instructions that refer to an operand in memory have an addressing-form spec- ifier byte (called the ModR/M byte) following the primary opcode. The ModR/M byte contains three fields of information:
• The mod field combines with the r/m field to form 32 possible values: eight registers and 24 addressing modes.
• The reg/opcode field specifies either a register number or three more bits of opcode information. The purpose of the reg/opcode field is specified in the primary opcode.
• The r/m field can specify a register as an operand or it can be combined with the mod field to encode an addressing mode. Sometimes, certain combinations of the mod field and the r/m field is used to express opcode information for some instructions.
So that /d value is actually extracted from the reg/opcode field. When the CPU loads up the first opcode, it knows that it should read an additional byte following it, and read that field in order to complete the instruction.