ia64/xen-unstable

changeset 4158:44b147d903bc

bitkeeper revision 1.1236.32.6 (4236fad0vAzmnGrz_SutQj_CuamHkg)

Yet a bit more paranoia in the code.
No functional changes. Just made the error checking style more
consistent.

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author mafetter@fleming.research
date Tue Mar 15 15:10:08 2005 +0000 (2005-03-15)
parents 6b80eefad546
children f04c449d7f82
files xen/arch/x86/shadow.c xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Tue Mar 15 14:26:41 2005 +0000
     1.2 +++ b/xen/arch/x86/shadow.c	Tue Mar 15 15:10:08 2005 +0000
     1.3 @@ -1103,7 +1103,8 @@ static unsigned long shadow_l2_table(
     1.4              // shadow_mode_translate (but not external) sl2 tables hold a
     1.5              // ref to their hl2.
     1.6              //
     1.7 -            get_shadow_ref(hl2mfn);
     1.8 +            if ( !get_shadow_ref(hl2mfn) )
     1.9 +                BUG();
    1.10              
    1.11              spl2e[l2_table_offset(LINEAR_PT_VIRT_START)] =
    1.12                  mk_l2_pgentry((hl2mfn << PAGE_SHIFT) | __PAGE_HYPERVISOR);
    1.13 @@ -1178,7 +1179,7 @@ void shadow_map_l1_into_current_l2(unsig
    1.14      ASSERT( !(old_sl2e & _PAGE_PRESENT) );
    1.15  #endif
    1.16  
    1.17 -    if (!get_shadow_ref(sl1mfn))
    1.18 +    if ( !get_shadow_ref(sl1mfn) )
    1.19          BUG();
    1.20      l2pde_general(d, &gl2e, &sl2e, sl1mfn);
    1.21      __guest_set_l2e(ed, va, gl2e);
    1.22 @@ -1298,7 +1299,8 @@ shadow_make_snapshot(
    1.23          BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
    1.24      }
    1.25  
    1.26 -    get_shadow_ref(smfn);
    1.27 +    if ( !get_shadow_ref(smfn) )
    1.28 +        BUG();
    1.29  
    1.30      original = map_domain_mem(gmfn << PAGE_SHIFT);
    1.31      snapshot = map_domain_mem(smfn << PAGE_SHIFT);
    1.32 @@ -1341,13 +1343,7 @@ shadow_mark_mfn_out_of_sync(struct exec_
    1.33  
    1.34      ASSERT(spin_is_locked(&d->arch.shadow_lock));
    1.35      ASSERT(pfn_is_ram(mfn));
    1.36 -    //ASSERT((page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page);
    1.37 -    if (!((page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page))
    1.38 -    {
    1.39 -        printk("assertion failed: gpfn=%p gmfn=%p t=%p\n",
    1.40 -               gpfn, mfn, page->u.inuse.type_info);
    1.41 -        BUG();
    1.42 -    }
    1.43 +    ASSERT((page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page);
    1.44  
    1.45      FSH_LOG("mark_mfn_out_of_sync(gpfn=%p, mfn=%p) c=%p t=%p",
    1.46              gpfn, mfn, page->count_info, page->u.inuse.type_info);
    1.47 @@ -1378,7 +1374,7 @@ shadow_mark_mfn_out_of_sync(struct exec_
    1.48      return entry;
    1.49  }
    1.50  
    1.51 -void shadow_mark_out_of_sync(
    1.52 +void shadow_mark_va_out_of_sync(
    1.53      struct exec_domain *ed, unsigned long gpfn, unsigned long mfn, unsigned long va)
    1.54  {
    1.55      struct out_of_sync_entry *entry =
    1.56 @@ -1407,7 +1403,8 @@ void shadow_mark_out_of_sync(
    1.57      // Increment shadow's page count to represent the reference
    1.58      // inherent in entry->writable_pl1e
    1.59      //
    1.60 -    get_shadow_ref(sl2e >> PAGE_SHIFT);
    1.61 +    if ( !get_shadow_ref(sl2e >> PAGE_SHIFT) )
    1.62 +        BUG();
    1.63  
    1.64      FSH_LOG("mark_out_of_sync(va=%p -> writable_pl1e=%p)",
    1.65              va, entry->writable_pl1e);
    1.66 @@ -1917,7 +1914,8 @@ void __update_pagetables(struct exec_dom
    1.67       */
    1.68      if ( unlikely(!(smfn = __shadow_status(d, gpfn, PGT_base_page_table))) )
    1.69          smfn = shadow_l2_table(d, gpfn, gmfn);
    1.70 -    get_shadow_ref(smfn);
    1.71 +    if ( !get_shadow_ref(smfn) )
    1.72 +        BUG();
    1.73      if ( pagetable_val(ed->arch.shadow_table) )
    1.74          put_shadow_ref(pagetable_val(ed->arch.shadow_table) >> PAGE_SHIFT);
    1.75      ed->arch.shadow_table = mk_pagetable(smfn << PAGE_SHIFT);
    1.76 @@ -1945,7 +1943,8 @@ void __update_pagetables(struct exec_dom
    1.77      {
    1.78          if ( unlikely(!(hl2mfn = __shadow_status(d, gpfn, PGT_hl2_shadow))) )
    1.79              hl2mfn = shadow_hl2_table(d, gpfn, gmfn, smfn);
    1.80 -        get_shadow_ref(hl2mfn);
    1.81 +        if ( !get_shadow_ref(hl2mfn) )
    1.82 +            BUG();
    1.83  
    1.84          if ( ed->arch.hl2_vtable )
    1.85              unmap_domain_mem(ed->arch.hl2_vtable);
     2.1 --- a/xen/include/asm-x86/shadow.h	Tue Mar 15 14:26:41 2005 +0000
     2.2 +++ b/xen/include/asm-x86/shadow.h	Tue Mar 15 15:10:08 2005 +0000
     2.3 @@ -396,7 +396,8 @@ shadow_pin(unsigned long smfn)
     2.4      ASSERT( !(frame_table[smfn].u.inuse.type_info & PGT_pinned) );
     2.5  
     2.6      frame_table[smfn].u.inuse.type_info |= PGT_pinned;
     2.7 -    get_shadow_ref(smfn);
     2.8 +    if ( !get_shadow_ref(smfn) )
     2.9 +        BUG();
    2.10  }
    2.11  
    2.12  static inline void
    2.13 @@ -464,7 +465,7 @@ static inline int mark_dirty(struct doma
    2.14  
    2.15  /************************************************************************/
    2.16  
    2.17 -extern void shadow_mark_out_of_sync(
    2.18 +extern void shadow_mark_va_out_of_sync(
    2.19      struct exec_domain *ed, unsigned long gpfn, unsigned long mfn,
    2.20      unsigned long va);
    2.21  
    2.22 @@ -497,7 +498,7 @@ static inline void l1pte_write_fault(
    2.23          __mark_dirty(d, mfn);
    2.24  
    2.25      if ( mfn_is_page_table(mfn) )
    2.26 -        shadow_mark_out_of_sync(ed, gpfn, mfn, va);
    2.27 +        shadow_mark_va_out_of_sync(ed, gpfn, mfn, va);
    2.28  
    2.29      *gpte_p = gpte;
    2.30      *spte_p = spte;
    2.31 @@ -1144,7 +1145,7 @@ shadow_set_l1e(unsigned long va, unsigne
    2.32              if ( sl1mfn )
    2.33              {
    2.34                  perfc_incrc(shadow_set_l1e_unlinked);
    2.35 -                if (!get_shadow_ref(sl1mfn))
    2.36 +                if ( !get_shadow_ref(sl1mfn) )
    2.37                      BUG();
    2.38                  l2pde_general(d, &gpde, &sl2e, sl1mfn);
    2.39                  __guest_set_l2e(ed, va, gpde);