[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Yet a bit more paranoia in the code.
ChangeSet 1.1236.32.6, 2005/03/15 15:10:08+00:00, mafetter@xxxxxxxxxxxxxxxx Yet a bit more paranoia in the code. No functional changes. Just made the error checking style more consistent. Signed-off-by: michael.fetterman@xxxxxxxxxxxx arch/x86/shadow.c | 27 +++++++++++++-------------- include/asm-x86/shadow.h | 9 +++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff -Nru a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c --- a/xen/arch/x86/shadow.c 2005-04-05 12:09:06 -04:00 +++ b/xen/arch/x86/shadow.c 2005-04-05 12:09:06 -04:00 @@ -1103,7 +1103,8 @@ // shadow_mode_translate (but not external) sl2 tables hold a // ref to their hl2. // - get_shadow_ref(hl2mfn); + if ( !get_shadow_ref(hl2mfn) ) + BUG(); spl2e[l2_table_offset(LINEAR_PT_VIRT_START)] = mk_l2_pgentry((hl2mfn << PAGE_SHIFT) | __PAGE_HYPERVISOR); @@ -1178,7 +1179,7 @@ ASSERT( !(old_sl2e & _PAGE_PRESENT) ); #endif - if (!get_shadow_ref(sl1mfn)) + if ( !get_shadow_ref(sl1mfn) ) BUG(); l2pde_general(d, &gl2e, &sl2e, sl1mfn); __guest_set_l2e(ed, va, gl2e); @@ -1298,7 +1299,8 @@ BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */ } - get_shadow_ref(smfn); + if ( !get_shadow_ref(smfn) ) + BUG(); original = map_domain_mem(gmfn << PAGE_SHIFT); snapshot = map_domain_mem(smfn << PAGE_SHIFT); @@ -1341,13 +1343,7 @@ ASSERT(spin_is_locked(&d->arch.shadow_lock)); ASSERT(pfn_is_ram(mfn)); - //ASSERT((page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page); - if (!((page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page)) - { - printk("assertion failed: gpfn=%p gmfn=%p t=%p\n", - gpfn, mfn, page->u.inuse.type_info); - BUG(); - } + ASSERT((page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page); FSH_LOG("mark_mfn_out_of_sync(gpfn=%p, mfn=%p) c=%p t=%p", gpfn, mfn, page->count_info, page->u.inuse.type_info); @@ -1378,7 +1374,7 @@ return entry; } -void shadow_mark_out_of_sync( +void shadow_mark_va_out_of_sync( struct exec_domain *ed, unsigned long gpfn, unsigned long mfn, unsigned long va) { struct out_of_sync_entry *entry = @@ -1407,7 +1403,8 @@ // Increment shadow's page count to represent the reference // inherent in entry->writable_pl1e // - get_shadow_ref(sl2e >> PAGE_SHIFT); + if ( !get_shadow_ref(sl2e >> PAGE_SHIFT) ) + BUG(); FSH_LOG("mark_out_of_sync(va=%p -> writable_pl1e=%p)", va, entry->writable_pl1e); @@ -1917,7 +1914,8 @@ */ if ( unlikely(!(smfn = __shadow_status(d, gpfn, PGT_base_page_table))) ) smfn = shadow_l2_table(d, gpfn, gmfn); - get_shadow_ref(smfn); + if ( !get_shadow_ref(smfn) ) + BUG(); if ( pagetable_val(ed->arch.shadow_table) ) put_shadow_ref(pagetable_val(ed->arch.shadow_table) >> PAGE_SHIFT); ed->arch.shadow_table = mk_pagetable(smfn << PAGE_SHIFT); @@ -1945,7 +1943,8 @@ { if ( unlikely(!(hl2mfn = __shadow_status(d, gpfn, PGT_hl2_shadow))) ) hl2mfn = shadow_hl2_table(d, gpfn, gmfn, smfn); - get_shadow_ref(hl2mfn); + if ( !get_shadow_ref(hl2mfn) ) + BUG(); if ( ed->arch.hl2_vtable ) unmap_domain_mem(ed->arch.hl2_vtable); diff -Nru a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h --- a/xen/include/asm-x86/shadow.h 2005-04-05 12:09:06 -04:00 +++ b/xen/include/asm-x86/shadow.h 2005-04-05 12:09:06 -04:00 @@ -396,7 +396,8 @@ ASSERT( !(frame_table[smfn].u.inuse.type_info & PGT_pinned) ); frame_table[smfn].u.inuse.type_info |= PGT_pinned; - get_shadow_ref(smfn); + if ( !get_shadow_ref(smfn) ) + BUG(); } static inline void @@ -464,7 +465,7 @@ /************************************************************************/ -extern void shadow_mark_out_of_sync( +extern void shadow_mark_va_out_of_sync( struct exec_domain *ed, unsigned long gpfn, unsigned long mfn, unsigned long va); @@ -497,7 +498,7 @@ __mark_dirty(d, mfn); if ( mfn_is_page_table(mfn) ) - shadow_mark_out_of_sync(ed, gpfn, mfn, va); + shadow_mark_va_out_of_sync(ed, gpfn, mfn, va); *gpte_p = gpte; *spte_p = spte; @@ -1144,7 +1145,7 @@ if ( sl1mfn ) { perfc_incrc(shadow_set_l1e_unlinked); - if (!get_shadow_ref(sl1mfn)) + if ( !get_shadow_ref(sl1mfn) ) BUG(); l2pde_general(d, &gpde, &sl2e, sl1mfn); __guest_set_l2e(ed, va, gpde); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |