From 21d4838322acc887b59a4764792fe0294a6e6c66 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 8 Mar 2022 17:08:21 -0500 Subject: [PATCH] Fix current implementation of `data_segment`. As far as it goes. --- InstructionSets/x86/Instruction.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/InstructionSets/x86/Instruction.hpp b/InstructionSets/x86/Instruction.hpp index 702341fa3..4af89c411 100644 --- a/InstructionSets/x86/Instruction.hpp +++ b/InstructionSets/x86/Instruction.hpp @@ -611,7 +611,10 @@ template class Instruction { return AddressSize(address_size_); } Source data_segment() const { - const auto segment_override = Source((sources_ >> 12) & 7); + const auto segment_override = Source( + int(Source::ES) + + ((sources_ >> 12) & 7) + ); if(segment_override != Source::None) return segment_override; // TODO: default source should be SS for anything touching the stack. @@ -646,7 +649,7 @@ template class Instruction { sources_(uint16_t( int(source) | (int(destination) << 6) | - (int(segment_override) << 12) | + ((int(segment_override) & 7) << 12) | (int(lock) << 15) )), displacement_(displacement),