ia64/xen-unstable

changeset 5278:7a15cc6f1147

bitkeeper revision 1.1643 (429f4488tj590Fmn5s5Gd_pv8fLXeg)

The merge of PAE support introduced the intpte_t type and PRIpte format
specifier. Most of the shadow mode code was fixed, but debugging
printks were not; this broke the compile if shadow mode debugging was
enabled.

The attached patch should fix the problem. Not tested with PAE enabled,
but it shouldn't make anything worse than it already is.

Signed-off-by: Michael Vrable <mvrable@cs.ucsd.edu>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 02 17:40:24 2005 +0000 (2005-06-02)
parents 984dc9d51248
children ac04979dce3a
files xen/arch/x86/shadow.c xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Thu Jun 02 17:36:41 2005 +0000
     1.2 +++ b/xen/arch/x86/shadow.c	Thu Jun 02 17:40:24 2005 +0000
     1.3 @@ -1222,8 +1222,8 @@ static int shadow_mode_table_op(
     1.4      ASSERT(shadow_lock_is_acquired(d));
     1.5  
     1.6      SH_VLOG("shadow mode table op %lx %lx count %d",
     1.7 -            pagetable_val(d->exec_domain[0]->arch.guest_table),  /* XXX SMP */
     1.8 -            pagetable_val(d->exec_domain[0]->arch.shadow_table), /* XXX SMP */
     1.9 +            (unsigned long)pagetable_get_pfn(d->exec_domain[0]->arch.guest_table),  /* XXX SMP */
    1.10 +            (unsigned long)pagetable_get_pfn(d->exec_domain[0]->arch.shadow_table), /* XXX SMP */
    1.11              d->arch.shadow_page_count);
    1.12  
    1.13      shadow_audit(d, 1);
    1.14 @@ -2594,7 +2594,7 @@ int shadow_fault(unsigned long va, struc
    1.15      orig_gpte = gpte = linear_pg_table[l1_linear_offset(va)];
    1.16      if ( unlikely(!(l1e_get_flags(gpte) & _PAGE_PRESENT)) )
    1.17      {
    1.18 -        SH_VVLOG("shadow_fault - EXIT: gpte not present (%lx)",
    1.19 +        SH_VVLOG("shadow_fault - EXIT: gpte not present (%" PRIpte ")",
    1.20                   l1e_get_intpte(gpte));
    1.21          perfc_incrc(shadow_fault_bail_pte_not_present);
    1.22          goto fail;
    1.23 @@ -2615,7 +2615,7 @@ int shadow_fault(unsigned long va, struc
    1.24              else
    1.25              {
    1.26                  /* Write fault on a read-only mapping. */
    1.27 -                SH_VVLOG("shadow_fault - EXIT: wr fault on RO page (%lx)", 
    1.28 +                SH_VVLOG("shadow_fault - EXIT: wr fault on RO page (%" PRIpte ")", 
    1.29                           l1e_get_intpte(gpte));
    1.30                  perfc_incrc(shadow_fault_bail_ro_mapping);
    1.31                  goto fail;
    1.32 @@ -2692,7 +2692,7 @@ void shadow_l1_normal_pt_update(
    1.33      sl1mfn = __shadow_status(current->domain, pa >> PAGE_SHIFT, PGT_l1_shadow);
    1.34      if ( sl1mfn )
    1.35      {
    1.36 -        SH_VVLOG("shadow_l1_normal_pt_update pa=%p, gpte=%08lx",
    1.37 +        SH_VVLOG("shadow_l1_normal_pt_update pa=%p, gpte=%" PRIpte,
    1.38                   (void *)pa, l1e_get_intpte(gpte));
    1.39          l1pte_propagate_from_guest(current->domain, gpte, &spte);
    1.40  
    1.41 @@ -2717,7 +2717,7 @@ void shadow_l2_normal_pt_update(
    1.42      sl2mfn = __shadow_status(current->domain, pa >> PAGE_SHIFT, PGT_l2_shadow);
    1.43      if ( sl2mfn )
    1.44      {
    1.45 -        SH_VVLOG("shadow_l2_normal_pt_update pa=%p, gpde=%08lx",
    1.46 +        SH_VVLOG("shadow_l2_normal_pt_update pa=%p, gpde=%" PRIpte,
    1.47                   (void *)pa, l2e_get_intpte(gpde));
    1.48          spl2e = map_domain_mem_with_cache(sl2mfn << PAGE_SHIFT, cache);
    1.49          validate_pde_change(d, gpde,
    1.50 @@ -2946,7 +2946,7 @@ mark_shadows_as_reflecting_snapshot(stru
    1.51      {
    1.52          l2e = map_domain_mem(smfn << PAGE_SHIFT);
    1.53          for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
    1.54 -            if ( is_guest_l2_slot(i) &&
    1.55 +            if ( is_guest_l2_slot(0, i) &&
    1.56                   (l2e_get_flags(l2e[i]) & _PAGE_PRESENT) )
    1.57                  l2e_add_flags(l2e[i], SHADOW_REFLECTS_SNAPSHOT);
    1.58          unmap_domain_mem(l2e);
    1.59 @@ -2978,9 +2978,10 @@ int shadow_status_noswap;
    1.60          printk("XXX %s-FAIL (%d,%d,%d) " _f " at %s(%d)\n",                  \
    1.61                 sh_check_name, level, l2_idx, l1_idx, ## _a,                  \
    1.62                 __FILE__, __LINE__);                                          \
    1.63 -        printk("guest_pte=%lx eff_guest_pte=%lx shadow_pte=%lx "             \
    1.64 -               "snapshot_pte=%lx &guest=%p &shadow=%p &snap=%p "             \
    1.65 -               "v2m(&guest)=%p v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n",     \
    1.66 +        printk("guest_pte=%" PRIpte " eff_guest_pte=%" PRIpte                \
    1.67 +               " shadow_pte=%" PRIpte " snapshot_pte=%" PRIpte               \
    1.68 +               " &guest=%p &shadow=%p &snap=%p v2m(&guest)=%p"               \
    1.69 +               " v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n",                   \
    1.70                 l1e_get_intpte(guest_pte), l1e_get_intpte(eff_guest_pte),     \
    1.71                 l1e_get_intpte(shadow_pte), l1e_get_intpte(snapshot_pte),     \
    1.72                 p_guest_pte, p_shadow_pte, p_snapshot_pte,                    \
    1.73 @@ -3048,8 +3049,8 @@ static int check_pte(
    1.74      shadow_mfn = l1e_get_pfn(shadow_pte);
    1.75  
    1.76      if ( !VALID_MFN(eff_guest_mfn) && !shadow_mode_refcounts(d) )
    1.77 -        FAIL("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%lx\n", __func__, eff_guest_pfn,
    1.78 -             l1e_get_intpte(eff_guest_pte));
    1.79 +        FAIL("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%" PRIpte "\n",
    1.80 +             __func__, eff_guest_pfn, l1e_get_intpte(eff_guest_pte));
    1.81  
    1.82      page_table_page = mfn_is_page_table(eff_guest_mfn);
    1.83  
    1.84 @@ -3184,7 +3185,7 @@ int check_l2_table(
    1.85           l2e_has_changed(spl2e[SH_LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT],
    1.86                           match, PAGE_FLAG_MASK))
    1.87      {
    1.88 -        FAILPT("hypervisor shadow linear map inconsistent %lx %lx",
    1.89 +        FAILPT("hypervisor shadow linear map inconsistent %" PRIpte " %" PRIpte,
    1.90                 l2e_get_intpte(spl2e[SH_LINEAR_PT_VIRT_START >>
    1.91                                     L2_PAGETABLE_SHIFT]),
    1.92                 l2e_get_intpte(match));
    1.93 @@ -3195,7 +3196,7 @@ int check_l2_table(
    1.94           l2e_has_changed(spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT],
    1.95                           match, PAGE_FLAG_MASK))
    1.96      {
    1.97 -        FAILPT("hypervisor per-domain map inconsistent saw %lx, expected (va=%p) %lx",
    1.98 +        FAILPT("hypervisor per-domain map inconsistent saw %" PRIpte ", expected (va=%p) %" PRIpte,
    1.99                 l2e_get_intpte(spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT]),
   1.100                 d->arch.mm_perdomain_pt,
   1.101                 l2e_get_intpte(match));
   1.102 @@ -3234,7 +3235,7 @@ int _check_pagetable(struct exec_domain 
   1.103  {
   1.104      struct domain *d = ed->domain;
   1.105      pagetable_t pt = ed->arch.guest_table;
   1.106 -    unsigned long gptbase = pagetable_val(pt);
   1.107 +    unsigned long gptbase = pagetable_get_paddr(pt);
   1.108      unsigned long ptbase_pfn, smfn;
   1.109      unsigned long i;
   1.110      l2_pgentry_t *gpl2e, *spl2e;
     2.1 --- a/xen/include/asm-x86/shadow.h	Thu Jun 02 17:36:41 2005 +0000
     2.2 +++ b/xen/include/asm-x86/shadow.h	Thu Jun 02 17:40:24 2005 +0000
     2.3 @@ -397,7 +397,7 @@ shadow_get_page_from_l1e(l1_pgentry_t l1
     2.4      if ( unlikely(!res) )
     2.5      {
     2.6          perfc_incrc(shadow_get_page_fail);
     2.7 -        FSH_LOG("%s failed to get ref l1e=%lx\n",
     2.8 +        FSH_LOG("%s failed to get ref l1e=%" PRIpte "\n",
     2.9                  __func__, l1e_get_intpte(l1e));
    2.10      }
    2.11  
    2.12 @@ -738,7 +738,7 @@ static inline int l1pte_write_fault(
    2.13      l1e_add_flags(gpte, _PAGE_DIRTY | _PAGE_ACCESSED);
    2.14      spte = l1e_from_pfn(gmfn, l1e_get_flags(gpte) & ~_PAGE_GLOBAL);
    2.15  
    2.16 -    SH_VVLOG("l1pte_write_fault: updating spte=0x%lx gpte=0x%lx",
    2.17 +    SH_VVLOG("l1pte_write_fault: updating spte=0x%" PRIpte " gpte=0x%" PRIpte,
    2.18               l1e_get_intpte(spte), l1e_get_intpte(gpte));
    2.19  
    2.20      if ( shadow_mode_log_dirty(d) )
    2.21 @@ -777,7 +777,7 @@ static inline int l1pte_read_fault(
    2.22          l1e_remove_flags(spte, _PAGE_RW);
    2.23      }
    2.24  
    2.25 -    SH_VVLOG("l1pte_read_fault: updating spte=0x%lx gpte=0x%lx",
    2.26 +    SH_VVLOG("l1pte_read_fault: updating spte=0x%" PRIpte " gpte=0x%" PRIpte,
    2.27               l1e_get_intpte(spte), l1e_get_intpte(gpte));
    2.28      *gpte_p = gpte;
    2.29      *spte_p = spte;
    2.30 @@ -809,7 +809,7 @@ static inline void l1pte_propagate_from_
    2.31      }
    2.32  
    2.33      if ( l1e_get_intpte(spte) || l1e_get_intpte(gpte) )
    2.34 -        SH_VVVLOG("%s: gpte=%lx, new spte=%lx",
    2.35 +        SH_VVVLOG("%s: gpte=%" PRIpte ", new spte=%" PRIpte,
    2.36                    __func__, l1e_get_intpte(gpte), l1e_get_intpte(spte));
    2.37  
    2.38      *spte_p = spte;
    2.39 @@ -843,7 +843,7 @@ static inline void hl2e_propagate_from_g
    2.40      }
    2.41  
    2.42      if ( l1e_get_intpte(hl2e) || l2e_get_intpte(gpde) )
    2.43 -        SH_VVLOG("%s: gpde=%lx hl2e=%lx", __func__,
    2.44 +        SH_VVLOG("%s: gpde=%" PRIpte " hl2e=%" PRIpte, __func__,
    2.45                   l2e_get_intpte(gpde), l1e_get_intpte(hl2e));
    2.46  
    2.47      *hl2e_p = hl2e;
    2.48 @@ -872,7 +872,7 @@ static inline void l2pde_general(
    2.49      }
    2.50  
    2.51      if ( l2e_get_intpte(spde) || l2e_get_intpte(gpde) )
    2.52 -        SH_VVLOG("%s: gpde=%lx, new spde=%lx", __func__,
    2.53 +        SH_VVLOG("%s: gpde=%" PRIpte ", new spde=%" PRIpte, __func__,
    2.54                   l2e_get_intpte(gpde), l2e_get_intpte(spde));
    2.55  
    2.56      *spde_p = spde;