Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qemu/target/i386/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -5493,7 +5493,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
mod = (modrm >> 6) & 3;
rm = (modrm & 7) | REX_B(s);
op = (modrm >> 3) & 7;
if (op >= 2 && b == 0xfe) {
if (op == 7 || (op >= 2 && b == 0xfe)) {
goto unknown_op;
}
if (CODE64(s)) {
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/test_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,23 @@ static void test_x86_group_1a(void)
OK(uc_close(uc));
}

static void test_x86_group_5_modrm_reg_7(void)
{
uc_engine *uc;
char code[] = {
0xff, (7 << 3), 0x01, 0x02, 0x03, 0x04
};

uc_common_setup(&uc, UC_ARCH_X86, UC_MODE_64, code, sizeof(code));

uint64_t rax = code_start + code_len + 0x100;
OK(uc_reg_write(uc, UC_X86_REG_RAX, &rax));
uc_assert_err(UC_ERR_INSN_INVALID,
uc_emu_start(uc, code_start, code_start + sizeof(code), 0, 0));

OK(uc_close(uc));
}

static void test_x86_lock_bt_mem(void)
{
uc_engine *uc;
Expand Down Expand Up @@ -2732,6 +2749,7 @@ static void test_x86_lock_btc_reg(void)
OK(uc_close(uc));
}


TEST_LIST = {
{"test_x86_in", test_x86_in},
{"test_x86_out", test_x86_out},
Expand Down Expand Up @@ -2810,6 +2828,7 @@ TEST_LIST = {
{"test_x86_aaa_flags", test_x86_aaa_flags},
{"test_x86_aas_flags", test_x86_aas_flags},
{"test_x86_group_1a", test_x86_group_1a},
{"test_x86_group_5_modrm_reg_7", test_x86_group_5_modrm_reg_7},
{"test_x86_lock_bt_mem", test_x86_lock_bt_mem},
{"test_x86_lock_bt_reg", test_x86_lock_bt_reg},
{"test_x86_lock_btc_mem", test_x86_lock_btc_mem},
Expand Down
Loading