/// <summary> /// Initializes a new instance of the <see cref="Push"/> class. /// </summary> /// <param name="source">The source memory operand.</param> public Push(EffectiveAddress source) : this((Operand)source) { #region Contract Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Imul"/> class. /// </summary> /// <param name="value">The destination and source operand.</param> /// <param name="multiplier">The multiplier.</param> public Imul(RegisterOperand value, EffectiveAddress multiplier) : this(value, null, (Operand)multiplier) { #region Contract Contract.Requires <ArgumentNullException>(multiplier != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Mul"/> class. /// </summary> /// <param name="multiplier">The multiplier.</param> public Mul(EffectiveAddress multiplier) : this((Operand)multiplier) { #region Contract Contract.Requires <ArgumentNullException>(multiplier != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Shl"/> class. /// </summary> /// <param name="value">The value to change.</param> public Shl(EffectiveAddress value) : this((Operand)value, null) { #region Contract Contract.Requires <ArgumentNullException>(value != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Imul"/> class. /// </summary> /// <param name="destination">The destination operand.</param> /// <param name="source">The source operand.</param> /// <param name="multiplier">The multiplier.</param> public Imul(RegisterOperand destination, EffectiveAddress source, Immediate multiplier) : this(destination, (Operand)source, (Operand)multiplier) { #region Contract Contract.Requires <ArgumentNullException>(multiplier != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Pop"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> public Pop(EffectiveAddress destination) : this((Operand)destination) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Div"/> class. /// </summary> /// <param name="subject">The subject memory operand.</param> public Div(EffectiveAddress subject) : this((Operand)subject) { #region Contract Contract.Requires <ArgumentNullException>(subject != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="JmpNear"/> class. /// </summary> /// <param name="target">The memory location containing the new near jump target address.</param> public JmpNear(EffectiveAddress target) : this((Operand)target) { #region Contract Contract.Requires <ArgumentNullException>(target != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Adc"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> /// <param name="source">The source immediate operand.</param> public Adc(EffectiveAddress destination, Immediate source) : base(destination, source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Cmpxchg16b"/> class. /// </summary> /// <param name="destination">The operand being compared and written to.</param> public Cmpxchg16b(EffectiveAddress destination) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); #endregion this.destination = destination; }
/// <summary> /// Initializes a new instance of the <see cref="Bsf"/> class. /// </summary> /// <param name="destination">The register in which the bit's index will be stored.</param> /// <param name="subject">The memory operand which is checked.</param> public Bsf(RegisterOperand destination, EffectiveAddress subject) : this(destination, (Operand)subject) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(subject != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Rcr"/> class. /// </summary> /// <param name="value">The value to change.</param> /// <param name="positions">The register containing the number of positions to adjust.</param> public Rcr(EffectiveAddress value, RegisterOperand positions) : this((Operand)value, (Operand)positions) { #region Contract Contract.Requires <ArgumentNullException>(value != null); Contract.Requires <ArgumentNullException>(positions != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Cmpxchg"/> class. /// </summary> /// <param name="compared">The memory operand being compared.</param> /// <param name="source">The source operand.</param> public Cmpxchg(EffectiveAddress compared, RegisterOperand source) : this((Operand)compared, source) { #region Contract Contract.Requires <ArgumentNullException>(compared != null); Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Movsxd"/> class. /// </summary> /// <param name="destination">The destination register.</param> /// <param name="source">The source memory operand.</param> public Movsxd(RegisterOperand destination, EffectiveAddress source) : this(destination, (Operand)source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="ArithmeticInstruction"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> /// <param name="source">The source immediate operand.</param> protected ArithmeticInstruction(EffectiveAddress destination, Immediate source) : this((IRegisterOrMemoryOperand)destination, (ISourceOperand)source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Cmp"/> class. /// </summary> /// <param name="second">The destination register.</param> /// <param name="first">The source memory operand.</param> public Cmp(RegisterOperand second, EffectiveAddress first) : this((Operand)second, (Operand)first) { #region Contract Contract.Requires <ArgumentNullException>(second != null); Contract.Requires <ArgumentNullException>(first != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Sub"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> /// <param name="source">The source immediate value.</param> public Sub(EffectiveAddress destination, Immediate source) : this((Operand)destination, (Operand)source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Test"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> /// <param name="source">The source immediate register operand.</param> public Test(EffectiveAddress destination, RegisterOperand source) : this((Operand)destination, (Operand)source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Btc"/> class. /// </summary> /// <param name="subject">The memory operand whose bit is copied and toggled.</param> /// <param name="bitIndex">The index of the bit to copy.</param> public Btc(EffectiveAddress subject, Immediate bitIndex) : this((Operand)subject, (Operand)bitIndex) { #region Contract Contract.Requires <ArgumentNullException>(subject != null); Contract.Requires <ArgumentNullException>(bitIndex != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Clflush"/> class. /// </summary> /// <param name="address">The linear address to flush.</param> public Clflush(EffectiveAddress address) { #region Contract Contract.Requires <ArgumentNullException>(address != null); #endregion this.address = address; }
/// <summary> /// Initializes a new instance of the <see cref="Shl"/> class. /// </summary> /// <param name="value">The value to change.</param> /// <param name="positions">The number of positions to adjust.</param> public Shl(EffectiveAddress value, Immediate positions) : this((Operand)value, (Operand)positions) { #region Contract Contract.Requires <ArgumentNullException>(value != null); Contract.Requires <ArgumentNullException>(positions != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Bt"/> class. /// </summary> /// <param name="subject">The memory operand whose bit is copied.</param> /// <param name="bitindex">The index of the bit to copy.</param> public Bt(EffectiveAddress subject, RegisterOperand bitindex) : this((Operand)subject, (Operand)bitindex) { #region Contract Contract.Requires <ArgumentNullException>(subject != null); Contract.Requires <ArgumentNullException>(bitindex != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Adc"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> /// <param name="source">The source register operand.</param> public Adc(EffectiveAddress destination, RegisterOperand source) : base(destination, source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); Contract.Requires <ArgumentException>(source.Register.IsGeneralPurposeRegister()); #endregion }
/// <summary> /// Writes an effective address operand. /// </summary> /// <returns>The number of characters written.</returns> private int WriteOperand(EffectiveAddress operand, bool writeSize) { #region Contract if (operand == null) { return(0); } #endregion int length = 0; Writer.Write("["); length++; // TODO: Possible segment override here. // Base register. string str; if (operand.BaseRegister != Register.None) { str = Enum.GetName(typeof(Register), operand.BaseRegister); length += str.Length; Writer.Write(str); } // Index register. if (operand.IndexRegister != Register.None) { if (operand.BaseRegister != Register.None) { Writer.Write("+"); length++; } str = Enum.GetName(typeof(Register), operand.IndexRegister); length += str.Length; Writer.Write(str); // Scale if (operand.Scale > 1) { str = String.Format("*{0}", operand.Scale); length += str.Length; Writer.Write(str); } } // Displacement if (operand.Displacement != null) { if (operand.BaseRegister != Register.None || operand.IndexRegister != Register.None) { Writer.Write("+"); length++; } length += WriteExpression(operand.Displacement); } Writer.Write("]"); length++; return(length); }
/// <summary> /// Initializes a new instance of the <see cref="ArithmeticInstruction"/> class. /// </summary> /// <param name="destination">The destination register operand.</param> /// <param name="source">The source register or memory operand.</param> protected ArithmeticInstruction(RegisterOperand destination, EffectiveAddress source) : this((IRegisterOrMemoryOperand)destination, (ISourceOperand)source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentException>(destination.Register.IsGeneralPurposeRegister()); Contract.Requires <ArgumentNullException>(source != null); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Set"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> /// <param name="condition">The condition on which this instruction executes.</param> public Set(EffectiveAddress destination, InstructionCondition condition) : this((Operand)destination, condition) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <InvalidEnumArgumentException>(Enum.IsDefined(typeof(InstructionCondition), condition)); Contract.Requires <ArgumentException>(condition != InstructionCondition.None); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Cmov"/> class. /// </summary> /// <param name="destination">The destination register.</param> /// <param name="source">The source memory operand.</param> /// <param name="condition">The condition on which this instruction executes.</param> public Cmov(RegisterOperand destination, EffectiveAddress source, InstructionCondition condition) : this(destination, (Operand)source, condition) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); Contract.Requires <InvalidEnumArgumentException>(Enum.IsDefined(typeof(InstructionCondition), condition)); Contract.Requires <ArgumentException>(condition != InstructionCondition.None); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="Lea"/> class. /// </summary> /// <param name="destination">The destination register operand.</param> /// <param name="address">The address.</param> public Lea(RegisterOperand destination, EffectiveAddress address) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(address != null); #endregion this.destination = destination; this.address = address; }
/// <summary> /// Initializes a new instance of the <see cref="Bound"/> class. /// </summary> /// <param name="index">The array index to check.</param> /// <param name="bounds">Memory address of two (double)words specifying the lower and upper limits of the /// array.</param> public Bound(RegisterOperand index, EffectiveAddress bounds) { #region Contract Contract.Requires <ArgumentNullException>(index != null); Contract.Requires <ArgumentNullException>(bounds != null); #endregion this.index = index; this.bounds = bounds; }
/// <summary> /// Initializes a new instance of the <see cref="Movnti"/> class. /// </summary> /// <param name="destination">The destination memory operand.</param> /// <param name="source">The source register.</param> public Movnti(EffectiveAddress destination, RegisterOperand source) { #region Contract Contract.Requires <ArgumentNullException>(destination != null); Contract.Requires <ArgumentNullException>(source != null); #endregion this.destination = destination; this.source = source; }
/// <summary> /// Creates a new CMP (Compare) instruction. /// </summary> /// <param name="left">A register or memory operand.</param> /// <param name="right">A register.</param> /// <returns>The created instruction.</returns> public static X86Instruction Cmp(EffectiveAddress left, Register right) { return X86Opcode.Cmp.CreateInstruction(left, new RegisterOperand(right)); }
public static X86Instruction Adc(EffectiveAddress destination, ushort source) { return X86Opcode.Adc.CreateInstruction(destination, new Immediate(source, DataSize.Bit16)); }
/// <summary> /// Creates a new CLFLUSH (Cache Line Flush) instruction. /// </summary> /// <param name="address">A memory operand.</param> /// <returns>The created instruction.</returns> public static X86Instruction Clflush(EffectiveAddress address) { return X86Opcode.Clflush.CreateInstruction(address); }
/// <summary> /// Creates a new BOUND (Check Array Bound) instruction. /// </summary> /// <param name="index">A register.</param> /// <param name="bounds">A memory operand.</param> /// <returns>The created instruction.</returns> public static X86Instruction Bound(Register index, EffectiveAddress bounds) { return X86Opcode.Bound.CreateInstruction(new RegisterOperand(index), bounds); }
/// <summary> /// Creates a new DEC (Decrement by 1) instruction. /// </summary> /// <param name="destination">A register or memory operand.</param> /// <returns>The created instruction.</returns> public static X86Instruction Dec(EffectiveAddress destination) { return X86Opcode.Dec.CreateInstruction(destination); }
/// <summary> /// Creates a new DIV (Unsigned Divide) instruction. /// </summary> /// <param name="source">A register or memory operand.</param> /// <returns>The created instruction.</returns> public static X86Instruction Div(EffectiveAddress source) { return X86Opcode.Div.CreateInstruction(source); }
/// <summary> /// Creates a new AND (Logical AND) instruction. /// </summary> /// <param name="destination">A register or memory operand.</param> /// <param name="source">A register.</param> /// <returns>The created instruction.</returns> public static X86Instruction And(EffectiveAddress destination, Register source) { return X86Opcode.And.CreateInstruction(destination, new RegisterOperand(source)); }
/// <summary> /// Creates a new AND (Logical AND) instruction. /// </summary> /// <param name="destination">A register or memory operand.</param> /// <param name="source">An immediate value.</param> /// <returns>The created instruction.</returns> public static X86Instruction And(EffectiveAddress destination, byte source) { return X86Opcode.And.CreateInstruction(destination, new Immediate(source, DataSize.Bit8)); }
/// <summary> /// Creates a new CALL FAR (Far Procedure Call) instruction. /// </summary> /// <param name="target">A far pointer.</param> /// <returns>The created instruction.</returns> public static X86Instruction CallFar(EffectiveAddress target) { return X86Opcode.CallFar.CreateInstruction(target); }
/// <summary> /// Creates a new BT (Bit Test) instruction. /// </summary> /// <param name="value">A register or memory operand.</param> /// <param name="bitindex">A register.</param> /// <returns>The created instruction.</returns> public static X86Instruction Bt(EffectiveAddress value, Register bitindex) { return X86Opcode.Bt.CreateInstruction(value, new RegisterOperand(bitindex)); }
/// <summary> /// Creates a new BSR (Bit Scan Reverse) instruction. /// </summary> /// <param name="destination">A register.</param> /// <param name="subject">A register or memory operand.</param> /// <returns>The created instruction.</returns> public static X86Instruction Bsr(Register destination, EffectiveAddress subject) { return X86Opcode.Bsr.CreateInstruction(new RegisterOperand(destination), subject); }
public static X86Instruction Mov(EffectiveAddress destination, uint source) { return X86Opcode.Mov.CreateInstruction(destination, new Immediate(source, DataSize.Bit32)); }
/// <summary> /// Creates a new CMP (Compare) instruction. /// </summary> /// <param name="left">A register.</param> /// <param name="right">A register or memory operand.</param> /// <returns>The created instruction.</returns> public static X86Instruction Cmp(Register left, EffectiveAddress right) { return X86Opcode.Cmp.CreateInstruction(new RegisterOperand(left), right); }
/// <summary> /// Creates a new AND (Logical AND) instruction. /// </summary> /// <param name="destination">A register.</param> /// <param name="source">A register or memory operand.</param> /// <returns>The created instruction.</returns> public static X86Instruction And(Register destination, EffectiveAddress source) { return X86Opcode.And.CreateInstruction(new RegisterOperand(destination), source); }
/// <summary> /// Creates a new CMP (Compare) instruction. /// </summary> /// <param name="left">A register or memory operand.</param> /// <param name="right">An immediate value.</param> /// <returns>The created instruction.</returns> public static X86Instruction Cmp(EffectiveAddress left, byte right) { return X86Opcode.Cmp.CreateInstruction(left, new Immediate(right, DataSize.Bit8)); }
public static X86Instruction Bt(EffectiveAddress value, sbyte bitindex) { return X86Opcode.Bt.CreateInstruction(value, new Immediate(bitindex, DataSize.Bit8)); }
/// <summary> /// Writes an effective address operand. /// </summary> /// <returns>The number of characters written.</returns> private int WriteOperand(EffectiveAddress operand, bool writeSize) { #region Contract if (operand == null) return 0; #endregion int length = 0; Writer.Write("["); length++; // TODO: Possible segment override here. // Base register. string str; if (operand.BaseRegister != Register.None) { str = Enum.GetName(typeof(Register), operand.BaseRegister); length += str.Length; Writer.Write(str); } // Index register. if (operand.IndexRegister != Register.None) { if (operand.BaseRegister != Register.None) { Writer.Write("+"); length++; } str = Enum.GetName(typeof(Register), operand.IndexRegister); length += str.Length; Writer.Write(str); // Scale if (operand.Scale > 1) { str = String.Format("*{0}", operand.Scale); length += str.Length; Writer.Write(str); } } // Displacement if (operand.Displacement != null) { if (operand.BaseRegister != Register.None || operand.IndexRegister != Register.None) { Writer.Write("+"); length++; } length += WriteExpression(operand.Displacement); } Writer.Write("]"); length++; return length; }