From 026ed1af761c592933997e2192da598af3306040 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 22 Jul 2018 19:04:40 -0700 Subject: 4387 --- subx/022check_instruction.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'subx/022check_instruction.cc') diff --git a/subx/022check_instruction.cc b/subx/022check_instruction.cc index e5ccbdca..a1852d84 100644 --- a/subx/022check_instruction.cc +++ b/subx/022check_instruction.cc @@ -233,7 +233,7 @@ void check_operands_modrm(const line& inst) { void compare_bitvector(uint8_t op, const line& inst, uint8_t expected) { uint8_t bitvector = compute_operand_bitvector(inst); if (trace_contains_errors()) return; // duplicate operand type - if (bitvector == 0 && expected != 0 && has_operands(inst)) return; // deliberately programming in raw hex; we'll raise a warning elsewhere + if (bitvector == 0 && expected != 0 && has_operands(inst) && all_hex_bytes(inst)) return; // deliberately programming in raw hex; we'll raise a warning elsewhere if (bitvector == expected) return; // all good with this instruction for (int i = 0; i < NUM_OPERAND_TYPES; ++i, bitvector >>= 1, expected >>= 1) { //? cerr << "comparing " << HEXBYTE << NUM(bitvector) << " with " << NUM(expected) << '\n'; @@ -256,6 +256,13 @@ bool has_operands(const line& inst) { return true; } +bool all_hex_bytes(const line& inst) { + for (int i = 0; i < SIZE(inst.words); ++i) + if (inst.words.at(i).data.find_first_not_of("0123456789abcdefABCDEF") != string::npos) + return false; + return true; +} + uint32_t compute_operand_bitvector(const line& inst) { uint32_t bitvector = 0; for (int i = /*skip op*/1; i < SIZE(inst.words); ++i) { -- cgit 1.4.1-2-gfad0