ia64/xen-unstable

changeset 3810:65043e7421e8

bitkeeper revision 1.1192.1.1 (420d73e1O792fPGDMcGMeH_RVU_ZZQ)

Rename arch.pagetable to arch.guest_table
author iap10@freefall.cl.cam.ac.uk
date Sat Feb 12 03:11:29 2005 +0000 (2005-02-12)
parents c62ae5f347a4
children c695b365394d
files xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/mm.c xen/arch/x86/smpboot.c xen/arch/x86/traps.c xen/arch/x86/vmx.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/domain_build.c xen/arch/x86/x86_64/domain_build.c xen/include/asm-x86/domain.h xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/dom0_ops.c	Sat Feb 12 01:52:41 2005 +0000
     1.2 +++ b/xen/arch/x86/dom0_ops.c	Sat Feb 12 03:11:29 2005 +0000
     1.3 @@ -348,16 +348,21 @@ void arch_getdomaininfo_ctxt(
     1.4      struct exec_domain *ed, full_execution_context_t *c)
     1.5  { 
     1.6      int i;
     1.7 -    unsigned long vmx_domain = ed->arch.arch_vmx.flags;
     1.8 +#ifdef __i386__  /* Remove when x86_64 VMX is implemented */
     1.9 +    unsigned long vmx_domain;
    1.10      extern void save_vmx_execution_context(execution_context_t *);
    1.11 +#endif
    1.12  
    1.13      c->flags = 0;
    1.14      memcpy(&c->cpu_ctxt, 
    1.15             &ed->arch.user_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          save_vmx_execution_context(&c->cpu_ctxt);
    1.22 +#endif
    1.23  
    1.24      if ( test_bit(EDF_DONEFPUINIT, &ed->ed_flags) )
    1.25          c->flags |= ECF_I387_VALID;
    1.26 @@ -390,7 +395,7 @@ void arch_getdomaininfo_ctxt(
    1.27      c->kernel_ss  = ed->arch.kernel_ss;
    1.28      c->kernel_esp = ed->arch.kernel_sp;
    1.29      c->pt_base   = 
    1.30 -        pagetable_val(ed->arch.pagetable);
    1.31 +        pagetable_val(ed->arch.guest_table);
    1.32      memcpy(c->debugreg, 
    1.33             ed->arch.debugreg, 
    1.34             sizeof(ed->arch.debugreg));
     2.1 --- a/xen/arch/x86/domain.c	Sat Feb 12 01:52:41 2005 +0000
     2.2 +++ b/xen/arch/x86/domain.c	Sat Feb 12 03:11:29 2005 +0000
     2.3 @@ -467,8 +467,8 @@ int arch_final_setup_guest(
     2.4      d->arch.failsafe_address  = c->failsafe_callback_eip;
     2.5      
     2.6      phys_basetab = c->pt_base;
     2.7 -    d->arch.pagetable = mk_pagetable(phys_basetab);
     2.8 -    d->arch.phys_table = d->arch.pagetable;
     2.9 +    d->arch.guest_table = mk_pagetable(phys_basetab);
    2.10 +    d->arch.phys_table = d->arch.guest_table;
    2.11      if ( !get_page_and_type(&frame_table[phys_basetab>>PAGE_SHIFT], d->domain, 
    2.12                              PGT_base_page_table) )
    2.13          return -EINVAL;
    2.14 @@ -658,7 +658,7 @@ long do_switch_to_user(void)
    2.15      struct exec_domain    *ed = current;
    2.16  
    2.17      if ( unlikely(copy_from_user(&stu, (void *)regs->rsp, sizeof(stu))) ||
    2.18 -         unlikely(pagetable_val(ed->arch.pagetable_user) == 0) )
    2.19 +         unlikely(pagetable_val(ed->arch.guest_table_user) == 0) )
    2.20          return -EFAULT;
    2.21  
    2.22      ed->arch.flags &= ~TF_kernel_mode;
    2.23 @@ -947,19 +947,19 @@ void domain_relinquish_memory(struct dom
    2.24      /* Drop the in-use references to page-table bases. */
    2.25      for_each_exec_domain ( d, ed )
    2.26      {
    2.27 -        if ( pagetable_val(ed->arch.pagetable) != 0 )
    2.28 +        if ( pagetable_val(ed->arch.guest_table) != 0 )
    2.29          {
    2.30              put_page_and_type(
    2.31 -                &frame_table[pagetable_val(ed->arch.pagetable) >> PAGE_SHIFT]);
    2.32 -            ed->arch.pagetable = mk_pagetable(0);
    2.33 +                &frame_table[pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT]);
    2.34 +            ed->arch.guest_table = mk_pagetable(0);
    2.35          }
    2.36  
    2.37 -        if ( pagetable_val(ed->arch.pagetable_user) != 0 )
    2.38 +        if ( pagetable_val(ed->arch.guest_table_user) != 0 )
    2.39          {
    2.40              put_page_and_type(
    2.41 -                &frame_table[pagetable_val(ed->arch.pagetable_user) >>
    2.42 +                &frame_table[pagetable_val(ed->arch.guest_table_user) >>
    2.43                              PAGE_SHIFT]);
    2.44 -            ed->arch.pagetable_user = mk_pagetable(0);
    2.45 +            ed->arch.guest_table_user = mk_pagetable(0);
    2.46          }
    2.47      }
    2.48  
     3.1 --- a/xen/arch/x86/mm.c	Sat Feb 12 01:52:41 2005 +0000
     3.2 +++ b/xen/arch/x86/mm.c	Sat Feb 12 03:11:29 2005 +0000
     3.3 @@ -205,16 +205,16 @@ void write_ptbase(struct exec_domain *ed
     3.4                pagetable_val(ed->arch.monitor_table) :
     3.5                pagetable_val(ed->arch.shadow_table));
     3.6      else
     3.7 -        pa = pagetable_val(ed->arch.pagetable);
     3.8 +        pa = pagetable_val(ed->arch.guest_table);
     3.9  #else
    3.10      if ( unlikely(shadow_mode(d)) )
    3.11          pa = pagetable_val(ed->arch.shadow_table);    
    3.12  #ifdef __x86_64__
    3.13      else if ( !(ed->arch.flags & TF_kernel_mode) )
    3.14 -        pa = pagetable_val(ed->arch.pagetable_user);
    3.15 +        pa = pagetable_val(ed->arch.guest_table_user);
    3.16  #endif
    3.17      else
    3.18 -        pa = pagetable_val(ed->arch.pagetable);
    3.19 +        pa = pagetable_val(ed->arch.guest_table);
    3.20  #endif
    3.21  
    3.22      write_cr3(pa);
    3.23 @@ -1249,8 +1249,8 @@ int new_guest_cr3(unsigned long pfn)
    3.24          invalidate_shadow_ldt(ed);
    3.25  
    3.26          percpu_info[cpu].deferred_ops &= ~DOP_FLUSH_TLB;
    3.27 -        old_base_pfn = pagetable_val(ed->arch.pagetable) >> PAGE_SHIFT;
    3.28 -        ed->arch.pagetable = mk_pagetable(pfn << PAGE_SHIFT);
    3.29 +        old_base_pfn = pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT;
    3.30 +        ed->arch.guest_table = mk_pagetable(pfn << PAGE_SHIFT);
    3.31  
    3.32          shadow_mk_pagetable(ed);
    3.33  
    3.34 @@ -1355,8 +1355,8 @@ static int do_extended_command(unsigned 
    3.35          else
    3.36          {
    3.37              unsigned long old_pfn =
    3.38 -                pagetable_val(ed->arch.pagetable_user) >> PAGE_SHIFT;
    3.39 -            ed->arch.pagetable_user = mk_pagetable(pfn << PAGE_SHIFT);
    3.40 +                pagetable_val(ed->arch.guest_table_user) >> PAGE_SHIFT;
    3.41 +            ed->arch.guest_table_user = mk_pagetable(pfn << PAGE_SHIFT);
    3.42              if ( old_pfn != 0 )
    3.43                  put_page_and_type(&frame_table[old_pfn]);
    3.44          }
    3.45 @@ -1676,7 +1676,7 @@ int do_mmu_update(
    3.46      cleanup_writable_pagetable(d);
    3.47  
    3.48      if ( unlikely(shadow_mode(d)) )
    3.49 -        check_pagetable(d, ed->arch.pagetable, "pre-mmu"); /* debug */
    3.50 +        check_pagetable(d, ed->arch.guest_table, "pre-mmu"); /* debug */
    3.51  
    3.52      /*
    3.53       * If we are resuming after preemption, read how much work we have already
    3.54 @@ -1924,7 +1924,7 @@ int do_mmu_update(
    3.55          __put_user(done + i, pdone);
    3.56  
    3.57      if ( unlikely(shadow_mode(d)) )
    3.58 -        check_pagetable(d, ed->arch.pagetable, "post-mmu"); /* debug */
    3.59 +        check_pagetable(d, ed->arch.guest_table, "post-mmu"); /* debug */
    3.60  
    3.61      UNLOCK_BIGLOCK(d);
    3.62      return rc;
    3.63 @@ -1983,7 +1983,7 @@ int do_update_va_mapping(unsigned long v
    3.64          if ( shadow_mode(d) == SHM_logdirty )
    3.65              mark_dirty(d, va_to_l1mfn(va));
    3.66    
    3.67 -        check_pagetable(d, ed->arch.pagetable, "va"); /* debug */
    3.68 +        check_pagetable(d, ed->arch.guest_table, "va"); /* debug */
    3.69      }
    3.70  
    3.71      deferred_ops = percpu_info[cpu].deferred_ops;
    3.72 @@ -2645,7 +2645,7 @@ void audit_domain(struct domain *d)
    3.73      synchronise_pagetables(~0UL);
    3.74  
    3.75      printk("pt base=%lx sh_info=%x\n",
    3.76 -           pagetable_val(d->exec_domain[0]->arch.pagetable)>>PAGE_SHIFT,
    3.77 +           pagetable_val(d->exec_domain[0]->arch.guest_table)>>PAGE_SHIFT,
    3.78             virt_to_page(d->shared_info)-frame_table);
    3.79             
    3.80      spin_lock(&d->page_alloc_lock);
    3.81 @@ -2694,8 +2694,8 @@ void audit_domain(struct domain *d)
    3.82  
    3.83  
    3.84      /* PHASE 1 */
    3.85 -    if ( pagetable_val(d->exec_domain[0]->arch.pagetable) )
    3.86 -        adjust(&frame_table[pagetable_val(d->exec_domain[0]->arch.pagetable)
    3.87 +    if ( pagetable_val(d->exec_domain[0]->arch.guest_table) )
    3.88 +        adjust(&frame_table[pagetable_val(d->exec_domain[0]->arch.guest_table)
    3.89                             >>PAGE_SHIFT], -1, 1);
    3.90  
    3.91      list_ent = d->page_list.next;
    3.92 @@ -2952,9 +2952,9 @@ void audit_domain(struct domain *d)
    3.93  
    3.94      spin_unlock(&d->page_alloc_lock);
    3.95  
    3.96 -    if ( pagetable_val(d->exec_domain[0]->arch.pagetable) )
    3.97 +    if ( pagetable_val(d->exec_domain[0]->arch.guest_table) )
    3.98          adjust(&frame_table[pagetable_val(
    3.99 -            d->exec_domain[0]->arch.pagetable)>>PAGE_SHIFT], 1, 1);
   3.100 +            d->exec_domain[0]->arch.guest_table)>>PAGE_SHIFT], 1, 1);
   3.101  
   3.102      printk("Audit %d: Done. pages=%d l1=%d l2=%d ctot=%d ttot=%d\n", d->id, i, l1, l2, ctot, ttot );
   3.103  
     4.1 --- a/xen/arch/x86/smpboot.c	Sat Feb 12 01:52:41 2005 +0000
     4.2 +++ b/xen/arch/x86/smpboot.c	Sat Feb 12 03:11:29 2005 +0000
     4.3 @@ -668,7 +668,7 @@ static void __init do_boot_cpu (int apic
     4.4  
     4.5      set_bit(DF_IDLETASK, &idle->d_flags);
     4.6  
     4.7 -    ed->arch.pagetable = mk_pagetable(__pa(idle_pg_table));
     4.8 +    ed->arch.guest_table = mk_pagetable(__pa(idle_pg_table));
     4.9  
    4.10      map_cpu_to_boot_apicid(cpu, apicid);
    4.11  
     5.1 --- a/xen/arch/x86/traps.c	Sat Feb 12 01:52:41 2005 +0000
     5.2 +++ b/xen/arch/x86/traps.c	Sat Feb 12 03:11:29 2005 +0000
     5.3 @@ -401,7 +401,7 @@ static int emulate_privileged_op(struct 
     5.4              break;
     5.5              
     5.6          case 3: /* Read CR3 */
     5.7 -            *reg = pagetable_val(ed->arch.pagetable);
     5.8 +            *reg = pagetable_val(ed->arch.guest_table);
     5.9              break;
    5.10  
    5.11          default:
     6.1 --- a/xen/arch/x86/vmx.c	Sat Feb 12 01:52:41 2005 +0000
     6.2 +++ b/xen/arch/x86/vmx.c	Sat Feb 12 03:11:29 2005 +0000
     6.3 @@ -419,13 +419,13 @@ static void mov_to_cr(int gp, int cr, st
     6.4                          d->arch.arch_vmx.cpu_cr3);
     6.5                  domain_crash(); /* need to take a clean path */
     6.6              }
     6.7 -            old_base_pfn = pagetable_val(d->arch.pagetable) >> PAGE_SHIFT;
     6.8 +            old_base_pfn = pagetable_val(d->arch.guest_table) >> PAGE_SHIFT;
     6.9              /*
    6.10 -             * Now mm.pagetable points to machine physical.
    6.11 +             * Now arch.guest_table points to machine physical.
    6.12               */
    6.13 -            d->arch.pagetable = mk_pagetable(pfn << PAGE_SHIFT);
    6.14 +            d->arch.guest_table = mk_pagetable(pfn << PAGE_SHIFT);
    6.15  
    6.16 -            VMX_DBG_LOG(DBG_LEVEL_VMMU, "New mm.pagetable = %lx\n", 
    6.17 +            VMX_DBG_LOG(DBG_LEVEL_VMMU, "New arch.guest_table = %lx\n", 
    6.18                      (unsigned long) (pfn << PAGE_SHIFT));
    6.19  
    6.20              shadow_lock(d->domain);
    6.21 @@ -466,7 +466,7 @@ static void mov_to_cr(int gp, int cr, st
    6.22               * We simply invalidate the shadow.
    6.23               */
    6.24              pfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
    6.25 -            if ((pfn << PAGE_SHIFT) != pagetable_val(d->arch.pagetable))
    6.26 +            if ((pfn << PAGE_SHIFT) != pagetable_val(d->arch.guest_table))
    6.27                  __vmx_bug(regs);
    6.28              vmx_shadow_clear_state(d->domain);
    6.29              shadow_invalidate(d);
    6.30 @@ -484,7 +484,7 @@ static void mov_to_cr(int gp, int cr, st
    6.31              }
    6.32              pfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
    6.33              vmx_shadow_clear_state(d->domain);
    6.34 -            d->arch.pagetable = mk_pagetable(pfn << PAGE_SHIFT);
    6.35 +            d->arch.guest_table = mk_pagetable(pfn << PAGE_SHIFT);
    6.36              shadow_mk_pagetable(d);
    6.37              /* 
    6.38               * mm->shadow_table should hold the next CR3 for shadow
     7.1 --- a/xen/arch/x86/vmx_vmcs.c	Sat Feb 12 01:52:41 2005 +0000
     7.2 +++ b/xen/arch/x86/vmx_vmcs.c	Sat Feb 12 03:11:29 2005 +0000
     7.3 @@ -219,8 +219,8 @@ void vmx_do_launch(struct exec_domain *e
     7.4      error |= __vmwrite(GUEST_TR_BASE, 0);
     7.5      error |= __vmwrite(GUEST_TR_LIMIT, 0xff);
     7.6  
     7.7 -    ed->arch.shadow_table = ed->arch.pagetable;
     7.8 -    __vmwrite(GUEST_CR3, pagetable_val(ed->arch.pagetable));
     7.9 +    ed->arch.shadow_table = ed->arch.guest_table;
    7.10 +    __vmwrite(GUEST_CR3, pagetable_val(ed->arch.guest_table));
    7.11      __vmwrite(HOST_CR3, pagetable_val(ed->arch.monitor_table));
    7.12      __vmwrite(HOST_ESP, (unsigned long)get_stack_bottom());
    7.13  
     8.1 --- a/xen/arch/x86/x86_32/domain_build.c	Sat Feb 12 01:52:41 2005 +0000
     8.2 +++ b/xen/arch/x86/x86_32/domain_build.c	Sat Feb 12 03:11:29 2005 +0000
     8.3 @@ -231,7 +231,7 @@ int construct_dom0(struct domain *d,
     8.4          mk_l2_pgentry((unsigned long)l2start | __PAGE_HYPERVISOR);
     8.5      l2tab[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT] =
     8.6          mk_l2_pgentry(__pa(d->arch.mm_perdomain_pt) | __PAGE_HYPERVISOR);
     8.7 -    ed->arch.pagetable = mk_pagetable((unsigned long)l2start);
     8.8 +    ed->arch.guest_table = mk_pagetable((unsigned long)l2start);
     8.9  
    8.10      l2tab += l2_table_offset(dsi.v_start);
    8.11      mfn = alloc_start >> PAGE_SHIFT;
     9.1 --- a/xen/arch/x86/x86_64/domain_build.c	Sat Feb 12 01:52:41 2005 +0000
     9.2 +++ b/xen/arch/x86/x86_64/domain_build.c	Sat Feb 12 03:11:29 2005 +0000
     9.3 @@ -239,7 +239,7 @@ int construct_dom0(struct domain *d,
     9.4          mk_l4_pgentry(__pa(l4start) | __PAGE_HYPERVISOR);
     9.5      l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] =
     9.6          mk_l4_pgentry(__pa(d->arch.mm_perdomain_l3) | __PAGE_HYPERVISOR);
     9.7 -    ed->arch.pagetable = mk_pagetable(__pa(l4start));
     9.8 +    ed->arch.guest_table = mk_pagetable(__pa(l4start));
     9.9  
    9.10      l4tab += l4_table_offset(dsi.v_start);
    9.11      mfn = alloc_start >> PAGE_SHIFT;
    10.1 --- a/xen/include/asm-x86/domain.h	Sat Feb 12 01:52:41 2005 +0000
    10.2 +++ b/xen/include/asm-x86/domain.h	Sat Feb 12 03:11:29 2005 +0000
    10.3 @@ -100,12 +100,14 @@ struct arch_exec_domain
    10.4       * are put in this table (eg. the current GDT is mapped here).
    10.5       */
    10.6      l1_pgentry_t *perdomain_ptes;
    10.7 -    pagetable_t  pagetable;
    10.8 -    pagetable_t  pagetable_user;  /* x86/64: user-space pagetable. */
    10.9  
   10.10 -    pagetable_t  monitor_table;
   10.11 -    pagetable_t  phys_table;            /* 1:1 pagetable */
   10.12 -    pagetable_t  shadow_table;
   10.13 +    pagetable_t  guest_table_user;      /* x86/64: user-space pagetable. */
   10.14 +    pagetable_t  guest_table;           /* guest notion of cr3 */
   10.15 +    pagetable_t  shadow_table;          /* shadow of guest */
   10.16 +    pagetable_t  monitor_table;         /* used in hypervisor */
   10.17 +
   10.18 +    pagetable_t  phys_table;            /* guest 1:1 pagetable */
   10.19 +
   10.20      l2_pgentry_t *vpagetable;	        /* virtual address of pagetable */
   10.21      l2_pgentry_t *shadow_vtable;	/* virtual address of shadow_table */
   10.22      l2_pgentry_t *guest_pl2e_cache;	/* guest page directory cache */
   10.23 @@ -122,7 +124,7 @@ struct arch_exec_domain
   10.24  #define IDLE0_ARCH_EXEC_DOMAIN                                      \
   10.25  {                                                                   \
   10.26      perdomain_ptes: 0,                                              \
   10.27 -    pagetable:      mk_pagetable(__pa(idle_pg_table))               \
   10.28 +    guest_table:    mk_pagetable(__pa(idle_pg_table))               \
   10.29  }
   10.30  
   10.31  #endif /* __ASM_DOMAIN_H__ */
    11.1 --- a/xen/include/asm-x86/shadow.h	Sat Feb 12 01:52:41 2005 +0000
    11.2 +++ b/xen/include/asm-x86/shadow.h	Sat Feb 12 03:11:29 2005 +0000
    11.3 @@ -726,7 +726,7 @@ static inline unsigned long gva_to_gpa(u
    11.4  static inline void __shadow_mk_pagetable(struct exec_domain *ed)
    11.5  {
    11.6      struct domain *d = ed->domain;
    11.7 -    unsigned long gpfn = pagetable_val(ed->arch.pagetable) >> PAGE_SHIFT;
    11.8 +    unsigned long gpfn = pagetable_val(ed->arch.guest_table) >> PAGE_SHIFT;
    11.9      unsigned long smfn = __shadow_status(d, gpfn) & PSH_pfn_mask;
   11.10  
   11.11      SH_VVLOG("0: __shadow_mk_pagetable(gpfn=%p, smfn=%p)", gpfn, smfn);
   11.12 @@ -747,7 +747,7 @@ static inline void shadow_mk_pagetable(s
   11.13       if ( unlikely(shadow_mode(ed->domain)) )
   11.14       {
   11.15           SH_VVLOG("shadow_mk_pagetable( gptbase=%p, mode=%d )",
   11.16 -             pagetable_val(ed->arch.pagetable),
   11.17 +             pagetable_val(ed->arch.guest_table),
   11.18                    shadow_mode(ed->domain)); 
   11.19  
   11.20           shadow_lock(ed->domain);
   11.21 @@ -756,7 +756,7 @@ static inline void shadow_mk_pagetable(s
   11.22  
   11.23       SH_VVLOG("leaving shadow_mk_pagetable:\n"
   11.24                "( gptbase=%p, mode=%d ) sh=%p",
   11.25 -              pagetable_val(ed->arch.pagetable),
   11.26 +              pagetable_val(ed->arch.guest_table),
   11.27                shadow_mode(ed->domain), 
   11.28                pagetable_val(ed->arch.shadow_table) );
   11.29       }