From f6c153d4cf511d05d8f1df21190b73d62c2412bb Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 26 Jul 2020 04:20:35 -0700 Subject: bitwise ops, test cases, btr --- src/long_mode/mod.rs | 4 ++++ test/long_mode/mod.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 1b80b11..fe490e8 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -5492,12 +5492,16 @@ fn read_operands>(decoder: &InstDecoder, mut bytes_iter: T, op @ OperandCode::ModRM_0xc1_Ev_Ib | op @ OperandCode::ModRM_0xd0_Eb_1 | op @ OperandCode::ModRM_0xd1_Ev_1 | + op @ OperandCode::ModRM_0xd2_Eb_CL | op @ OperandCode::ModRM_0xd3_Ev_CL => { instruction.operands[0] = mem_oper; instruction.opcode = BITWISE_OPCODE_MAP[((modrm >> 3) & 7) as usize].clone(); if let OperandCode::ModRM_0xd3_Ev_CL = op { instruction.modrm_rrr = RegSpec::cl(); instruction.operands[1] = OperandSpec::RegRRR; + } else if let OperandCode::ModRM_0xd2_Eb_CL = op { + instruction.modrm_rrr = RegSpec::cl(); + instruction.operands[1] = OperandSpec::RegRRR; } else { let num = match op { OperandCode::ModRM_0xc0_Eb_Ib | diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs index 545a2d5..2ddb7d1 100644 --- a/test/long_mode/mod.rs +++ b/test/long_mode/mod.rs @@ -967,6 +967,10 @@ fn test_bitwise() { test_display_under(&InstDecoder::minimal(), &[0x41, 0x0f, 0xbc, 0xd3], "bsf edx, r11d"); test_display(&[0x48, 0x0f, 0xa3, 0xd0], "bt rax, rdx"); test_display(&[0x48, 0x0f, 0xab, 0xd0], "bts rax, rdx"); + test_display(&[0x48, 0x0f, 0xb3, 0xd0], "btr rax, rdx"); + test_display(&[0x0f, 0xb3, 0xd0], "btr eax, edx"); + test_display(&[0x66, 0x41, 0x0f, 0xb3, 0xc0], "btr r8w, ax"); + test_display(&[0xd2, 0xe0], "shl al, cl"); } #[test] -- cgit v1.1