mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
bitkeeper revision 1.1203.1.1 (42150768_GVy_di2OIi0ljHAGVf4VA)
Be careful to continue using the 1:1 pagetable if we take a vmexit before the vmx guest switches into protected/paged mode.
This commit is contained in:
1 parent
4696c862d6
commit
951e194e9a
4 files changed
+24
-6
No files matched your search
@@ -40,6 +40,7 @@ kaf24@striker.cl.cam.ac.uk
|
||||
kaf24@viper.(none)
|
||||
laudney@eclipse.(none)
|
||||
lynx@idefix.cl.cam.ac.uk
|
||||
maf46@burn.cl.cam.ac.uk
|
||||
mafetter@fleming.research
|
||||
mark@maw48.kings.cam.ac.uk
|
||||
maw48@labyrinth.cl.cam.ac.uk
|
||||
|
||||
@@ -260,7 +260,7 @@ static int shadow_mode_table_op(
|
||||
ASSERT(spin_is_locked(&d->arch.shadow_lock));
|
||||
|
||||
SH_VLOG("shadow mode table op %p %p count %d",
|
||||
pagetable_val(d->exec_domain[0]->arch.pagetable), /* XXX SMP */
|
||||
pagetable_val(d->exec_domain[0]->arch.guest_table), /* XXX SMP */
|
||||
pagetable_val(d->exec_domain[0]->arch.shadow_table), /* XXX SMP */
|
||||
d->arch.shadow_page_count);
|
||||
|
||||
@@ -546,7 +546,7 @@ static void shadow_map_l1_into_current_l2(unsigned long va)
|
||||
if ( !(sl1ss & PSH_shadowed) )
|
||||
{
|
||||
/* This L1 is NOT already shadowed so we need to shadow it. */
|
||||
SH_VVLOG("4a: l1 not shadowed ( %p )", sl1pfn);
|
||||
SH_VVLOG("4a: l1 not shadowed ( %p )", sl1ss);
|
||||
|
||||
sl1mfn_info = alloc_shadow_page(d);
|
||||
sl1mfn_info->u.inuse.type_info = PGT_l1_page_table;
|
||||
@@ -618,7 +618,7 @@ int shadow_fault(unsigned long va, long error_code)
|
||||
|
||||
SH_VVLOG("shadow_fault( va=%p, code=%ld )", va, error_code );
|
||||
|
||||
check_pagetable(d, ed->arch.pagetable, "pre-sf");
|
||||
check_pagetable(d, ed->arch.guest_table, "pre-sf");
|
||||
|
||||
/*
|
||||
* STEP 1. A fast-reject set of checks with no locking.
|
||||
@@ -708,7 +708,7 @@ int shadow_fault(unsigned long va, long error_code)
|
||||
|
||||
shadow_unlock(d);
|
||||
|
||||
check_pagetable(d, ed->arch.pagetable, "post-sf");
|
||||
check_pagetable(d, ed->arch.guest_table, "post-sf");
|
||||
return EXCRET_fault_fixed;
|
||||
}
|
||||
|
||||
|
||||
+13
-1
@@ -114,6 +114,7 @@ static int vmx_do_page_fault(unsigned long va, unsigned long error_code)
|
||||
unsigned long eip;
|
||||
unsigned long gpa;
|
||||
int result;
|
||||
struct exec_domain *ed = current;
|
||||
|
||||
#if VMX_DEBUG
|
||||
{
|
||||
@@ -124,6 +125,16 @@ static int vmx_do_page_fault(unsigned long va, unsigned long error_code)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If vpagetable is zero, then we are still emulating 1:1 page tables,
|
||||
* and we should have never gotten here.
|
||||
*/
|
||||
if ( !ed->arch.vpagetable )
|
||||
{
|
||||
printk("vmx_do_page_fault while still running on 1:1 page table\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
gpa = gva_to_gpa(va);
|
||||
if (!gpa)
|
||||
return 0;
|
||||
@@ -810,7 +821,8 @@ asmlinkage void vmx_vmexit_handler(struct xen_regs regs)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
__vmx_bug(®s);
|
||||
printk("unexpected VMexit for exception vector 0x%x\n", vector);
|
||||
//__vmx_bug(®s);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -380,8 +380,13 @@ void vmx_intr_assist(struct exec_domain *d)
|
||||
|
||||
void vmx_do_resume(struct exec_domain *d)
|
||||
{
|
||||
if ( d->arch.vpagetable )
|
||||
__vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
|
||||
else
|
||||
// we haven't switched off the 1:1 pagetable yet...
|
||||
__vmwrite(GUEST_CR3, pagetable_val(d->arch.guest_table));
|
||||
|
||||
__vmwrite(HOST_CR3, pagetable_val(d->arch.monitor_table));
|
||||
__vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
|
||||
__vmwrite(HOST_ESP, (unsigned long)get_stack_bottom());
|
||||
|
||||
if (event_pending(d)) {
|
||||
|
||||