2025-04-14 22:08:50 +03:00
|
|
|
namespace X86Disassembler.X86.Operands;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Represents a relative offset operand in an x86 instruction (used for jumps and calls)
|
|
|
|
/// </summary>
|
|
|
|
public class RelativeOffsetOperand : Operand
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the target address
|
|
|
|
/// </summary>
|
2025-04-15 02:29:32 +03:00
|
|
|
public uint TargetAddress { get; set; }
|
2025-04-14 22:08:50 +03:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the RelativeOffsetOperand class
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="targetAddress">The target address</param>
|
|
|
|
/// <param name="size">The size of the offset in bits (8 or 32)</param>
|
2025-04-15 02:29:32 +03:00
|
|
|
public RelativeOffsetOperand(uint targetAddress, int size = 32)
|
2025-04-14 22:08:50 +03:00
|
|
|
{
|
|
|
|
Type = OperandType.RelativeOffset;
|
|
|
|
TargetAddress = targetAddress;
|
|
|
|
Size = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a string representation of this operand
|
|
|
|
/// </summary>
|
|
|
|
public override string ToString()
|
|
|
|
{
|
2025-04-15 23:54:51 +03:00
|
|
|
return $"0x{TargetAddress:X8}";
|
2025-04-14 22:08:50 +03:00
|
|
|
}
|
|
|
|
}
|