-3

so I have task to dissasemble fpu commands, you can find them here http://mathemainzel.info/files/x86asmref.html#float

And for example take FADD command. It has D8 /0 d0 d1 code, where d0 d1 is Displacement [Low-byte High-byte]. So, my question is what /0 means? On the top of the page it is written:

/0~7 2nd or 3rd Opcode (MODRM bits 5,4,3 from reg field)

However, I do not understand what it means and maybe you have clear explanation what means / and digit after it. Does it make some sense at all? Thank you!

Jester
  • 56,577
  • 4
  • 81
  • 125
  • 4
    Use the [official instruction set reference](https://software.intel.com/sites/default/files/managed/a4/60/325383-sdm-vol-2abcd.pdf) and read `CHAPTER 2 INSTRUCTION FORMAT` and `3.1 INTERPRETING THE INSTRUCTION REFERENCE PAGES` – Jester Dec 02 '16 at 18:13
  • 1
    Do you know what the modr/m byte is? If no, then consider reading the documentation. If yes, then I don't understand why you are asking this question. – fuz Dec 02 '16 at 18:25
  • I know what is modr/m byte. So 3 bits go from red field, from where go other 5 bits?? – Valentinno7 Dec 02 '16 at 18:44
  • Can you show me and example of how it works? – Valentinno7 Dec 02 '16 at 19:05
  • The other 5 bits are used for the operand(s) (ST(i) and/or memory reference). – Igor Skochinsky Dec 03 '16 at 13:51

1 Answers1

2

The modr/m byte has 3 fields:

  • a 2-bit mod field at bits 7,6
  • a 3-bit reg field at bits 5,4,3
  • a 3-bit mem field at bits 2,1,0

what means / and digit after it.

The digit that you read here simply is the value that goes in the reg field at the bits 5,4,3.
This happens because in this case the instruction doesn't need the reg field to represent an actual register, and so the designer chose to put the otherwise unused bits to good use and have an extension to the opcode stored in here. This way the primary opcode byte D8h can be used for more than a single instruction.

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
Fifoernik
  • 9,779
  • 1
  • 21
  • 27