direct-io.hg

changeset 3869:d6d5fbf0eee1

bitkeeper revision 1.1205.1.7 (42179095Rjv8vD5JDTuaW-NIVH4aWA)

Minor cleanups.
author maf46@burn.cl.cam.ac.uk
date Sat Feb 19 19:16:37 2005 +0000 (2005-02-19)
parents be663b5d36ee
children 5943b2cd1c2a
files xen/arch/x86/domain.c xen/arch/x86/vmx.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Fri Feb 18 15:58:57 2005 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Sat Feb 19 19:16:37 2005 +0000
     1.3 @@ -427,26 +427,27 @@ out:
     1.4  
     1.5  /* This is called by arch_final_setup_guest and do_boot_vcpu */
     1.6  int arch_final_setup_guest(
     1.7 -    struct exec_domain *d, full_execution_context_t *c)
     1.8 +    struct exec_domain *ed, full_execution_context_t *c)
     1.9  {
    1.10 +    struct domain *d = ed->domain;
    1.11      unsigned long phys_basetab;
    1.12      int i, rc;
    1.13  
    1.14 -    clear_bit(EDF_DONEFPUINIT, &d->ed_flags);
    1.15 +    clear_bit(EDF_DONEFPUINIT, &ed->ed_flags);
    1.16      if ( c->flags & ECF_I387_VALID )
    1.17 -        set_bit(EDF_DONEFPUINIT, &d->ed_flags);
    1.18 +        set_bit(EDF_DONEFPUINIT, &ed->ed_flags);
    1.19  
    1.20 -    d->arch.flags &= ~TF_kernel_mode;
    1.21 +    ed->arch.flags &= ~TF_kernel_mode;
    1.22      if ( c->flags & ECF_IN_KERNEL )
    1.23 -        d->arch.flags |= TF_kernel_mode;
    1.24 +        ed->arch.flags |= TF_kernel_mode;
    1.25  
    1.26 -    memcpy(&d->arch.user_ctxt,
    1.27 +    memcpy(&ed->arch.user_ctxt,
    1.28             &c->cpu_ctxt,
    1.29 -           sizeof(d->arch.user_ctxt));
    1.30 +           sizeof(ed->arch.user_ctxt));
    1.31  
    1.32      /* Clear IOPL for unprivileged domains. */
    1.33 -    if (!IS_PRIV(d->domain))
    1.34 -        d->arch.user_ctxt.eflags &= 0xffffcfff;
    1.35 +    if (!IS_PRIV(d))
    1.36 +        ed->arch.user_ctxt.eflags &= 0xffffcfff;
    1.37  
    1.38      /*
    1.39       * This is sufficient! If the descriptor DPL differs from CS RPL then we'll
    1.40 @@ -454,48 +455,48 @@ int arch_final_setup_guest(
    1.41       * If SS RPL or DPL differs from CS RPL then we'll #GP.
    1.42       */
    1.43      if (!(c->flags & ECF_VMX_GUEST)) 
    1.44 -        if ( ((d->arch.user_ctxt.cs & 3) == 0) ||
    1.45 -             ((d->arch.user_ctxt.ss & 3) == 0) )
    1.46 +        if ( ((ed->arch.user_ctxt.cs & 3) == 0) ||
    1.47 +             ((ed->arch.user_ctxt.ss & 3) == 0) )
    1.48                  return -EINVAL;
    1.49  
    1.50 -    memcpy(&d->arch.i387,
    1.51 +    memcpy(&ed->arch.i387,
    1.52             &c->fpu_ctxt,
    1.53 -           sizeof(d->arch.i387));
    1.54 +           sizeof(ed->arch.i387));
    1.55  
    1.56 -    memcpy(d->arch.traps,
    1.57 +    memcpy(ed->arch.traps,
    1.58             &c->trap_ctxt,
    1.59 -           sizeof(d->arch.traps));
    1.60 +           sizeof(ed->arch.traps));
    1.61  
    1.62 -    if ( (rc = (int)set_fast_trap(d, c->fast_trap_idx)) != 0 )
    1.63 +    if ( (rc = (int)set_fast_trap(ed, c->fast_trap_idx)) != 0 )
    1.64          return rc;
    1.65  
    1.66 -    d->arch.ldt_base = c->ldt_base;
    1.67 -    d->arch.ldt_ents = c->ldt_ents;
    1.68 +    ed->arch.ldt_base = c->ldt_base;
    1.69 +    ed->arch.ldt_ents = c->ldt_ents;
    1.70  
    1.71 -    d->arch.kernel_ss = c->kernel_ss;
    1.72 -    d->arch.kernel_sp = c->kernel_esp;
    1.73 +    ed->arch.kernel_ss = c->kernel_ss;
    1.74 +    ed->arch.kernel_sp = c->kernel_esp;
    1.75  
    1.76      for ( i = 0; i < 8; i++ )
    1.77 -        (void)set_debugreg(d, i, c->debugreg[i]);
    1.78 +        (void)set_debugreg(ed, i, c->debugreg[i]);
    1.79  
    1.80 -    d->arch.event_selector    = c->event_callback_cs;
    1.81 -    d->arch.event_address     = c->event_callback_eip;
    1.82 -    d->arch.failsafe_selector = c->failsafe_callback_cs;
    1.83 -    d->arch.failsafe_address  = c->failsafe_callback_eip;
    1.84 -    
    1.85 +    ed->arch.event_selector    = c->event_callback_cs;
    1.86 +    ed->arch.event_address     = c->event_callback_eip;
    1.87 +    ed->arch.failsafe_selector = c->failsafe_callback_cs;
    1.88 +    ed->arch.failsafe_address  = c->failsafe_callback_eip;
    1.89 +
    1.90      phys_basetab = c->pt_base;
    1.91 -    d->arch.guest_table = d->arch.phys_table = mk_pagetable(phys_basetab);
    1.92 +    ed->arch.guest_table = ed->arch.phys_table = mk_pagetable(phys_basetab);
    1.93  
    1.94 -    if ( !get_page_and_type(&frame_table[phys_basetab>>PAGE_SHIFT], d->domain, 
    1.95 +    if ( !get_page_and_type(&frame_table[phys_basetab>>PAGE_SHIFT], d, 
    1.96                              PGT_base_page_table) )
    1.97          return -EINVAL;
    1.98  
    1.99      /* Failure to set GDT is harmless. */
   1.100 -    SET_GDT_ENTRIES(d, DEFAULT_GDT_ENTRIES);
   1.101 -    SET_GDT_ADDRESS(d, DEFAULT_GDT_ADDRESS);
   1.102 +    SET_GDT_ENTRIES(ed, DEFAULT_GDT_ENTRIES);
   1.103 +    SET_GDT_ADDRESS(ed, DEFAULT_GDT_ADDRESS);
   1.104      if ( c->gdt_ents != 0 )
   1.105      {
   1.106 -        if ( (rc = (int)set_gdt(d, c->gdt_frames, c->gdt_ents)) != 0 )
   1.107 +        if ( (rc = (int)set_gdt(ed, c->gdt_frames, c->gdt_ents)) != 0 )
   1.108          {
   1.109              put_page_and_type(&frame_table[phys_basetab>>PAGE_SHIFT]);
   1.110              return rc;
   1.111 @@ -504,10 +505,10 @@ int arch_final_setup_guest(
   1.112  
   1.113  #ifdef CONFIG_VMX
   1.114      if (c->flags & ECF_VMX_GUEST)
   1.115 -        return vmx_final_setup_guest(d, c);
   1.116 +        return vmx_final_setup_guest(ed, c);
   1.117  #endif
   1.118  
   1.119 -    update_pagetables(d);
   1.120 +    update_pagetables(ed);
   1.121  
   1.122      return 0;
   1.123  }
     2.1 --- a/xen/arch/x86/vmx.c	Fri Feb 18 15:58:57 2005 +0000
     2.2 +++ b/xen/arch/x86/vmx.c	Sat Feb 19 19:16:37 2005 +0000
     2.3 @@ -405,7 +405,7 @@ static void mov_to_cr(int gp, int cr, st
     2.4      switch(cr) {
     2.5      case 0: 
     2.6      {
     2.7 -        unsigned long old_base_pfn = 0, pfn;
     2.8 +        unsigned long old_base_mfn = 0, mfn;
     2.9  
    2.10          /* 
    2.11           * CR0:
    2.12 @@ -423,14 +423,14 @@ static void mov_to_cr(int gp, int cr, st
    2.13              /*
    2.14               * The guest CR3 must be pointing to the guest physical.
    2.15               */
    2.16 -            if (!(pfn = phys_to_machine_mapping(
    2.17 +            if (!(mfn = phys_to_machine_mapping(
    2.18                        d->arch.arch_vmx.cpu_cr3 >> PAGE_SHIFT))) 
    2.19              {
    2.20                  VMX_DBG_LOG(DBG_LEVEL_VMMU, "Invalid CR3 value = %lx", 
    2.21                          d->arch.arch_vmx.cpu_cr3);
    2.22                  domain_crash(); /* need to take a clean path */
    2.23              }
    2.24 -            old_base_pfn = pagetable_val(d->arch.guest_table) >> PAGE_SHIFT;
    2.25 +            old_base_mfn = pagetable_val(d->arch.guest_table) >> PAGE_SHIFT;
    2.26  
    2.27              /* We know that none of the previous 1:1 shadow pages are
    2.28               * going to be used again, so might as well flush them.
    2.29 @@ -443,27 +443,27 @@ static void mov_to_cr(int gp, int cr, st
    2.30              /*
    2.31               * Now arch.guest_table points to machine physical.
    2.32               */
    2.33 -            d->arch.guest_table = mk_pagetable(pfn << PAGE_SHIFT);
    2.34 +            d->arch.guest_table = mk_pagetable(mfn << PAGE_SHIFT);
    2.35              update_pagetables(d);
    2.36  
    2.37              VMX_DBG_LOG(DBG_LEVEL_VMMU, "New arch.guest_table = %lx", 
    2.38 -                    (unsigned long) (pfn << PAGE_SHIFT));
    2.39 +                    (unsigned long) (mfn << PAGE_SHIFT));
    2.40  
    2.41              __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
    2.42              /* 
    2.43               * arch->shadow_table should hold the next CR3 for shadow
    2.44               */
    2.45 -            VMX_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %lx, pfn = %lx", 
    2.46 -                    d->arch.arch_vmx.cpu_cr3, pfn);
    2.47 +            VMX_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %lx, mfn = %lx", 
    2.48 +                    d->arch.arch_vmx.cpu_cr3, mfn);
    2.49              /* undo the get_page done in the para virt case */
    2.50 -            put_page_and_type(&frame_table[old_base_pfn]);
    2.51 +            put_page_and_type(&frame_table[old_base_mfn]);
    2.52  
    2.53          }
    2.54          break;
    2.55      }
    2.56      case 3: 
    2.57      {
    2.58 -        unsigned long pfn;
    2.59 +        unsigned long mfn;
    2.60  
    2.61          /*
    2.62           * If paging is not enabled yet, simply copy the value to CR3.
    2.63 @@ -483,8 +483,8 @@ static void mov_to_cr(int gp, int cr, st
    2.64               * removed some translation or changed page attributes.
    2.65               * We simply invalidate the shadow.
    2.66               */
    2.67 -            pfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
    2.68 -            if ((pfn << PAGE_SHIFT) != pagetable_val(d->arch.guest_table))
    2.69 +            mfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
    2.70 +            if ((mfn << PAGE_SHIFT) != pagetable_val(d->arch.guest_table))
    2.71                  __vmx_bug(regs);
    2.72              vmx_shadow_clear_state(d->domain);
    2.73              shadow_invalidate(d);
    2.74 @@ -500,9 +500,9 @@ static void mov_to_cr(int gp, int cr, st
    2.75                          "Invalid CR3 value=%lx", value);
    2.76                  domain_crash(); /* need to take a clean path */
    2.77              }
    2.78 -            pfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
    2.79 +            mfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
    2.80              vmx_shadow_clear_state(d->domain);
    2.81 -            d->arch.guest_table  = mk_pagetable(pfn << PAGE_SHIFT);
    2.82 +            d->arch.guest_table  = mk_pagetable(mfn << PAGE_SHIFT);
    2.83              update_pagetables(d); 
    2.84              /* 
    2.85               * arch.shadow_table should now hold the next CR3 for shadow