@@ -896,6 +896,20 @@ static void test_mov_dr(uint64_t *mem)
report(rax == DR6_ACTIVE_LOW, "mov_dr6");
}
+static void test_illegal_lea(void)
+{
+ unsigned int vector;
+
+ asm volatile (ASM_TRY("1f")
+ KVM_FEP ".byte 0x8d; .byte 0xc0\n\t"
+ "1:"
+ : : : "memory", "eax");
+
+ vector = exception_vector();
+ report(vector == UD_VECTOR,
+ "Wanted #UD on LEA with /reg, got vector = %u", vector);
+}
+
static void test_push16(uint64_t *mem)
{
uint64_t rsp1, rsp2;
@@ -1187,6 +1201,7 @@ int main(void)
test_smsw_reg(mem);
test_nop(mem);
test_mov_dr(mem);
+ test_illegal_lea();
} else {
report_skip("skipping register-only tests, "
"use kvm.force_emulation_prefix=1 to enable");
LEA with a register-direct source operand is illegal. Verify that the emulator raises #UD. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Michal Luczaj <mhal@rbox.co> --- x86/emulator.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)