get_two_gfns(current->domain, sgpa >> PAGE_SHIFT, &sp2mt, NULL, NULL,
current->domain, dgpa >> PAGE_SHIFT, &dp2mt, NULL, NULL,
- p2m_guest, &tg);
+ p2m_alloc, &tg);
if ( !p2m_is_ram(sp2mt) && !p2m_is_grant(sp2mt) )
{
}
p2m = p2m_get_hostp2m(v->domain);
- mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
+ mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma,
+ access_w ? p2m_unshare : p2m_alloc, NULL);
/* Check access permissions first, then handle faults */
if ( mfn_x(mfn) != INVALID_MFN )
if ( p2m == NULL )
p2m = p2m_get_p2m(v);
/* Everything else is an error. */
- mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
+ mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, p2m_query, NULL);
__put_gfn(p2m, gfn);
gdprintk(XENLOG_ERR,
"SVM violation gpa %#"PRIpaddr", mfn %#lx, type %i\n",
}
/* Keep track of the highest gfn demand-populated by a guest fault */
- if ( q == p2m_guest && gfn > p2m->pod.max_guest )
+ if ( gfn > p2m->pod.max_guest )
p2m->pod.max_guest = gfn;
if ( p2m->pod.count == 0 )
{
/* Return invalid_mfn to avoid caller's access */
mfn = _mfn(INVALID_MFN);
- if (q == p2m_guest)
+ if (q != p2m_query)
domain_crash(p2m->domain);
}
#endif
/* What mfn is the guest trying to access? */
gfn = guest_l1e_get_gfn(gw.l1e);
- gmfn = get_gfn_guest(d, gfn, &p2mt);
+ gmfn = get_gfn(d, gfn, &p2mt);
if ( shadow_mode_refcounts(d) &&
((!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt)) ||
/* Translate the GFN to an MFN */
ASSERT(!paging_locked_by_me(v->domain));
- mfn = get_gfn_guest(v->domain, _gfn(gfn), &p2mt);
+ mfn = get_gfn(v->domain, _gfn(gfn), &p2mt);
if ( p2m_is_readonly(p2mt) )
{
/* Override get_gfn to work with gfn_t */
#undef get_gfn_query
#define get_gfn_query(d, g, t) get_gfn_type((d), gfn_x(g), (t), p2m_query)
-#undef get_gfn_guest
-#define get_gfn_guest(d, g, t) get_gfn_type((d), gfn_x(g), (t), p2m_guest)
/* The shadow types needed for the various levels. */
/* NOTE: Assumed to be only 4 bits right now */
} p2m_access_t;
+/* Modifiers to the query */
typedef enum {
p2m_query, /* Do not populate a PoD entries */
p2m_alloc, /* Automatically populate PoD entries */
p2m_unshare, /* Break c-o-w sharing; implies alloc */
- p2m_guest, /* Guest demand-fault; implies alloc */
} p2m_query_t;
/* We use bitmaps and maks to handle groups of types */
* lock held. */
#define get_gfn(d, g, t) get_gfn_type((d), (g), (t), p2m_alloc)
#define get_gfn_query(d, g, t) get_gfn_type((d), (g), (t), p2m_query)
-#define get_gfn_guest(d, g, t) get_gfn_type((d), (g), (t), p2m_guest)
#define get_gfn_unshare(d, g, t) get_gfn_type((d), (g), (t), p2m_unshare)
/* Compatibility function exporting the old untyped interface */