From cc9e8117ab3b0521f6c335939c60d8760bc6ec72 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 24 Oct 2023 16:43:22 -0400 Subject: [PATCH] Add note. --- InstructionSets/x86/Instruction.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/InstructionSets/x86/Instruction.hpp b/InstructionSets/x86/Instruction.hpp index 994674fd4..9f8b4995b 100644 --- a/InstructionSets/x86/Instruction.hpp +++ b/InstructionSets/x86/Instruction.hpp @@ -702,6 +702,16 @@ template class Instruction { // [b4, b0]: dest. uint16_t source_data_dest_sib_ = 1 << 10; // So that ::Invalid doesn't seem to have a length extension. + // Note to future self: if source length continues to prove avoidable, reuse its four bits as: + // three bits: segment (as overridden, otherwise whichever operand has a segment, if either); + // one bit: an extra bit for Operation. + // + // Then what was the length extension will hold only a repetition, if any, and the lock bit. As luck would have + // it there are six valid segment registers so there is an available sentinel value to put into the segment + // field to indicate that there's an extension if necessary. A further three bits would need to be trimmed + // to do away with that extension entirely, but since lock is rarely used and repetitions apply only to a + // small number of operations I think it'd at least be a limited problem. + bool has_length_extension() const { return !((source_data_dest_sib_ >> 10) & 15); }