mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 08:18:36 +03:00
tests and handler fixes
This commit is contained in:
@ -54,39 +54,15 @@ public class FildInt64Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, rawMemoryOperand) = ModRMDecoder.ReadModRM();
|
||||
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM64();
|
||||
|
||||
// Set the instruction type
|
||||
instruction.Type = InstructionType.Fild;
|
||||
|
||||
// Create a 64-bit memory operand
|
||||
Operand memoryOperand;
|
||||
|
||||
if (rawMemoryOperand is DirectMemoryOperand directMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateDirectMemoryOperand(directMemory.Address, 64);
|
||||
}
|
||||
else if (rawMemoryOperand is BaseRegisterMemoryOperand baseMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateBaseRegisterMemoryOperand(baseMemory.BaseRegister, 64);
|
||||
}
|
||||
else if (rawMemoryOperand is DisplacementMemoryOperand dispMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateDisplacementMemoryOperand(dispMemory.BaseRegister, dispMemory.Displacement, 64);
|
||||
}
|
||||
else if (rawMemoryOperand is ScaledIndexMemoryOperand scaledMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateScaledIndexMemoryOperand(scaledMemory.IndexRegister, scaledMemory.Scale, scaledMemory.BaseRegister, scaledMemory.Displacement, 64);
|
||||
}
|
||||
else
|
||||
{
|
||||
memoryOperand = rawMemoryOperand;
|
||||
}
|
||||
|
||||
// Set the structured operands
|
||||
instruction.StructuredOperands =
|
||||
[
|
||||
memoryOperand
|
||||
operand
|
||||
];
|
||||
|
||||
return true;
|
||||
|
@ -54,39 +54,15 @@ public class FistpInt64Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, rawMemoryOperand) = ModRMDecoder.ReadModRM();
|
||||
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM64();
|
||||
|
||||
// Set the instruction type
|
||||
instruction.Type = InstructionType.Fistp;
|
||||
|
||||
// Create a 64-bit memory operand
|
||||
Operand memoryOperand;
|
||||
|
||||
if (rawMemoryOperand is DirectMemoryOperand directMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateDirectMemoryOperand(directMemory.Address, 64);
|
||||
}
|
||||
else if (rawMemoryOperand is BaseRegisterMemoryOperand baseMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateBaseRegisterMemoryOperand(baseMemory.BaseRegister, 64);
|
||||
}
|
||||
else if (rawMemoryOperand is DisplacementMemoryOperand dispMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateDisplacementMemoryOperand(dispMemory.BaseRegister, dispMemory.Displacement, 64);
|
||||
}
|
||||
else if (rawMemoryOperand is ScaledIndexMemoryOperand scaledMemory)
|
||||
{
|
||||
memoryOperand = OperandFactory.CreateScaledIndexMemoryOperand(scaledMemory.IndexRegister, scaledMemory.Scale, scaledMemory.BaseRegister, scaledMemory.Displacement, 64);
|
||||
}
|
||||
else
|
||||
{
|
||||
memoryOperand = rawMemoryOperand;
|
||||
}
|
||||
|
||||
// Set the structured operands
|
||||
instruction.StructuredOperands =
|
||||
[
|
||||
memoryOperand
|
||||
operand
|
||||
];
|
||||
|
||||
return true;
|
||||
|
@ -52,7 +52,7 @@ public class FldFloat64Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte using the specialized FPU method
|
||||
var (mod, reg, fpuRm, rawOperand) = ModRMDecoder.ReadModRMFpu();
|
||||
var (mod, reg, fpuRm, rawOperand) = ModRMDecoder.ReadModRMFpu64();
|
||||
|
||||
// Verify reg field is 0 (FLD)
|
||||
if (reg != 0)
|
||||
|
@ -52,7 +52,7 @@ public class FstFloat64Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte using the specialized FPU method
|
||||
var (mod, reg, fpuRm, rawOperand) = ModRMDecoder.ReadModRMFpu();
|
||||
var (mod, reg, fpuRm, rawOperand) = ModRMDecoder.ReadModRMFpu64();
|
||||
|
||||
// Set the instruction type
|
||||
instruction.Type = InstructionType.Fst;
|
||||
|
@ -52,7 +52,7 @@ public class FstpFloat64Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte using the specialized FPU method
|
||||
var (mod, reg, fpuRm, rawOperand) = ModRMDecoder.ReadModRMFpu();
|
||||
var (mod, reg, fpuRm, rawOperand) = ModRMDecoder.ReadModRMFpu64();
|
||||
|
||||
// Set the instruction type
|
||||
instruction.Type = InstructionType.Fstp;
|
||||
|
Reference in New Issue
Block a user