ia64/xen-unstable
changeset 17088:8848d9e07584
hvm: Better gating of hvm_get_segment_register() in __hvm_copy().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Mon Feb 18 21:26:57 2008 +0000 (2008-02-18) |
parents | 9d29141a5e52 |
children | f853c0497095 |
files | xen/arch/x86/hvm/hvm.c |
line diff
1.1 --- a/xen/arch/x86/hvm/hvm.c Mon Feb 18 13:50:25 2008 +0000 1.2 +++ b/xen/arch/x86/hvm/hvm.c Mon Feb 18 21:26:57 2008 +0000 1.3 @@ -1393,20 +1393,18 @@ static enum hvm_copy_result __hvm_copy( 1.4 int count, todo; 1.5 uint32_t pfec = PFEC_page_present; 1.6 1.7 - if ( virt ) 1.8 + /* 1.9 + * We cannot use hvm_get_segment_register() while executing in 1.10 + * vmx_realmode() as segment register state is cached. Furthermore, 1.11 + * VMREADs on every data access hurts emulation performance. 1.12 + * Hence we do not gather extra PFEC flags if CR0.PG == 0. 1.13 + */ 1.14 + if ( virt && (curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PG) ) 1.15 { 1.16 - /* 1.17 - * We cannot use hvm_get_segment_register() while executing in 1.18 - * vmx_realmode() as segment register state is cached. Furthermore, 1.19 - * VMREADs on every data access hurts emulation performance. 1.20 - */ 1.21 - if ( !curr->arch.hvm_vmx.vmxemul ) 1.22 - { 1.23 - struct segment_register sreg; 1.24 - hvm_get_segment_register(curr, x86_seg_ss, &sreg); 1.25 - if ( sreg.attr.fields.dpl == 3 ) 1.26 - pfec |= PFEC_user_mode; 1.27 - } 1.28 + struct segment_register sreg; 1.29 + hvm_get_segment_register(curr, x86_seg_ss, &sreg); 1.30 + if ( sreg.attr.fields.dpl == 3 ) 1.31 + pfec |= PFEC_user_mode; 1.32 1.33 if ( dir ) 1.34 pfec |= PFEC_write_access;