ia64/xen-unstable
changeset 3931:4f299b15052c
bitkeeper revision 1.1236.1.25 (421f4d3f1OCTsnYVCTM2mhwvFDIGvA)
alloc_monitor_pagetable/update_pagetable cleanup.
update_pagetable() is now the only code that (ever) sets
arch.monitor_table. update_pagetable() is also now smart
enough to deal with VMX guests while their paging is still
disabled.
Signed-off-by: michael.fetterman@cl.cam.ac.uk
alloc_monitor_pagetable/update_pagetable cleanup.
update_pagetable() is now the only code that (ever) sets
arch.monitor_table. update_pagetable() is also now smart
enough to deal with VMX guests while their paging is still
disabled.
Signed-off-by: michael.fetterman@cl.cam.ac.uk
author | maf46@burn.cl.cam.ac.uk |
---|---|
date | Fri Feb 25 16:07:27 2005 +0000 (2005-02-25) |
parents | e526531ea6f7 |
children | e93d8f53eabb |
files | xen/arch/x86/domain.c xen/include/asm-x86/shadow.h xen/include/xen/domain.h |
line diff
1.1 --- a/xen/arch/x86/domain.c Fri Feb 25 15:48:58 2005 +0000 1.2 +++ b/xen/arch/x86/domain.c Fri Feb 25 16:07:27 2005 +0000 1.3 @@ -295,7 +295,7 @@ void arch_vmx_do_launch(struct exec_doma 1.4 reset_stack_and_jump(vmx_asm_do_launch); 1.5 } 1.6 1.7 -static void alloc_monitor_pagetable(struct exec_domain *ed) 1.8 +unsigned long alloc_monitor_pagetable(struct exec_domain *ed) 1.9 { 1.10 unsigned long mmfn; 1.11 l2_pgentry_t *mpl2e; 1.12 @@ -319,12 +319,13 @@ static void alloc_monitor_pagetable(stru 1.13 mk_l2_pgentry((__pa(d->arch.mm_perdomain_pt) & PAGE_MASK) 1.14 | __PAGE_HYPERVISOR); 1.15 1.16 - ed->arch.monitor_table = mk_pagetable(mmfn << PAGE_SHIFT); 1.17 ed->arch.monitor_vtable = mpl2e; 1.18 1.19 // map the phys_to_machine map into the Read-Only MPT space for this domain 1.20 mpl2e[l2_table_offset(RO_MPT_VIRT_START)] = 1.21 mk_l2_pgentry(pagetable_val(ed->arch.phys_table) | __PAGE_HYPERVISOR); 1.22 + 1.23 + return mmfn; 1.24 } 1.25 1.26 /* 1.27 @@ -408,13 +409,7 @@ static int vmx_final_setup_guest(struct 1.28 shadow_mode_enable(ed->domain, SHM_enable|SHM_translate|SHM_external); 1.29 } 1.30 1.31 - /* We don't call update_pagetables() as we actively want fields such as 1.32 - * the linear_pg_table to be inaccessible so that we bail out early of 1.33 - * shadow_fault() in case the vmx guest tries illegal accesses with 1.34 - * paging turned off. 1.35 - */ 1.36 - //update_pagetables(ed); /* this assigns shadow_pagetable */ 1.37 - alloc_monitor_pagetable(ed); /* this assigns monitor_pagetable */ 1.38 + update_pagetables(ed); 1.39 1.40 return 0; 1.41
2.1 --- a/xen/include/asm-x86/shadow.h Fri Feb 25 15:48:58 2005 +0000 2.2 +++ b/xen/include/asm-x86/shadow.h Fri Feb 25 16:07:27 2005 +0000 2.3 @@ -781,13 +781,27 @@ static inline void __update_pagetables(s 2.4 static inline void update_pagetables(struct exec_domain *ed) 2.5 { 2.6 struct domain *d = ed->domain; 2.7 + int paging_enabled = 2.8 +#ifdef CONFIG_VMX 2.9 + !VMX_DOMAIN(ed) || 2.10 + test_bit(VMX_CPU_STATE_PG_ENABLED, &ed->arch.arch_vmx.cpu_state); 2.11 +#else 2.12 + 1; 2.13 +#endif 2.14 2.15 - if ( unlikely(shadow_mode_enabled(d)) ) 2.16 + /* 2.17 + * We don't call __update_pagetables() when vmx guest paging is 2.18 + * disabled as we want the linear_pg_table to be inaccessible so that 2.19 + * we bail out early of shadow_fault() if the vmx guest tries illegal 2.20 + * accesses while it thinks paging is turned off. 2.21 + */ 2.22 + if ( unlikely(shadow_mode_enabled(d)) && paging_enabled ) 2.23 { 2.24 shadow_lock(d); 2.25 __update_pagetables(ed); 2.26 shadow_unlock(d); 2.27 } 2.28 + 2.29 if ( !shadow_mode_external(d) ) 2.30 { 2.31 #ifdef __x86_64__ 2.32 @@ -800,6 +814,15 @@ static inline void update_pagetables(str 2.33 else 2.34 ed->arch.monitor_table = ed->arch.guest_table; 2.35 } 2.36 + else 2.37 + { 2.38 + // External page tables... 2.39 + // Allocate a monitor page table if we don't already have one. 2.40 + // 2.41 + if ( unlikely(!pagetable_val(ed->arch.monitor_table)) ) 2.42 + ed->arch.monitor_table = 2.43 + mk_pagetable(alloc_monitor_pagetable(ed) << PAGE_SHIFT); 2.44 + } 2.45 } 2.46 2.47 #if SHADOW_DEBUG
3.1 --- a/xen/include/xen/domain.h Fri Feb 25 15:48:58 2005 +0000 3.2 +++ b/xen/include/xen/domain.h Fri Feb 25 16:07:27 2005 +0000 3.3 @@ -27,4 +27,6 @@ extern void domain_relinquish_memory(str 3.4 3.5 extern void dump_pageframe_info(struct domain *d); 3.6 3.7 +extern unsigned long alloc_monitor_pagetable(struct exec_domain *ed); 3.8 + 3.9 #endif /* __XEN_DOMAIN_H__ */