0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-19 16:08:02 +03:00

Fixed floating point instruction handling. Removed redundant FNSTSW AX check from FloatingPointHandler and added dedicated test for FnstswHandler.

This commit is contained in:
bird_egop
2025-04-12 21:27:17 +03:00
parent fe0b04f5a1
commit 6ed6a7bd00
7 changed files with 42 additions and 14 deletions

View File

@ -114,8 +114,8 @@ public class FloatingPointHandler : InstructionHandler
/// </summary>
private static void InitializeTwoByteInstructions()
{
// DF E0 - FNSTSW AX (Store FPU status word to AX without checking for pending unmasked floating-point exceptions)
TwoByteInstructions.Add(0xDFE0, "fnstsw");
// We no longer need to handle FNSTSW AX (DF E0) here since we have a dedicated FnstswHandler
// that is registered before this handler in the InstructionHandlerFactory
// Add other two-byte instructions as needed
}
@ -166,14 +166,8 @@ public class FloatingPointHandler : InstructionHandler
if (TwoByteInstructions.TryGetValue(twoByteOpcode, out string? mnemonic) && mnemonic != null)
{
instruction.Mnemonic = mnemonic;
// Special handling for specific instructions
if (twoByteOpcode == 0xDFE0) // FNSTSW AX
{
instruction.Operands = "ax";
Decoder.SetPosition(position + 1); // Skip the second byte
return true;
}
Decoder.SetPosition(position + 1); // Skip the second byte
return true;
}
}

View File

@ -1,3 +1,5 @@
using X86Disassembler.X86.Handlers.Test;
namespace X86Disassembler.X86.Handlers;
using X86Disassembler.X86.Handlers.Group1;

View File

@ -1,4 +1,4 @@
namespace X86Disassembler.X86.Handlers;
namespace X86Disassembler.X86.Handlers.Test;
/// <summary>
/// Handler for TEST AL, imm8 instruction (0xA8)

View File

@ -1,4 +1,4 @@
namespace X86Disassembler.X86.Handlers;
namespace X86Disassembler.X86.Handlers.Test;
/// <summary>
/// Handler for TEST EAX, imm32 instruction (0xA9)

View File

@ -1,4 +1,4 @@
namespace X86Disassembler.X86.Handlers;
namespace X86Disassembler.X86.Handlers.Test;
/// <summary>
/// Handler for TEST r/m8, r8 instruction (0x84)

View File

@ -1,4 +1,4 @@
namespace X86Disassembler.X86.Handlers;
namespace X86Disassembler.X86.Handlers.Test;
/// <summary>
/// Handler for TEST r/m32, r32 instruction (0x85)