All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] pv-grub: re-implement xc_map_foreign_ranges
Date: Thu, 24 Jul 2008 12:27:22 +0100	[thread overview]
Message-ID: <20080724112722.GP4755@implementation.uk.xensource.com> (raw)

pv-grub: re-implement xc_map_foreign_ranges

Also get rid of va and npages members of privcmd_mmap_entry since we do
not need them any more.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>

diff -r 9d56e562a570 tools/include/xen-sys/MiniOS/privcmd.h
--- a/tools/include/xen-sys/MiniOS/privcmd.h	Thu Jul 24 11:19:13 2008 +0100
+++ b/tools/include/xen-sys/MiniOS/privcmd.h	Thu Jul 24 12:26:04 2008 +0100
@@ -10,9 +10,7 @@
 } privcmd_hypercall_t;
 
 typedef struct privcmd_mmap_entry {
-	u64 va;
 	u64 mfn;
-	u64 npages;
 } privcmd_mmap_entry_t; 
 
 #endif /* __MINIOS_PUBLIC_PRIVCMD_H__ */
diff -r 9d56e562a570 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c	Thu Jul 24 11:19:13 2008 +0100
+++ b/tools/libxc/xc_minios.c	Thu Jul 24 12:26:04 2008 +0100
@@ -80,23 +80,26 @@
                             size_t size, int prot, size_t chunksize,
                             privcmd_mmap_entry_t entries[], int nentries)
 {
-    ERROR("%s: implement me\n");
-    return NULL;
+    unsigned long mfns[size / PAGE_SIZE];
+    int i, j, n;
+    unsigned long pt_prot = 0;
+#ifdef __ia64__
+    /* TODO */
+#else
+    if (prot & PROT_READ)
+	pt_prot = L1_PROT_RO;
+    if (prot & PROT_WRITE)
+	pt_prot = L1_PROT;
+#endif
+
+    n = 0;
+    for (i = 0; i < nentries; i++)
+        for (j = 0; j < chunksize / PAGE_SIZE; j++)
+            mfns[n++] = entries[i].mfn + j;
+
+    return map_frames_ex(mfns, n, 1, 0, 1, dom, 0, pt_prot);
 }
 
-
-#if 0
-int xc_map_foreign_ranges(int xc_handle, uint32_t dom,
-                          privcmd_mmap_entry_t *entries, int nr)
-{
-    int i;
-    for (i = 0; i < nr; i++) {
-	unsigned long mfn = entries[i].mfn;
-        do_map_frames(entries[i].va, &mfn, entries[i].npages, 0, 1, dom, 0, L1_PROT);
-    }
-    return 0;
-}
-#endif
 
 int do_xen_hypercall(int xc_handle, privcmd_hypercall_t *hypercall)
 {

                 reply	other threads:[~2008-07-24 11:27 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=20080724112722.GP4755@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --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.