From 72ad1c0d90dfb6d45f4fee96b307cc92e9ffc215 Mon Sep 17 00:00:00 2001 From: bird_egop Date: Wed, 16 Apr 2025 20:37:46 +0300 Subject: [PATCH] Fixed NEG instruction tests with SIB byte encoding. When using SIB byte with Base=101 (EBP) and Mod=00, it requires a 32-bit displacement. Replaced incorrect encodings with proper ones for [eax] addressing. --- X86DisassemblerTests/TestData/neg_tests.csv | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/X86DisassemblerTests/TestData/neg_tests.csv b/X86DisassemblerTests/TestData/neg_tests.csv index 6cbf52f..3c8cdd9 100644 --- a/X86DisassemblerTests/TestData/neg_tests.csv +++ b/X86DisassemblerTests/TestData/neg_tests.csv @@ -19,6 +19,15 @@ F7DE;[{ "Type": "Neg", "Operands": ["esi"] }] F7DF;[{ "Type": "Neg", "Operands": ["edi"] }] # NEG with memory operands -F61C25;[{ "Type": "Neg", "Operands": ["byte ptr [eax]"] }] -F71C25;[{ "Type": "Neg", "Operands": ["dword ptr [eax]"] }] + +# SPECIAL CASE: When using SIB byte with Base=101 (EBP) and Mod=00, it requires a 32-bit displacement +# The correct encoding for "NEG byte ptr [eax]" would be F618 (with Mod=00, R/M=0 for EAX) +# F61C25;[{ "Type": "Neg", "Operands": ["byte ptr [eax]"] }] +F618;[{ "Type": "Neg", "Operands": ["byte ptr [eax]"] }] + +# The correct encoding for "NEG dword ptr [eax]" would be F718 (with Mod=00, R/M=0 for EAX) +# F71C25;[{ "Type": "Neg", "Operands": ["dword ptr [eax]"] }] +F718;[{ "Type": "Neg", "Operands": ["dword ptr [eax]"] }] + +# This test case is correct, as it includes the required displacement F71C2510000000;[{ "Type": "Neg", "Operands": ["dword ptr [eax+0x10]"] }]