ia64/xen-unstable

changeset 3854:e2434b9a0f43

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.
author maf46@burn.cl.cam.ac.uk
date Thu Feb 17 21:06:48 2005 +0000 (2005-02-17)
parents 2bd5457fa15e
children f4a89c40649f
files BitKeeper/etc/logging_ok xen/arch/x86/shadow.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Mon Feb 14 12:17:32 2005 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Thu Feb 17 21:06:48 2005 +0000
     1.3 @@ -40,6 +40,7 @@ kaf24@striker.cl.cam.ac.uk
     1.4  kaf24@viper.(none)
     1.5  laudney@eclipse.(none)
     1.6  lynx@idefix.cl.cam.ac.uk
     1.7 +maf46@burn.cl.cam.ac.uk
     1.8  mafetter@fleming.research
     1.9  mark@maw48.kings.cam.ac.uk
    1.10  maw48@labyrinth.cl.cam.ac.uk
     2.1 --- a/xen/arch/x86/shadow.c	Mon Feb 14 12:17:32 2005 +0000
     2.2 +++ b/xen/arch/x86/shadow.c	Thu Feb 17 21:06:48 2005 +0000
     2.3 @@ -260,7 +260,7 @@ static int shadow_mode_table_op(
     2.4      ASSERT(spin_is_locked(&d->arch.shadow_lock));
     2.5  
     2.6      SH_VLOG("shadow mode table op %p %p count %d",
     2.7 -            pagetable_val(d->exec_domain[0]->arch.pagetable),    /* XXX SMP */
     2.8 +            pagetable_val(d->exec_domain[0]->arch.guest_table),  /* XXX SMP */
     2.9              pagetable_val(d->exec_domain[0]->arch.shadow_table), /* XXX SMP */
    2.10              d->arch.shadow_page_count);
    2.11  
    2.12 @@ -546,7 +546,7 @@ static void shadow_map_l1_into_current_l
    2.13      if ( !(sl1ss & PSH_shadowed) )
    2.14      {
    2.15          /* This L1 is NOT already shadowed so we need to shadow it. */
    2.16 -        SH_VVLOG("4a: l1 not shadowed ( %p )", sl1pfn);
    2.17 +        SH_VVLOG("4a: l1 not shadowed ( %p )", sl1ss);
    2.18  
    2.19          sl1mfn_info = alloc_shadow_page(d);
    2.20          sl1mfn_info->u.inuse.type_info = PGT_l1_page_table;
    2.21 @@ -618,7 +618,7 @@ int shadow_fault(unsigned long va, long 
    2.22  
    2.23      SH_VVLOG("shadow_fault( va=%p, code=%ld )", va, error_code );
    2.24  
    2.25 -    check_pagetable(d, ed->arch.pagetable, "pre-sf");
    2.26 +    check_pagetable(d, ed->arch.guest_table, "pre-sf");
    2.27  
    2.28      /*
    2.29       * STEP 1. A fast-reject set of checks with no locking.
    2.30 @@ -708,7 +708,7 @@ int shadow_fault(unsigned long va, long 
    2.31  
    2.32      shadow_unlock(d);
    2.33  
    2.34 -    check_pagetable(d, ed->arch.pagetable, "post-sf");
    2.35 +    check_pagetable(d, ed->arch.guest_table, "post-sf");
    2.36      return EXCRET_fault_fixed;
    2.37  }
    2.38  
     3.1 --- a/xen/arch/x86/vmx.c	Mon Feb 14 12:17:32 2005 +0000
     3.2 +++ b/xen/arch/x86/vmx.c	Thu Feb 17 21:06:48 2005 +0000
     3.3 @@ -114,6 +114,7 @@ static int vmx_do_page_fault(unsigned lo
     3.4      unsigned long eip;
     3.5      unsigned long gpa;
     3.6      int result;
     3.7 +    struct exec_domain *ed = current;
     3.8  
     3.9  #if VMX_DEBUG
    3.10      {
    3.11 @@ -124,6 +125,16 @@ static int vmx_do_page_fault(unsigned lo
    3.12      }
    3.13  #endif
    3.14  
    3.15 +    /*
    3.16 +     * If vpagetable is zero, then we are still emulating 1:1 page tables,
    3.17 +     * and we should have never gotten here.
    3.18 +     */
    3.19 +    if ( !ed->arch.vpagetable )
    3.20 +    {
    3.21 +        printk("vmx_do_page_fault while still running on 1:1 page table\n");
    3.22 +        return 0;
    3.23 +    }
    3.24 +
    3.25      gpa = gva_to_gpa(va);
    3.26      if (!gpa)
    3.27          return 0;
    3.28 @@ -810,7 +821,8 @@ asmlinkage void vmx_vmexit_handler(struc
    3.29              break;
    3.30          }
    3.31          default:
    3.32 -            __vmx_bug(&regs);
    3.33 +            printk("unexpected VMexit for exception vector 0x%x\n", vector);
    3.34 +            //__vmx_bug(&regs);
    3.35              break;
    3.36          }
    3.37          break;
     4.1 --- a/xen/arch/x86/vmx_io.c	Mon Feb 14 12:17:32 2005 +0000
     4.2 +++ b/xen/arch/x86/vmx_io.c	Thu Feb 17 21:06:48 2005 +0000
     4.3 @@ -380,8 +380,13 @@ 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.vpagetable )
     4.8 +        __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
     4.9 +    else
    4.10 +        // we haven't switched off the 1:1 pagetable yet...
    4.11 +        __vmwrite(GUEST_CR3, pagetable_val(d->arch.guest_table));
    4.12 +
    4.13      __vmwrite(HOST_CR3, pagetable_val(d->arch.monitor_table));
    4.14 -    __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
    4.15      __vmwrite(HOST_ESP, (unsigned long)get_stack_bottom());
    4.16  
    4.17      if (event_pending(d)) {