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

Removed special case check for 0x83 in OrRm8R8Handler to avoid introducing special cases in general solutions

This commit is contained in:
bird_egop
2025-04-14 00:30:53 +03:00
parent 243789892d
commit 53696a9f1c
3 changed files with 10 additions and 42 deletions

View File

@ -37,25 +37,13 @@ public class OrRm8R8Handler : InstructionHandler
// Set the mnemonic
instruction.Mnemonic = "or";
// Read the ModR/M byte
int position = Decoder.GetPosition();
if (position >= Length)
// Check if we have enough bytes for the ModR/M byte
if (!Decoder.CanReadByte())
{
instruction.Operands = "??";
return true;
return false;
}
byte modRM = CodeBuffer[position];
// Check if the next byte is a valid ModR/M byte or potentially another opcode
// For the specific case of 0x83, it's a different instruction (ADD r/m32, imm8)
if (modRM == 0x83)
{
// This is likely the start of another instruction, not a ModR/M byte
instruction.Operands = "??";
return true;
}
// Read the ModR/M byte and decode the operands
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
// The register operand is in the reg field (8-bit register)