Software Archive
Read-only legacy content
17061 Discussions

Intel VT-x: Configuring debug registers to debug from host

proy4
Beginner
416 Views

I am trying to configure the debug registers in the host so that I can monitor an address of a guest running on Intel VT-x. For this I have called KVM_SET_GUEST_DEBUG IOCTL.

 

    struct kvm_guest_debug guest_debug;
    guest_debug.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
    guest_debug.arch.debugreg[0] = addr; // DR0
    guest_debug.arch.debugreg[7] = encode_dr7(0, len, bpType);
    if (ioctl(vcpu_fd, KVM_SET_GUEST_DEBUG, &guest_debug) < 0)
        return false;

 

It successfully sets up the debug register. But upon debug register read/write, it causes VM_EXIT with EXIT_REASON_EXCEPTION_NMI. Although I am expecting to have EXIT_REASON_DR_ACCESS. What is the reason that causes an nmi exit instead of DR_ACCESS exit? Did I set the registers right?

0 Kudos
0 Replies
Reply