0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 08:18:36 +03:00

more cleanup

This commit is contained in:
bird_egop
2025-04-15 02:42:47 +03:00
parent 49f1d7d221
commit abe4d38d4b
97 changed files with 160 additions and 219 deletions

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR AL, imm8 instruction (0x34)

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR AX, imm16 instruction (0x35 with 0x66 prefix)

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR EAX, imm32 instruction (0x35)

View File

@ -30,8 +30,7 @@ public class XorImmWithRm16Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte)((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 6; // 6 = XOR
}
@ -54,7 +53,7 @@ public class XorImmWithRm16Handler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
// Ensure the destination operand has the correct size (16-bit)
destinationOperand.Size = 16;

View File

@ -30,8 +30,7 @@ public class XorImmWithRm16SignExtendedHandler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte)((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 6; // 6 = XOR
}
@ -56,7 +55,7 @@ public class XorImmWithRm16SignExtendedHandler : InstructionHandler
// For XOR r/m16, imm8 (sign-extended) (0x83 /6 with 0x66 prefix):
// - The r/m field with mod specifies the destination operand (register or memory)
// - The immediate value is the source operand (sign-extended from 8 to 16 bits)
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
// Adjust the operand size to 16-bit
destinationOperand.Size = 16;

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR r/m32, imm32 instruction (0x81 /6)
@ -30,8 +30,7 @@ public class XorImmWithRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte)((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 6; // 6 = XOR
}
@ -53,7 +52,7 @@ public class XorImmWithRm32Handler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destOperand) = ModRMDecoder.ReadModRM();
// Read the immediate value
if (!Decoder.CanReadUInt())

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR r/m32, imm8 (sign-extended) instruction (0x83 /6)
@ -30,8 +30,7 @@ public class XorImmWithRm32SignExtendedHandler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte)((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 6; // 6 = XOR
}
@ -53,7 +52,7 @@ public class XorImmWithRm32SignExtendedHandler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destOperand) = ModRMDecoder.ReadModRM();
// Read the immediate value (sign-extended from 8 to 32 bits)
if (!Decoder.CanReadByte())

View File

@ -29,9 +29,8 @@ public class XorImmWithRm8Handler : InstructionHandler
// Check if the reg field of the ModR/M byte is 6 (XOR)
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte)((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 6; // 6 = XOR
}
@ -48,7 +47,7 @@ public class XorImmWithRm8Handler : InstructionHandler
instruction.Type = InstructionType.Xor;
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM8();
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM8();
// Ensure the destination operand has the correct size (8-bit)
destinationOperand.Size = 8;

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR r/m32, r32 instruction (0x31)
@ -43,7 +43,7 @@ public class XorMemRegHandler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
var (_, reg, _, destOperand) = ModRMDecoder.ReadModRM();
// Create the source register operand
var srcOperand = OperandFactory.CreateRegisterOperand(reg, 32);

View File

@ -47,7 +47,7 @@ public class XorR16Rm16Handler : InstructionHandler
// For XOR r16, r/m16 (0x33 with 0x66 prefix):
// - The reg field specifies the destination register
// - The r/m field with mod specifies the source operand (register or memory)
var (mod, reg, rm, sourceOperand) = ModRMDecoder.ReadModRM();
var (_, reg, _, sourceOperand) = ModRMDecoder.ReadModRM();
// Adjust the operand size to 16-bit
sourceOperand.Size = 16;

View File

@ -38,7 +38,7 @@ public class XorR8Rm8Handler : InstructionHandler
instruction.Type = InstructionType.Xor;
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
var (mod, reg, rm, sourceOperand) = ModRMDecoder.ReadModRM8();
var (_, reg, _, sourceOperand) = ModRMDecoder.ReadModRM8();
// Ensure the source operand has the correct size (8-bit)
sourceOperand.Size = 8;

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR r32, r/m32 instruction (0x33)
@ -45,7 +45,7 @@ public class XorRegMemHandler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, srcOperand) = ModRMDecoder.ReadModRM();
var (_, reg, _, srcOperand) = ModRMDecoder.ReadModRM();
// Create the destination register operand
var destOperand = OperandFactory.CreateRegisterOperand(reg, 32);

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Xor;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for XOR r/m16, r16 instruction (0x31 with 0x66 prefix)
@ -44,7 +44,7 @@ public class XorRm16R16Handler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
var (_, reg, _, destinationOperand) = ModRMDecoder.ReadModRM();
// Create the source register operand (16-bit)
var sourceOperand = OperandFactory.CreateRegisterOperand(reg, 16);

View File

@ -38,7 +38,7 @@ public class XorRm8R8Handler : InstructionHandler
instruction.Type = InstructionType.Xor;
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM8();
var (_, reg, _, destinationOperand) = ModRMDecoder.ReadModRM8();
// Ensure the destination operand has the correct size (8-bit)
destinationOperand.Size = 8;