* mm.c: function virt_to_xen_l2e
@ 2006-07-20 15:45 PUCCETTI Armand
0 siblings, 0 replies; only message in thread
From: PUCCETTI Armand @ 2006-07-20 15:45 UTC (permalink / raw)
To: xen-devel
I am trying to understand the function virt_to_xen_l2e.
The actual code in xen V3.0.1 begins with:
l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
{
l4_pgentry_t *pl4e;
l3_pgentry_t *pl3e;
l2_pgentry_t *pl2e;
pl4e = &idle_pg_table[l4_table_offset(v)];
if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
{
pl3e = page_to_virt(alloc_xen_pagetable());
clear_page(pl3e);
*pl4e = l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR);
}
pl3e = l4e_to_l3e(*pl4e) + l3_table_offset(v);
...
What puzzles me is pl3e. If I decompose the first expression
of the rhs of the last statement above, introducing some temporary vars,
I get:
intpte_t a, b;
physaddr_t c;
a=(*pl4e).l4;
b = (a & (PADDR_MASK & PAGE_MASK));
c = ((physaddr_t) b);
pl3e= ((l3_pgentry_t *)__va(c)) + ...; // same line as original
pl3e is apparently made by some arithmetic transformations and then a
cast to a pointer.
How do we know if the final address pl3e is defined, and the address it
refers to is correct??
Same question about pl2e, as similar transformations are made to
calculate it some lines
later.
thanks for any insight.
Armand
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-07-20 15:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-20 15:45 mm.c: function virt_to_xen_l2e PUCCETTI Armand
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.