/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { if (descriptor.OperandType == OperandType.FarPointer) { return(Size == descriptor.Size); } return(false); }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { switch (descriptor.OperandType) { case OperandType.RelativeOffset: return(Size == DataSize.None || Size <= descriptor.Size); default: return(false); } }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { switch (descriptor.OperandType) { case OperandType.RegisterOrMemoryOperand: return(Size == descriptor.RegisterType.GetSize()); case OperandType.MemoryOperand: return(Size == descriptor.Size); default: return(false); } }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { switch (descriptor.OperandType) { case OperandType.RegisterOrMemoryOperand: case OperandType.RegisterOperand: return(descriptor.RegisterType.HasFlag(Register.Type)); case OperandType.FixedRegister: return(Register == descriptor.FixedRegister); default: return(false); } }
/// <summary> /// Adjusts this <see cref="Operand"/> based on the specified /// <see cref="OperandDescriptor"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> used to /// adjust.</param> /// <remarks> /// Only <see cref="OperandDescriptor"/> instances for which <see cref="IsMatch"/> /// returns <see langword="true"/> may be used as a parameter to this method. /// </remarks> public override void Adjust(OperandDescriptor descriptor) { // When the operand needs to be added to the opcode, set it as such. if (descriptor.OperandEncoding == X86.OperandEncoding.OpcodeAdd) { Encoding = OperandEncoding.AddToOpcode; } else if (descriptor.OperandType == OperandType.RegisterOrMemoryOperand) { Encoding = OperandEncoding.ModRm; } else if (descriptor.OperandType == OperandType.FixedRegister) { Encoding = OperandEncoding.Ignore; } else { Encoding = OperandEncoding.Default; } }
public override bool IsMatch(OperandDescriptor descriptor) { throw new NotImplementedException(); }
public override void Adjust(OperandDescriptor descriptor) { throw new NotImplementedException(); }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { switch (descriptor.OperandType) { case OperandType.RegisterOrMemoryOperand: case OperandType.RegisterOperand: return descriptor.RegisterType.HasFlag(Register.Type); case OperandType.FixedRegister: return Register == descriptor.FixedRegister; default: return false; } }
/// <summary> /// Adjusts this <see cref="Operand"/> based on the specified /// <see cref="OperandDescriptor"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> used to /// adjust.</param> /// <remarks> /// Only <see cref="OperandDescriptor"/> instances for which <see cref="IsMatch"/> /// returns <see langword="true"/> may be used as a parameter to this method. /// </remarks> public override void Adjust(OperandDescriptor descriptor) { // When the operand needs to be added to the opcode, set it as such. if (descriptor.OperandEncoding == X86.OperandEncoding.OpcodeAdd) Encoding = OperandEncoding.AddToOpcode; else if (descriptor.OperandType == OperandType.RegisterOrMemoryOperand) Encoding = OperandEncoding.ModRm; else if (descriptor.OperandType == OperandType.FixedRegister) Encoding = OperandEncoding.Ignore; else Encoding = OperandEncoding.Default; }
/// <summary> /// Adjusts this <see cref="Operand"/> based on the specified <see cref="OperandDescriptor"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> used to adjust.</param> /// <remarks> /// Only <see cref="OperandDescriptor"/> instances for which <see cref="IsMatch"/> returns /// <see langword="true"/> may be used as a parameter to this method. /// </remarks> public override void Adjust(OperandDescriptor descriptor) { asExtraImmediate = (descriptor.OperandEncoding == OperandEncoding.ExtraImmediate); PreferredSize = descriptor.Size; }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { switch (descriptor.OperandType) { case OperandType.Immediate: return Size == DataSize.None || Size <= descriptor.Size; default: return false; } }
/// <summary> /// Adjusts this <see cref="Operand"/> based on the specified <see cref="OperandDescriptor"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> used to adjust.</param> /// <remarks> /// Only <see cref="OperandDescriptor"/> instances for which <see cref="IsMatch"/> returns /// <see langword="true"/> may be used as a parameter to this method. /// </remarks> public virtual void Adjust(OperandDescriptor descriptor) { }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { if (descriptor.OperandType == OperandType.FarPointer) return Size == descriptor.Size; return false; }
/// <summary> /// Adjusts this <see cref="Operand"/> based on the specified <see cref="OperandDescriptor"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> used to adjust.</param> /// <remarks> /// Only <see cref="OperandDescriptor"/> instances for which <see cref="IsMatch"/> returns /// <see langword="true"/> may be used as a parameter to this method. /// </remarks> public override void Adjust(OperandDescriptor descriptor) { // Nothing to do. }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public override bool IsMatch(OperandDescriptor descriptor) { switch (descriptor.OperandType) { case OperandType.RegisterOrMemoryOperand: return Size == descriptor.RegisterType.GetSize(); case OperandType.MemoryOperand: return Size == descriptor.Size; default: return false; } }
/// <summary> /// Determines whether the specified <see cref="OperandDescriptor"/> matches this /// <see cref="Operand"/>. /// </summary> /// <param name="descriptor">The <see cref="OperandDescriptor"/> to match.</param> /// <returns><see langword="true"/> when the specified descriptor matches this operand; /// otherwise, <see langword="false"/>.</returns> public abstract bool IsMatch(OperandDescriptor descriptor);