mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 16:18:37 +03:00
move handlers, remove bases
This commit is contained in:
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group3;
|
||||
/// <summary>
|
||||
/// Handler for DIV r/m32 instruction (0xF7 /6)
|
||||
/// </summary>
|
||||
public class DivRm32Handler : Group3BaseHandler
|
||||
public class DivRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the DivRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class DivRm32Handler : Group3BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the operand
|
||||
string operand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string operand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = operand;
|
||||
|
@ -1,44 +0,0 @@
|
||||
namespace X86Disassembler.X86.Handlers.Group3;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for Group 3 instruction handlers (TEST, NOT, NEG, MUL, IMUL, DIV, IDIV)
|
||||
/// </summary>
|
||||
public abstract class Group3BaseHandler : InstructionHandler
|
||||
{
|
||||
// ModR/M decoder
|
||||
protected readonly ModRMDecoder _modRMDecoder;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Group3BaseHandler class
|
||||
/// </summary>
|
||||
/// <param name="codeBuffer">The buffer containing the code to decode</param>
|
||||
/// <param name="decoder">The instruction decoder that owns this handler</param>
|
||||
/// <param name="length">The length of the buffer</param>
|
||||
protected Group3BaseHandler(byte[] codeBuffer, InstructionDecoder decoder, int length)
|
||||
: base(codeBuffer, decoder, length)
|
||||
{
|
||||
_modRMDecoder = new ModRMDecoder(codeBuffer, decoder, length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the 32-bit register name for the given register index
|
||||
/// </summary>
|
||||
/// <param name="reg">The register index</param>
|
||||
/// <returns>The register name</returns>
|
||||
protected static string GetRegister32(byte reg)
|
||||
{
|
||||
string[] registerNames = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" };
|
||||
return registerNames[reg & 0x07];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the 8-bit register name for the given register index
|
||||
/// </summary>
|
||||
/// <param name="reg">The register index</param>
|
||||
/// <returns>The register name</returns>
|
||||
protected static string GetRegister8(byte reg)
|
||||
{
|
||||
string[] registerNames = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
|
||||
return registerNames[reg & 0x07];
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group3;
|
||||
/// <summary>
|
||||
/// Handler for IDIV r/m32 instruction (0xF7 /7)
|
||||
/// </summary>
|
||||
public class IdivRm32Handler : Group3BaseHandler
|
||||
public class IdivRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the IdivRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class IdivRm32Handler : Group3BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the operand
|
||||
string operand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string operand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = operand;
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group3;
|
||||
/// <summary>
|
||||
/// Handler for IMUL r/m32 instruction (0xF7 /5)
|
||||
/// </summary>
|
||||
public class ImulRm32Handler : Group3BaseHandler
|
||||
public class ImulRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ImulRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class ImulRm32Handler : Group3BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the operand
|
||||
string operand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string operand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = operand;
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group3;
|
||||
/// <summary>
|
||||
/// Handler for MUL r/m32 instruction (0xF7 /4)
|
||||
/// </summary>
|
||||
public class MulRm32Handler : Group3BaseHandler
|
||||
public class MulRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MulRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class MulRm32Handler : Group3BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the operand
|
||||
string operand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string operand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = operand;
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group3;
|
||||
/// <summary>
|
||||
/// Handler for NEG r/m32 instruction (0xF7 /3)
|
||||
/// </summary>
|
||||
public class NegRm32Handler : Group3BaseHandler
|
||||
public class NegRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the NegRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class NegRm32Handler : Group3BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the operand
|
||||
string operand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string operand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = operand;
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group3;
|
||||
/// <summary>
|
||||
/// Handler for NOT r/m32 instruction (0xF7 /2)
|
||||
/// </summary>
|
||||
public class NotRm32Handler : Group3BaseHandler
|
||||
public class NotRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the NotRm32Handler class
|
||||
@ -81,7 +81,7 @@ public class NotRm32Handler : Group3BaseHandler
|
||||
else
|
||||
{
|
||||
// Use the ModR/M decoder for memory addressing
|
||||
operand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
operand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
}
|
||||
|
||||
// Set the operands
|
||||
|
Reference in New Issue
Block a user