internal static Instruction Get(EffectiveAddress at) { if (null == LastAnalyzed) { IntPtr nativeAddress = InteropConstants.GetExportedData(ExportedDataIdentifier.ExportedCommandId); // TODO : Should implement a factory LastAnalyzed = new IntelInstruction(nativeAddress); Interactivity.Message( "Last analyzed instruction pinned at 0x{0:X08} / 0x{0:X016}\r\n", nativeAddress.ToInt32(), nativeAddress.ToInt64()); } if (0 == decode_insn(at)) { if (0 != create_insn(at)) { Interactivity.Message("Successfully created instruction at 0x{0:X08}\r\n", at); } else { Interactivity.Message("Failed to create instruction at 0x{0:X08}\r\n", at); } } else { Interactivity.Message("Already existing instruction found at 0x{0:X08}\r\n", at); } return LastAnalyzed; }
// get the scale factor of the operand with a displacement internal int x86_scale(IntelInstruction owner) { return this.hasSIB ? sib_scale : 0; }
// get the index register of the operand with a displacement internal int x86_index(IntelInstruction owner) { return this.hasSIB ? sib_index(owner) : INDEX_NONE; }
// get the base register of the operand with a displacement internal int x86_base(IntelInstruction owner) { return this.hasSIB ? this.sib_base(owner) : this.Phrase; }
// get extended sib index internal short sib_index(IntelInstruction owner) { short index = (short)((this.SpecialFlag2 >> 3) & 7); if (0 != (owner.InstructionPrefix & IntelInstruction.REX_X)) { index |= 8; } return index; }
// get extended sib base internal int sib_base(IntelInstruction owner) { int @base = this.SpecialFlag2 & 7; if (0 != (owner.InstructionPrefix & IntelInstruction.REX_B)) { @base |= 8; } return @base; }