aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/xencomm.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-08-29 15:01:57 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-08-29 15:01:57 +0100
commit34d8b9725070a4fa2ba602995dc01db17cf0af3f (patch)
treed977f3c8b742b5fd5b8b3b2b2e48171fec6193d6 /xen/common/xencomm.c
parentfa505361f6a80ae310701fd42adadf768216dbfb (diff)
downloadxen-34d8b9725070a4fa2ba602995dc01db17cf0af3f.tar.gz
xen-34d8b9725070a4fa2ba602995dc01db17cf0af3f.tar.bz2
xen-34d8b9725070a4fa2ba602995dc01db17cf0af3f.zip
Improve commenting of xencomm_ctxt_next().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Diffstat (limited to 'xen/common/xencomm.c')
-rw-r--r--xen/common/xencomm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/xen/common/xencomm.c b/xen/common/xencomm.c
index 7debf40995..fc86cd0830 100644
--- a/xen/common/xencomm.c
+++ b/xen/common/xencomm.c
@@ -138,6 +138,22 @@ xencomm_ctxt_init(const void *handle, struct xencomm_ctxt *ctxt)
return 0;
}
+/*
+ * Calculate the vaddr of &ctxt->desc_in_paddr->address[i] and get_page().
+ * And put the results in ctxt->page and ctxt->address.
+ * If there is the previous page, put_page().
+ *
+ * A guest domain passes the array, ctxt->desc_in_paddr->address[].
+ * It is gpaddr-contiguous, but not maddr-contiguous so that
+ * we can't obtain the vaddr by simple offsetting.
+ * We need to convert gpaddr, &ctxt->desc_in_paddr->address[i],
+ * into maddr and then convert it to the xen virtual address in order
+ * to access there.
+ * The conversion can be optimized out by using the last result of
+ * ctxt->address because we access the array sequentially.
+ * The conversion, gpaddr -> maddr -> vaddr, is necessary only when
+ * crossing page boundary.
+ */
static int
xencomm_ctxt_next(struct xencomm_ctxt *ctxt, int i)
{
@@ -147,7 +163,7 @@ xencomm_ctxt_next(struct xencomm_ctxt *ctxt, int i)
BUG_ON(i >= ctxt->nr_addrs);
- /* In i == 0 case, we already calculated in xecomm_addr_init(). */
+ /* For i == 0 case we already calculated it in xencomm_ctxt_init(). */
if ( i != 0 )
ctxt->address++;