# HG changeset patch # User Keir Fraser # Date 1224147160 -3600 # Node ID 98ff908a91b7e12d7ddc609853fa1237d1714dec # Parent 819ab49deef1da3042d2c111d6c99c3de535dae0 vmx: set DR7 via DOMCTL_setvcpucontext This patch is needed for a guest domain debugger to support hardware watchpoint. Signed-off-by: Kouya Shimura Index: xen-3.3.1-testing/xen/arch/x86/domain.c =================================================================== --- xen-3.3.1-testing.orig/xen/arch/x86/domain.c +++ xen-3.3.1-testing/xen/arch/x86/domain.c @@ -575,7 +575,10 @@ int arch_set_info_guest( v->arch.guest_context.user_regs.eflags |= 2; if ( is_hvm_vcpu(v) ) + { + hvm_set_info_guest(v); goto out; + } /* Only CR0.TS is modifiable by guest or admin. */ v->arch.guest_context.ctrlreg[0] &= X86_CR0_TS; Index: xen-3.3.1-testing/xen/arch/x86/hvm/vmx/vmx.c =================================================================== --- xen-3.3.1-testing.orig/xen/arch/x86/hvm/vmx/vmx.c +++ xen-3.3.1-testing/xen/arch/x86/hvm/vmx/vmx.c @@ -1165,6 +1165,13 @@ static void vmx_set_uc_mode(struct vcpu vpid_sync_all(); } +static void vmx_set_info_guest(struct vcpu *v) +{ + vmx_vmcs_enter(v); + __vmwrite(GUEST_DR7, v->arch.guest_context.debugreg[7]); + vmx_vmcs_exit(v); +} + static struct hvm_function_table vmx_function_table = { .name = "VMX", .domain_initialise = vmx_domain_initialise, @@ -1195,7 +1202,8 @@ static struct hvm_function_table vmx_fun .msr_read_intercept = vmx_msr_read_intercept, .msr_write_intercept = vmx_msr_write_intercept, .invlpg_intercept = vmx_invlpg_intercept, - .set_uc_mode = vmx_set_uc_mode + .set_uc_mode = vmx_set_uc_mode, + .set_info_guest = vmx_set_info_guest }; static unsigned long *vpid_bitmap; Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm.h =================================================================== --- xen-3.3.1-testing.orig/xen/include/asm-x86/hvm/hvm.h +++ xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm.h @@ -128,6 +128,7 @@ struct hvm_function_table { int (*msr_write_intercept)(struct cpu_user_regs *regs); void (*invlpg_intercept)(unsigned long vaddr); void (*set_uc_mode)(struct vcpu *v); + void (*set_info_guest)(struct vcpu *v); }; extern struct hvm_function_table hvm_funcs; @@ -311,4 +312,10 @@ int hvm_virtual_to_linear_addr( unsigned int addr_size, unsigned long *linear_addr); +static inline void hvm_set_info_guest(struct vcpu *v) +{ + if ( hvm_funcs.set_info_guest ) + return hvm_funcs.set_info_guest(v); +} + #endif /* __ASM_X86_HVM_HVM_H__ */