The ModR/M and SIB bytes follow the opcode byte(s) in many of the processor
instructions. They contain the following information:
- The indexing type or register number to be used in
the instruction
- The register to be used, or more information to select
the instruction
- The base, index, and scale information
The ModR/M byte contains three fields of information:
- The mod field, which occupies the two most
significant bits of the byte, combines with the r/m field to form 32 possible
values: eight registers and 24 indexing modes.
- The reg field, which occupies the next three
bits following the mod field, specifies either a register number or three
more bits of opcode information. The meaning of the reg field is determined
by the first (opcode) byte of the instruction.
- The r/m field, which occupies the three least
significant bits of the byte, can specify a register as the location of
an operand, or can form part of the addressing-mode encoding in combination
with the mod field as described above.
The based indexed forms of 32-bit addressing require the SIB byte. The presence
of the SIB byte is indicated by certain encodings of the ModR/M byte. The
SIB byte then includes the following fields:
- The ss field, which occupies the two most significant
bits of the byte, specifies the scale factor.
- The index field, which occupies the next three
bits following the ss field and specifies the register number of
the index register.
- The base field, which occupies the three least
significant bits of the byte, specifies the register number of the base
register.
ModR / MandSIBByteFormats
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ MODR/M BYTE ³
³ ³
³ 7 6 5 4 3 2 1 0 ³
³ ÚÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³
³ ³ MOD ³ REG/OPCODE ³ R/M ³ ³
³ ÀÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³
³ ³
³ SIB (SCALE INDEX BASE) BYTE ³
³ ³
³ 7 6 5 4 3 2 1 0 ³
³ ÚÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³
³ ³ SS ³ INDEX ³ BASE ³ ³
³ ÀÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³
³ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
[Back]
[Next]