ia64/xen-unstable
changeset 3930:e526531ea6f7
bitkeeper revision 1.1236.1.24 (421f48ea99x29xFFaWbGuSxh3s_UYQ)
Minor VMX cleanups
Signed-off-by: michael.fetterman@cl.cam.ac.uk
Minor VMX cleanups
Signed-off-by: michael.fetterman@cl.cam.ac.uk
author | maf46@burn.cl.cam.ac.uk |
---|---|
date | Fri Feb 25 15:48:58 2005 +0000 (2005-02-25) |
parents | 826d1823c5b4 |
children | 4f299b15052c |
files | xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_io.c xen/arch/x86/x86_32/traps.c xen/include/asm-x86/shadow.h |
line diff
1.1 --- a/xen/arch/x86/dom0_ops.c Fri Feb 25 14:49:40 2005 +0000 1.2 +++ b/xen/arch/x86/dom0_ops.c Fri Feb 25 15:48:58 2005 +0000 1.3 @@ -349,9 +349,10 @@ void arch_getdomaininfo_ctxt( 1.4 { 1.5 int i; 1.6 #ifdef __i386__ /* Remove when x86_64 VMX is implemented */ 1.7 - unsigned long vmx_domain; 1.8 +#ifdef CONFIG_VMX 1.9 extern void save_vmx_execution_context(execution_context_t *); 1.10 #endif 1.11 +#endif 1.12 1.13 c->flags = 0; 1.14 memcpy(&c->cpu_ctxt, 1.15 @@ -359,10 +360,11 @@ void arch_getdomaininfo_ctxt( 1.16 sizeof(ed->arch.user_ctxt)); 1.17 1.18 #ifdef __i386__ 1.19 - vmx_domain = ed->arch.arch_vmx.flags; 1.20 - if (vmx_domain) 1.21 +#ifdef CONFIG_VMX 1.22 + if ( VMX_DOMAIN(ed) ) 1.23 save_vmx_execution_context(&c->cpu_ctxt); 1.24 #endif 1.25 +#endif 1.26 1.27 if ( test_bit(EDF_DONEFPUINIT, &ed->ed_flags) ) 1.28 c->flags |= ECF_I387_VALID;
2.1 --- a/xen/arch/x86/domain.c Fri Feb 25 14:49:40 2005 +0000 2.2 +++ b/xen/arch/x86/domain.c Fri Feb 25 15:48:58 2005 +0000 2.3 @@ -723,9 +723,6 @@ void switch_to(struct exec_domain *prev_ 2.4 struct tss_struct *tss = init_tss + smp_processor_id(); 2.5 execution_context_t *stack_ec = get_execution_context(); 2.6 int i; 2.7 -#ifdef CONFIG_VMX 2.8 - unsigned long vmx_domain = next_p->arch.arch_vmx.flags; 2.9 -#endif 2.10 2.11 __cli(); 2.12 2.13 @@ -758,7 +755,7 @@ void switch_to(struct exec_domain *prev_ 2.14 } 2.15 2.16 #ifdef CONFIG_VMX 2.17 - if ( vmx_domain ) 2.18 + if ( VMX_DOMAIN(next_p) ) 2.19 { 2.20 /* Switch page tables. */ 2.21 write_ptbase(next_p);
3.1 --- a/xen/arch/x86/vmx_intercept.c Fri Feb 25 14:49:40 2005 +0000 3.2 +++ b/xen/arch/x86/vmx_intercept.c Fri Feb 25 15:48:58 2005 +0000 3.3 @@ -29,6 +29,8 @@ 3.4 #include <xen/sched.h> 3.5 #include <asm/current.h> 3.6 3.7 +#ifdef CONFIG_VMX 3.8 + 3.9 /* for intercepting io request after vm_exit, return value: 0--not handle; 1--handled */ 3.10 int vmx_io_intercept(ioreq_t *p) 3.11 { 3.12 @@ -264,3 +266,5 @@ void vmx_hooks_assist(struct exec_domain 3.13 } 3.14 3.15 } 3.16 + 3.17 +#endif /* CONFIG_VMX */
4.1 --- a/xen/arch/x86/vmx_io.c Fri Feb 25 14:49:40 2005 +0000 4.2 +++ b/xen/arch/x86/vmx_io.c Fri Feb 25 15:48:58 2005 +0000 4.3 @@ -387,11 +387,11 @@ void vmx_intr_assist(struct exec_domain 4.4 4.5 void vmx_do_resume(struct exec_domain *d) 4.6 { 4.7 - if ( d->arch.guest_vtable ) 4.8 + if ( test_bit(VMX_CPU_STATE_PG_ENABLED, &d->arch.arch_vmx.cpu_state) ) 4.9 __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table)); 4.10 else 4.11 - // we haven't switched off the 1:1 pagetable yet... 4.12 - __vmwrite(GUEST_CR3, pagetable_val(d->arch.guest_table)); 4.13 + // paging is not enabled in the guest 4.14 + __vmwrite(GUEST_CR3, pagetable_val(d->arch.phys_table)); 4.15 4.16 __vmwrite(HOST_CR3, pagetable_val(d->arch.monitor_table)); 4.17 __vmwrite(HOST_ESP, (unsigned long)get_stack_bottom());
5.1 --- a/xen/arch/x86/x86_32/traps.c Fri Feb 25 14:49:40 2005 +0000 5.2 +++ b/xen/arch/x86/x86_32/traps.c Fri Feb 25 15:48:58 2005 +0000 5.3 @@ -96,7 +96,7 @@ void show_registers(struct xen_regs *reg 5.4 const char *context; 5.5 5.6 #ifdef CONFIG_VMX 5.7 - if ( current->arch.arch_vmx.flags && (regs->eflags == 0) ) 5.8 + if ( VMX_DOMAIN(current) && (regs->eflags == 0) ) 5.9 { 5.10 __vmread(GUEST_EIP, &eip); 5.11 __vmread(GUEST_ESP, &esp);
6.1 --- a/xen/include/asm-x86/shadow.h Fri Feb 25 14:49:40 2005 +0000 6.2 +++ b/xen/include/asm-x86/shadow.h Fri Feb 25 15:48:58 2005 +0000 6.3 @@ -69,7 +69,7 @@ extern unsigned long shadow_l2_table( 6.4 struct domain *d, unsigned long gmfn); 6.5 6.6 static inline void shadow_invalidate(struct exec_domain *ed) { 6.7 - if ( !ed->arch.arch_vmx.flags ) 6.8 + if ( !VMX_DOMAIN(ed) ) 6.9 BUG(); 6.10 memset(ed->arch.shadow_vtable, 0, PAGE_SIZE); 6.11 } 6.12 @@ -766,7 +766,7 @@ static inline void __update_pagetables(s 6.13 } 6.14 } 6.15 6.16 - if ( ed->arch.arch_vmx.flags ) 6.17 + if ( VMX_DOMAIN(ed) ) 6.18 { 6.19 // Why is VMX mode doing this? 6.20 shadow_invalidate(ed); 6.21 @@ -780,20 +780,22 @@ static inline void __update_pagetables(s 6.22 6.23 static inline void update_pagetables(struct exec_domain *ed) 6.24 { 6.25 - if ( unlikely(shadow_mode_enabled(ed->domain)) ) 6.26 + struct domain *d = ed->domain; 6.27 + 6.28 + if ( unlikely(shadow_mode_enabled(d)) ) 6.29 { 6.30 - shadow_lock(ed->domain); 6.31 + shadow_lock(d); 6.32 __update_pagetables(ed); 6.33 - shadow_unlock(ed->domain); 6.34 + shadow_unlock(d); 6.35 } 6.36 - if ( !shadow_mode_external(ed->domain) ) 6.37 + if ( !shadow_mode_external(d) ) 6.38 { 6.39 #ifdef __x86_64__ 6.40 if ( !(ed->arch.flags & TF_kernel_mode) ) 6.41 ed->arch.monitor_table = ed->arch.guest_table_user; 6.42 else 6.43 #endif 6.44 - if ( shadow_mode_enabled(ed->domain) ) 6.45 + if ( shadow_mode_enabled(d) ) 6.46 ed->arch.monitor_table = ed->arch.shadow_table; 6.47 else 6.48 ed->arch.monitor_table = ed->arch.guest_table;