0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 08:18:36 +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

@ -15,7 +15,7 @@ public class JmpRel32Handler : InstructionHandler
: base(codeBuffer, decoder, length)
{
}
/// <summary>
/// Checks if this handler can decode the given opcode
/// </summary>
@ -25,7 +25,7 @@ public class JmpRel32Handler : InstructionHandler
{
return opcode == 0xE9;
}
/// <summary>
/// Decodes a JMP rel32 instruction
/// </summary>
@ -37,7 +37,7 @@ public class JmpRel32Handler : InstructionHandler
// Set the mnemonic
instruction.Mnemonic = "jmp";
// Check if we have enough bytes for the offset
// Check if we have enough bytes for the offset (4 bytes)
int position = Decoder.GetPosition();
if (position + 4 > Length)
{
@ -45,13 +45,13 @@ public class JmpRel32Handler : InstructionHandler
}
// Read the offset and calculate target address
int offset = (int)Decoder.ReadUInt32();
uint offset = Decoder.ReadUInt32();
// Calculate target address (instruction address + instruction length + offset)
// For JMP rel32, the instruction is 5 bytes: opcode (1 byte) + offset (4 bytes)
uint targetAddress = (uint)(instruction.Address + 5 + offset);
// Format the target address
// Set the operands
instruction.Operands = $"0x{targetAddress:X8}";
return true;