怎样确定机器一条指令的长度,位置

泻药。。话说。example里面就有哇。int main() {\t// step 1: declare struct INSTRUCTION\tINSTRUCTION inst;\tchar string;\t// step 2: fetch instruction\tget_instruction(\u0026amp;inst, data, MODE_32);\t// step 3: print it\tget_instruction_string(\u0026amp;inst, FORMAT_ATT, 0, string, sizeof(string));\tprintf("%s\", string);\treturn 0;}循环的时候。直接 INSTRUCTION 里面获取长度。// struct INSTRUCTION is used to interface the librarytypedef struct _INSTRUCTION {int length; // Instruction length\tenum Instruction type;\t// Instruction type\tenum Mode mode;\t\t// Addressing mode\tBYTE opcode;\t\t// Actual opcode\tBYTE modrm;\t\t// MODRM byte\tBYTE sib;\t\t// SIB byte\tint modrm_offset;\t// MODRM byte offset\tint extindex;\t\t// Extension table index\tint fpuindex;\t\t// FPU table index\tint dispbytes;\t\t// Displacement bytes (0 = no displacement)\tint immbytes;\t\t// Immediate bytes (0 = no immediate)\tint sectionbytes;\t// Section prefix bytes (0 = no section prefix)\tOPERAND op1;\t\t// First operand (if any)\tOPERAND op2;\t\t// Second operand (if any)\tOPERAND op3;\t\t// Additional operand (if any)\tPINST ptr;\t\t// Pointer to instruction table\tint flags;\t\t// Instruction flags\tshort eflags_affected;\t// Process eflags affected\tshort eflags_used; // Processor eflags used by this instruction\tint iop_written;\t// mask of affected implied registers (written)\tint iop_read;\t\t// mask of affected implied registers (read)} INSTRUCTION, *PINSTRUCTION;address = address + inst.length直接循环走起。——————————————————————————————————还有就是。一段机器码转成汇编的时候。会按照第一个字节开始设定汇编指令。
■网友
x86指令是变长指令,跟arm不一样,不是32位一条指令……


    推荐阅读