r_mfn = get_gfn_query(d, gfn, &pt);
if ( p2m_to_mask(pt) & P2M_UNMAP_TYPES)
{
- ASSERT(mfn_x(r_mfn) == mfn_x(mfn));
+ ASSERT(mfn_eq(r_mfn, mfn));
rc = p2m_change_type_one(d, gfn, pt, p2m_ram_broken);
}
put_gfn(d, gfn);
ASSERT(idx < dcache->entries);
hashent->refcnt++;
ASSERT(hashent->refcnt);
- ASSERT(l1e_get_pfn(MAPCACHE_L1ENT(idx)) == mfn_x(mfn));
+ ASSERT(mfn_eq(l1e_get_mfn(MAPCACHE_L1ENT(idx)), mfn));
goto out;
}
* unless the only change is an increase in access rights. */
mfn_t omfn = l1e_get_mfn(*p);
mfn_t nmfn = l1e_get_mfn(new);
- flush_nestedp2m = !( mfn_x(omfn) == mfn_x(nmfn)
+
+ flush_nestedp2m = !(mfn_eq(omfn, nmfn)
&& perms_strictly_increased(old_flags, l1e_get_flags(new)) );
}
continue;
}
o_mfn = get_gfn_query_unlocked(d, g->gfn, &t);
- if ( mfn_x(o_mfn) != mfn_x(mfn) )
+ if ( !mfn_eq(o_mfn, mfn) )
{
MEM_SHARING_DEBUG("Incorrect P2M for d=%hu, PFN=%lx."
"Expecting MFN=%lx, got %lx\n",
/* This tricky business is to avoid two callers deadlocking if
* grabbing pages in opposite client/source order */
- if( mfn_x(smfn) == mfn_x(cmfn) )
+ if ( mfn_eq(smfn, cmfn) )
{
/* The pages are already the same. We could return some
* kind of error here, but no matter how you look at it,
{
struct domain * od;
- p = mfn_to_page(_mfn(mfn_x(mfn) + i));
+ p = mfn_to_page(mfn_add(mfn, i));
od = page_get_owner(p);
if ( od != d )
{
for ( i = 0; i < (1UL << order); ++i )
{
- ASSERT(mfn_valid(_mfn(mfn_x(omfn) + i)));
+ ASSERT(mfn_valid(mfn_add(omfn, i)));
set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
}
}
"gfn_to_mfn failed! gfn=%08lx type:%d\n", gfn_l, t);
goto out;
}
- if ( mfn_x(mfn) != mfn_x(actual_mfn) )
+ if ( !mfn_eq(mfn, actual_mfn) )
gdprintk(XENLOG_WARNING,
"no mapping between mfn %08lx and gfn %08lx\n",
mfn_x(mfn), gfn_l);
{
oos = v->arch.paging.shadow.oos;
idx = mfn_x(gmfn) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) != mfn_x(gmfn) )
+ if ( !mfn_eq(oos[idx], gmfn) )
idx = (idx + 1) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) == mfn_x(gmfn) )
+ if ( mfn_eq(oos[idx], gmfn) )
return;
}
oos = v->arch.paging.shadow.oos;
oos_fixup = v->arch.paging.shadow.oos_fixup;
idx = mfn_x(gmfn) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) != mfn_x(gmfn) )
+ if ( !mfn_eq(oos[idx], gmfn) )
idx = (idx + 1) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) == mfn_x(gmfn) )
+ if ( mfn_eq(oos[idx], gmfn) )
{
int i;
for ( i = 0; i < SHADOW_OOS_FIXUPS; i++ )
{
if ( mfn_valid(oos_fixup[idx].smfn[i])
- && (mfn_x(oos_fixup[idx].smfn[i]) == mfn_x(smfn))
+ && mfn_eq(oos_fixup[idx].smfn[i], smfn)
&& (oos_fixup[idx].off[i] == off) )
return;
}
{
oos = v->arch.paging.shadow.oos;
idx = mfn_x(gmfn) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) != mfn_x(gmfn) )
+ if ( !mfn_eq(oos[idx], gmfn) )
idx = (idx + 1) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) == mfn_x(gmfn) )
+ if ( mfn_eq(oos[idx], gmfn) )
{
oos[idx] = INVALID_MFN;
return;
oos = v->arch.paging.shadow.oos;
oos_snapshot = v->arch.paging.shadow.oos_snapshot;
idx = mfn_x(gmfn) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) != mfn_x(gmfn) )
+ if ( !mfn_eq(oos[idx], gmfn) )
idx = (idx + 1) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) == mfn_x(gmfn) )
+ if ( mfn_eq(oos[idx], gmfn) )
{
return oos_snapshot[idx];
}
oos_fixup = v->arch.paging.shadow.oos_fixup;
oos_snapshot = v->arch.paging.shadow.oos_snapshot;
idx = mfn_x(gmfn) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) != mfn_x(gmfn) )
+ if ( !mfn_eq(oos[idx], gmfn) )
idx = (idx + 1) % SHADOW_OOS_PAGES;
- if ( mfn_x(oos[idx]) == mfn_x(gmfn) )
+ if ( mfn_eq(oos[idx], gmfn) )
{
_sh_resync(v, gmfn, &oos_fixup[idx], oos_snapshot[idx]);
oos[idx] = INVALID_MFN;
{
struct page_info *sp = mfn_to_page(smfn);
mfn_t pmfn;
- void *vaddr;
+ l1_pgentry_t *vaddr;
int rc;
ASSERT(sp->u.sh.type > 0);
if (sp->up == 0) return 0;
pmfn = maddr_to_mfn(sp->up);
ASSERT(mfn_valid(pmfn));
- vaddr = map_domain_page(pmfn);
- ASSERT(vaddr);
- vaddr += sp->up & (PAGE_SIZE-1);
- ASSERT(l1e_get_pfn(*(l1_pgentry_t *)vaddr) == mfn_x(smfn));
+ vaddr = map_domain_page(pmfn) + (sp->up & (PAGE_SIZE - 1));
+ ASSERT(mfn_eq(l1e_get_mfn(*vaddr), smfn));
/* Is this the only reference to this shadow? */
rc = (sp->u.sh.count == 1) ? 1 : 0;
{
if ( !npte
|| !p2m_is_ram(p2m_flags_to_type(l1e_get_flags(npte[i])))
- || l1e_get_pfn(npte[i]) != mfn_x(omfn) )
+ || !mfn_eq(l1e_get_mfn(npte[i]), omfn) )
{
/* This GFN->MFN mapping has gone away */
sh_remove_all_shadows_and_parents(d, omfn);
_gfn(gfn + (i << PAGE_SHIFT))) )
cpumask_or(&flushmask, &flushmask, d->dirty_cpumask);
}
- omfn = _mfn(mfn_x(omfn) + 1);
+ omfn = mfn_add(omfn, 1);
}
flush_tlb_mask(&flushmask);
{
/* We lost a reference to an old mfn. */
mfn_t osl3mfn = shadow_l4e_get_mfn(old_sl4e);
- if ( (mfn_x(osl3mfn) != mfn_x(shadow_l4e_get_mfn(new_sl4e)))
+
+ if ( !mfn_eq(osl3mfn, shadow_l4e_get_mfn(new_sl4e))
|| !perms_strictly_increased(shadow_l4e_get_flags(old_sl4e),
shadow_l4e_get_flags(new_sl4e)) )
{
{
/* We lost a reference to an old mfn. */
mfn_t osl2mfn = shadow_l3e_get_mfn(old_sl3e);
- if ( (mfn_x(osl2mfn) != mfn_x(shadow_l3e_get_mfn(new_sl3e))) ||
+
+ if ( !mfn_eq(osl2mfn, shadow_l3e_get_mfn(new_sl3e)) ||
!perms_strictly_increased(shadow_l3e_get_flags(old_sl3e),
shadow_l3e_get_flags(new_sl3e)) )
{
{
/* We lost a reference to an old mfn. */
mfn_t osl1mfn = shadow_l2e_get_mfn(old_sl2e);
- if ( (mfn_x(osl1mfn) != mfn_x(shadow_l2e_get_mfn(new_sl2e))) ||
+
+ if ( !mfn_eq(osl1mfn, shadow_l2e_get_mfn(new_sl2e)) ||
!perms_strictly_increased(shadow_l2e_get_flags(old_sl2e),
shadow_l2e_get_flags(new_sl2e)) )
{
smfn2 = smfn;
guest_idx = guest_index(new_gp);
shadow_idx = shadow_index(&smfn2, guest_idx);
- if ( mfn_x(smfn2) != mfn_x(map_mfn) )
+ if ( !mfn_eq(smfn2, map_mfn) )
{
/* We have moved to another page of the shadow */
map_mfn = smfn2;
sl1e = *sl1p;
if ( ((shadow_l1e_get_flags(sl1e) & (_PAGE_PRESENT|_PAGE_RW))
!= (_PAGE_PRESENT|_PAGE_RW))
- || (mfn_x(shadow_l1e_get_mfn(sl1e)) != mfn_x(gmfn)) )
+ || !mfn_eq(shadow_l1e_get_mfn(sl1e), gmfn) )
{
unmap_domain_page(sl1p);
goto fail;
sl1e = *sl1p;
if ( ((shadow_l1e_get_flags(sl1e) & (_PAGE_PRESENT|_PAGE_RW))
!= (_PAGE_PRESENT|_PAGE_RW))
- || (mfn_x(shadow_l1e_get_mfn(sl1e)) != mfn_x(gmfn)) )
+ || !mfn_eq(shadow_l1e_get_mfn(sl1e), gmfn) )
return 0;
/* Found it! Need to remove its write permissions. */
gfn = guest_l1e_get_gfn(*gl1e);
mfn = shadow_l1e_get_mfn(*sl1e);
gmfn = get_gfn_query_unlocked(v->domain, gfn_x(gfn), &p2mt);
- if ( !p2m_is_grant(p2mt) && mfn_x(gmfn) != mfn_x(mfn) )
+ if ( !p2m_is_grant(p2mt) && !mfn_eq(gmfn, mfn) )
AUDIT_FAIL(1, "bad translation: gfn %" SH_PRI_gfn
" --> %" PRI_mfn " != mfn %" PRI_mfn,
gfn_x(gfn), mfn_x(gmfn), mfn_x(mfn));
: get_shadow_status(d,
get_gfn_query_unlocked(d, gfn_x(gfn),
&p2mt), SH_type_l1_shadow);
- if ( mfn_x(gmfn) != mfn_x(mfn) )
+ if ( !mfn_eq(gmfn, mfn) )
AUDIT_FAIL(2, "bad translation: gfn %" SH_PRI_gfn
" (--> %" PRI_mfn ")"
" --> %" PRI_mfn " != mfn %" PRI_mfn,
&& (guest_index(gl3e) % 4) == 3)
? SH_type_l2h_shadow
: SH_type_l2_shadow);
- if ( mfn_x(gmfn) != mfn_x(mfn) )
+ if ( !mfn_eq(gmfn, mfn) )
AUDIT_FAIL(3, "bad translation: gfn %" SH_PRI_gfn
" --> %" PRI_mfn " != mfn %" PRI_mfn,
gfn_x(gfn), mfn_x(gmfn), mfn_x(mfn));
gmfn = get_shadow_status(d, get_gfn_query_unlocked(
d, gfn_x(gfn), &p2mt),
SH_type_l3_shadow);
- if ( mfn_x(gmfn) != mfn_x(mfn) )
+ if ( !mfn_eq(gmfn, mfn) )
AUDIT_FAIL(4, "bad translation: gfn %" SH_PRI_gfn
" --> %" PRI_mfn " != mfn %" PRI_mfn,
gfn_x(gfn), mfn_x(gmfn), mfn_x(mfn));