From f039d44ee383e80fa765fc42ccf9756f79e7f783 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 15 Sep 2023 22:08:20 -0400 Subject: [PATCH] Fully handle rm = 6, mod = 0. --- InstructionSets/x86/Decoder.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/InstructionSets/x86/Decoder.cpp b/InstructionSets/x86/Decoder.cpp index 6dd089236..9459fd974 100644 --- a/InstructionSets/x86/Decoder.cpp +++ b/InstructionSets/x86/Decoder.cpp @@ -640,6 +640,10 @@ std::pair::InstructionT> Decoder::decode(con operation_ == Operation::LFS) { undefined(); } + } else if(rm == 6 && mod == 0) { + // There's no BP direct; BP with ostensibly no offset means 'direct address' mode. + displacement_size_ = data_size(address_size_); + memreg = Source::DirectAddress; } else { const DataSize sizes[] = { DataSize::None, @@ -670,11 +674,6 @@ std::pair::InstructionT> Decoder::decode(con }; sib_ = rm_table[rm]; - - // BP always gets a displacement. - if(rm == 6 && displacement_size_ == DataSize::None) { - displacement_size_ = DataSize::Word; - } } }