direct-io.hg

changeset 10487:9158ecb9045f

[HVM][VMX] On a VMEXIT, 'dirty' the DR. Restore DR from vcpu struct,
disable DR exiting (i.e., enable guest DR access), set VCPUF_dr_dirtied.

Remove "emulated" DR access, which only read and wrote to the debug register
values of the context, but not to the actual hardware values themselves.

Signed-off-by: George Dunlap <dunlapg@umich.edu>
author kaf24@firebug.cl.cam.ac.uk
date Tue Jun 27 09:54:05 2006 +0100 (2006-06-27)
parents 5610d916ad1b
children 869937819ed9
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Jun 27 09:51:18 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Jun 27 09:54:05 2006 +0100
     1.3 @@ -926,55 +926,20 @@ static void vmx_vmexit_do_cpuid(struct c
     1.4      CASE_GET_REG_P(R15, r15)
     1.5  #endif
     1.6  
     1.7 -static void vmx_dr_access (unsigned long exit_qualification, struct cpu_user_regs *regs)
     1.8 +static void vmx_dr_access(unsigned long exit_qualification,
     1.9 +                          struct cpu_user_regs *regs)
    1.10  {
    1.11 -    unsigned int reg;
    1.12 -    unsigned long *reg_p = 0;
    1.13      struct vcpu *v = current;
    1.14 -    unsigned long eip;
    1.15  
    1.16 -    __vmread(GUEST_RIP, &eip);
    1.17 -
    1.18 -    reg = exit_qualification & DEBUG_REG_ACCESS_NUM;
    1.19 -
    1.20 -    HVM_DBG_LOG(DBG_LEVEL_1,
    1.21 -                "vmx_dr_access : eip=%lx, reg=%d, exit_qualification = %lx",
    1.22 -                eip, reg, exit_qualification);
    1.23 +    v->arch.hvm_vcpu.flag_dr_dirty = 1;
    1.24  
    1.25 -    switch ( exit_qualification & DEBUG_REG_ACCESS_REG ) {
    1.26 -    CASE_GET_REG_P(EAX, eax);
    1.27 -    CASE_GET_REG_P(ECX, ecx);
    1.28 -    CASE_GET_REG_P(EDX, edx);
    1.29 -    CASE_GET_REG_P(EBX, ebx);
    1.30 -    CASE_GET_REG_P(EBP, ebp);
    1.31 -    CASE_GET_REG_P(ESI, esi);
    1.32 -    CASE_GET_REG_P(EDI, edi);
    1.33 -    CASE_EXTEND_GET_REG_P;
    1.34 -    case REG_ESP:
    1.35 -        break;
    1.36 -    default:
    1.37 -        __hvm_bug(regs);
    1.38 -    }
    1.39 +    /* We could probably be smarter about this */
    1.40 +    __restore_debug_registers(v);
    1.41  
    1.42 -    switch (exit_qualification & DEBUG_REG_ACCESS_TYPE) {
    1.43 -    case TYPE_MOV_TO_DR:
    1.44 -        /* don't need to check the range */
    1.45 -        if (reg != REG_ESP)
    1.46 -            v->arch.guest_context.debugreg[reg] = *reg_p;
    1.47 -        else {
    1.48 -            unsigned long value;
    1.49 -            __vmread(GUEST_RSP, &value);
    1.50 -            v->arch.guest_context.debugreg[reg] = value;
    1.51 -        }
    1.52 -        break;
    1.53 -    case TYPE_MOV_FROM_DR:
    1.54 -        if (reg != REG_ESP)
    1.55 -            *reg_p = v->arch.guest_context.debugreg[reg];
    1.56 -        else {
    1.57 -            __vmwrite(GUEST_RSP, v->arch.guest_context.debugreg[reg]);
    1.58 -        }
    1.59 -        break;
    1.60 -    }
    1.61 +    /* Allow guest direct access to DR registers */
    1.62 +    v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_MOV_DR_EXITING;
    1.63 +    __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
    1.64 +              v->arch.hvm_vcpu.u.vmx.exec_control);
    1.65  }
    1.66  
    1.67  /*