ia64/xen-unstable

changeset 1890:bf53c6ec6e23

bitkeeper revision 1.1126 (410100a68KPFUkPJfnet0PNb6TESrg)

cleanup and simplify
author cl349@freefall.cl.cam.ac.uk
date Fri Jul 23 12:12:22 2004 +0000 (2004-07-23)
parents 07a02b25fad4
children f775b5d07cde
files xen/arch/x86/memory.c
line diff
     1.1 --- a/xen/arch/x86/memory.c	Fri Jul 23 11:16:35 2004 +0000
     1.2 +++ b/xen/arch/x86/memory.c	Fri Jul 23 12:12:22 2004 +0000
     1.3 @@ -1288,20 +1288,20 @@ void ptwr_reconnect_disconnected(unsigne
     1.4                           _PAGE_PRESENT);
     1.5      pl1e = map_domain_mem(l2_pgentry_to_pagenr(nl2e) << PAGE_SHIFT);
     1.6      for ( i = 0; i < ENTRIES_PER_L1_PAGETABLE; i++ ) {
     1.7 -        if (likely(l1_pgentry_val(pl1e[i]) ==
     1.8 -                   l1_pgentry_val(ptwr_disconnected_page[cpu][i])))
     1.9 +        l1_pgentry_t ol1e, nl1e;
    1.10 +        ol1e = ptwr_disconnected_page[cpu][i];
    1.11 +        nl1e = pl1e[i];
    1.12 +        if (likely(l1_pgentry_val(nl1e) == l1_pgentry_val(ol1e)))
    1.13              continue;
    1.14 -        if (likely((l1_pgentry_val(pl1e[i]) ^
    1.15 -                    l1_pgentry_val(ptwr_disconnected_page[cpu][i])) ==
    1.16 +        if (likely((l1_pgentry_val(nl1e) ^ l1_pgentry_val(ol1e)) ==
    1.17                     _PAGE_RW)) {
    1.18  #if 0
    1.19 -            struct pfn_info *page = &frame_table[l1_pgentry_to_pagenr(pl1e[i])];
    1.20 +            struct pfn_info *page = &frame_table[l1_pgentry_to_pagenr(nl1e)];
    1.21              printk("%03x: %08lx != %08lx %08x/%08x\n", i,
    1.22 -                   l1_pgentry_val(ptwr_disconnected_page[cpu][i]),
    1.23 -                   l1_pgentry_val(pl1e[i]), page->type_and_flags,
    1.24 -                   page->count_and_flags);
    1.25 +                   l1_pgentry_val(ol1e), l1_pgentry_val(nl1e),
    1.26 +                   page->type_and_flags, page->count_and_flags);
    1.27  #endif
    1.28 -            if (likely(readonly_page_from_l1e(pl1e[i])))
    1.29 +            if (likely(readonly_page_from_l1e(nl1e)))
    1.30                  continue;
    1.31          }
    1.32  #if 0
    1.33 @@ -1309,10 +1309,9 @@ void ptwr_reconnect_disconnected(unsigne
    1.34                 l1_pgentry_val(ptwr_disconnected_page[cpu][i]),
    1.35                 l1_pgentry_val(pl1e[i]));
    1.36  #endif
    1.37 -        if (unlikely(l1_pgentry_val(ptwr_disconnected_page[cpu][i]) &
    1.38 -                     _PAGE_PRESENT))
    1.39 -            put_page_from_l1e(ptwr_disconnected_page[cpu][i]);
    1.40 -        if (unlikely(!get_page_from_l1e(pl1e[i])))
    1.41 +        if (unlikely(l1_pgentry_val(ol1e) & _PAGE_PRESENT))
    1.42 +            put_page_from_l1e(ol1e);
    1.43 +        if (unlikely(!get_page_from_l1e(nl1e)))
    1.44              BUG();
    1.45      }
    1.46      unmap_domain_mem(pl1e);
    1.47 @@ -1368,32 +1367,30 @@ void ptwr_flush_inactive(void)
    1.48  
    1.49          pl1e = map_domain_mem(pfn << PAGE_SHIFT);
    1.50          for ( i = 0; i < ENTRIES_PER_L1_PAGETABLE; i++ ) {
    1.51 -            if (likely(l1_pgentry_val(pl1e[i]) ==
    1.52 -                       l1_pgentry_val(ptwr_writable_page[cpu][idx][i])))
    1.53 +            l1_pgentry_t ol1e, nl1e;
    1.54 +            ol1e = ptwr_writable_page[cpu][idx][i];
    1.55 +            nl1e = pl1e[i];
    1.56 +            if (likely(l1_pgentry_val(ol1e) == l1_pgentry_val(nl1e)))
    1.57                  continue;
    1.58  #if 0
    1.59 -            if ((l1_pgentry_val(pl1e[i]) ^
    1.60 -                 l1_pgentry_val(ptwr_writable_page[cpu][idx][i])) == _PAGE_RW) {
    1.61 +            if ((l1_pgentry_val(ol1e) ^ l1_pgentry_val(nl1e)) == _PAGE_RW) {
    1.62  #if 01
    1.63 -                struct pfn_info *page = &frame_table[l1_pgentry_to_pagenr(pl1e[i])];
    1.64 +                struct pfn_info *page = &frame_table[l1_pgentry_to_pagenr(nl1e)];
    1.65                  printk("%03x: %08lx != %08lx %08x/%08x\n", i,
    1.66 -                       l1_pgentry_val(ptwr_writable_page[cpu][idx][i]),
    1.67 -                       l1_pgentry_val(pl1e[i]), page->type_and_flags,
    1.68 -                       page->count_and_flags);
    1.69 +                       l1_pgentry_val(ol1e), l1_pgentry_val(nl1e),
    1.70 +                       page->type_and_flags, page->count_and_flags);
    1.71  #endif
    1.72 -                if (readonly_page_from_l1e(pl1e[i]))
    1.73 +                if (readonly_page_from_l1e(nl1e))
    1.74                      continue;
    1.75              }
    1.76  #endif
    1.77  #if 0
    1.78              printk("%03x: %08lx != %08lx\n", i,
    1.79 -                   l1_pgentry_val(ptwr_writable_page[cpu][idx][i]),
    1.80 -                   l1_pgentry_val(pl1e[i]));
    1.81 +                   l1_pgentry_val(ol1e), l1_pgentry_val(nl1e));
    1.82  #endif
    1.83 -            if (unlikely(l1_pgentry_val(ptwr_writable_page[cpu][idx][i]) &
    1.84 -                         _PAGE_PRESENT))
    1.85 -                put_page_from_l1e(ptwr_writable_page[cpu][idx][i]);
    1.86 -            if (unlikely(!get_page_from_l1e(pl1e[i])))
    1.87 +            if (unlikely(l1_pgentry_val(ol1e) & _PAGE_PRESENT))
    1.88 +                put_page_from_l1e(ol1e);
    1.89 +            if (unlikely(!get_page_from_l1e(nl1e)))
    1.90                  BUG();
    1.91          }
    1.92          unmap_domain_mem(pl1e);