From 96087a69fab560c8e434d47dcff7157dab44b47e Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Sun, 31 Mar 2024 10:38:13 +0000 Subject: [PATCH] Fix reference to OoB address in offsetof and remove rflags printout Adjust static array size to match new size. Remove rflags from printing code and adjust offsets - fixes printing off-by-one error. --- Source/Tools/CommonTools/HarnessHelpers.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/Tools/CommonTools/HarnessHelpers.h b/Source/Tools/CommonTools/HarnessHelpers.h index 278fe5b238..1343f52f19 100644 --- a/Source/Tools/CommonTools/HarnessHelpers.h +++ b/Source/Tools/CommonTools/HarnessHelpers.h @@ -125,7 +125,7 @@ namespace FEX::HarnessHelper { } if (BaseConfig.OptionRegDataCount > 0) { - static constexpr std::array OffsetArrayAVX = {{ + static constexpr std::array OffsetArrayAVX = {{ offsetof(FEXCore::Core::CPUState, rip), offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RAX]), offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RBX]), @@ -169,9 +169,8 @@ namespace FEX::HarnessHelper { offsetof(FEXCore::Core::CPUState, mm[5][0]), offsetof(FEXCore::Core::CPUState, mm[6][0]), offsetof(FEXCore::Core::CPUState, mm[7][0]), - offsetof(FEXCore::Core::CPUState, mm[8][0]), }}; - static constexpr std::array OffsetArraySSE = {{ + static constexpr std::array OffsetArraySSE = {{ offsetof(FEXCore::Core::CPUState, rip), offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RAX]), offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RBX]), @@ -215,7 +214,6 @@ namespace FEX::HarnessHelper { offsetof(FEXCore::Core::CPUState, mm[5][0]), offsetof(FEXCore::Core::CPUState, mm[6][0]), offsetof(FEXCore::Core::CPUState, mm[7][0]), - offsetof(FEXCore::Core::CPUState, mm[8][0]), }}; uintptr_t DataOffset = BaseConfig.OptionRegDataOffset; @@ -254,10 +252,9 @@ namespace FEX::HarnessHelper { Name = "gs"; else if (NameIndex == 34) Name ="fs"; - else if (NameIndex == 35) - Name = "rflags"; - else if (NameIndex >= 36 && NameIndex < 45) - Name = fextl::fmt::format("MM[{}][{}]", NameIndex - 36, j); + else if (NameIndex >= 35 && NameIndex < 43) { + Name = fextl::fmt::format("MM[{}][{}]", NameIndex - 35, j); + } if (State1) { CheckGPRs(fextl::fmt::format("Core1: {}: ", Name), State1Data[j], RegData->RegValues[j]);