• Yang Weijiang's avatar
    selftests: kvm: Fix assert failure in single-step test · 18391e5e
    Yang Weijiang authored
    This is a follow-up patch to fix an issue left in commit:
    98b0bf02
    selftests: kvm: Use a shorter encoding to clear RAX
    
    With the change in the commit, we also need to modify "xor" instruction
    length from 3 to 2 in array ss_size accordingly to pass below check:
    
    for (i = 0; i < (sizeof(ss_size) / sizeof(ss_size[0])); i++) {
            target_rip += ss_size[i];
            CLEAR_DEBUG();
            debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
            debug.arch.debugreg[7] = 0x00000400;
            APPLY_DEBUG();
            vcpu_run(vm, VCPU_ID);
            TEST_ASSERT(run->exit_reason == KVM_EXIT_DEBUG &&
                        run->debug.arch.exception == DB_VECTOR &&
                        run->debug.arch.pc == target_rip &&
                        run->debug.arch.dr6 == target_dr6,
                        "SINGLE_STEP[%d]: exit %d exception %d rip 0x%llx "
                        "(should be 0x%llx) dr6 0x%llx (should be 0x%llx)",
                        i, run->exit_reason, run->debug.arch.exception,
                        run->debug.arch.pc, target_rip, run->debug.arch.dr6,
                        target_dr6);
    }
    Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
    Signed-off-by: default avatarYang Weijiang <weijiang.yang@intel.com>
    Message-Id: <20200826015524.13251-1-weijiang.yang@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    18391e5e
debug_regs.c 6.07 KB