illegal instruction: opcode with wrong RegOpcode value

Viewed 215

i am writing a x86 disassembler and i realized that when executing the instruction MOV reg16, segmentReg (opcode 0x8C) with the field RegOpcode from ModRM greater than 5, it will throw an exception illegal instruction, this make sence since there are no more than 6 segment registers.

so my question is: where intel specifies this behavior? i am reading the intel manuals but I can not find any information about this.

and since i am writing a disassembler: is there any "standard" way to know when the opcode may throw an ilegal instruction if any operand is wrong, or should i add conditions for these opcodes in my code? something like this:

if(opcode == 0x8C)
    if(ModRM.RegOpcode > 5)
        return wrong_operand
    endif
endif
// all fine
0 Answers
Related