ia64/xen-unstable

changeset 18644:98ff908a91b7

vmx: set DR7 via DOMCTL_setvcpucontext

This patch is needed for a guest domain debugger
to support hardware watchpoint.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Oct 16 09:52:40 2008 +0100 (2008-10-16)
parents 819ab49deef1
children 48fba1dbcfaf
files xen/arch/x86/domain.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/hvm.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Thu Oct 16 09:51:42 2008 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Thu Oct 16 09:52:40 2008 +0100
     1.3 @@ -575,7 +575,10 @@ int arch_set_info_guest(
     1.4      v->arch.guest_context.user_regs.eflags |= 2;
     1.5  
     1.6      if ( is_hvm_vcpu(v) )
     1.7 +    {
     1.8 +        hvm_set_info_guest(v);
     1.9          goto out;
    1.10 +    }
    1.11  
    1.12      /* Only CR0.TS is modifiable by guest or admin. */
    1.13      v->arch.guest_context.ctrlreg[0] &= X86_CR0_TS;
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Oct 16 09:51:42 2008 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Oct 16 09:52:40 2008 +0100
     2.3 @@ -1184,6 +1184,13 @@ static void vmx_set_uc_mode(struct vcpu 
     2.4      vpid_sync_all();
     2.5  }
     2.6  
     2.7 +static void vmx_set_info_guest(struct vcpu *v)
     2.8 +{
     2.9 +    vmx_vmcs_enter(v);
    2.10 +    __vmwrite(GUEST_DR7, v->arch.guest_context.debugreg[7]);
    2.11 +    vmx_vmcs_exit(v);
    2.12 +}
    2.13 +
    2.14  static struct hvm_function_table vmx_function_table = {
    2.15      .name                 = "VMX",
    2.16      .domain_initialise    = vmx_domain_initialise,
    2.17 @@ -1214,7 +1221,8 @@ static struct hvm_function_table vmx_fun
    2.18      .msr_read_intercept   = vmx_msr_read_intercept,
    2.19      .msr_write_intercept  = vmx_msr_write_intercept,
    2.20      .invlpg_intercept     = vmx_invlpg_intercept,
    2.21 -    .set_uc_mode          = vmx_set_uc_mode
    2.22 +    .set_uc_mode          = vmx_set_uc_mode,
    2.23 +    .set_info_guest       = vmx_set_info_guest
    2.24  };
    2.25  
    2.26  static unsigned long *vpid_bitmap;
     3.1 --- a/xen/include/asm-x86/hvm/hvm.h	Thu Oct 16 09:51:42 2008 +0100
     3.2 +++ b/xen/include/asm-x86/hvm/hvm.h	Thu Oct 16 09:52:40 2008 +0100
     3.3 @@ -128,6 +128,7 @@ struct hvm_function_table {
     3.4      int (*msr_write_intercept)(struct cpu_user_regs *regs);
     3.5      void (*invlpg_intercept)(unsigned long vaddr);
     3.6      void (*set_uc_mode)(struct vcpu *v);
     3.7 +    void (*set_info_guest)(struct vcpu *v);
     3.8  };
     3.9  
    3.10  extern struct hvm_function_table hvm_funcs;
    3.11 @@ -314,4 +315,10 @@ int hvm_virtual_to_linear_addr(
    3.12      unsigned int addr_size,
    3.13      unsigned long *linear_addr);
    3.14  
    3.15 +static inline void hvm_set_info_guest(struct vcpu *v)
    3.16 +{
    3.17 +    if ( hvm_funcs.set_info_guest )
    3.18 +        return hvm_funcs.set_info_guest(v);
    3.19 +}
    3.20 +
    3.21  #endif /* __ASM_X86_HVM_HVM_H__ */