From: PUCCETTI Armand <armand.puccetti@cea.fr>
To: xen-devel@lists.xensource.com
Subject: mm.c: function virt_to_xen_l2e
Date: Thu, 20 Jul 2006 17:45:14 +0200 [thread overview]
Message-ID: <44BFA50A.1090703@cea.fr> (raw)
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
reply other threads:[~2006-07-20 15:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44BFA50A.1090703@cea.fr \
--to=armand.puccetti@cea.fr \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.