aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-24 14:10:45 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-24 14:10:45 +0100
commitfd6a37dbdcdf53a65f27115aebfc0a57e0040004 (patch)
treee777f4b77198f15d9f7e7a23079b9d541028a393 /tools
parent090519068631f979b0e913023fe0aa77386053c4 (diff)
downloadxen-fd6a37dbdcdf53a65f27115aebfc0a57e0040004.tar.gz
xen-fd6a37dbdcdf53a65f27115aebfc0a57e0040004.tar.bz2
xen-fd6a37dbdcdf53a65f27115aebfc0a57e0040004.zip
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/include/xen-sys/MiniOS/privcmd.h2
-rw-r--r--tools/libxc/xc_minios.c31
2 files changed, 17 insertions, 16 deletions
diff --git a/tools/include/xen-sys/MiniOS/privcmd.h b/tools/include/xen-sys/MiniOS/privcmd.h
index 97e0ceb5a0..db0f00e3ec 100644
--- a/tools/include/xen-sys/MiniOS/privcmd.h
+++ b/tools/include/xen-sys/MiniOS/privcmd.h
@@ -10,9 +10,7 @@ typedef struct privcmd_hypercall
} privcmd_hypercall_t;
typedef struct privcmd_mmap_entry {
- u64 va;
u64 mfn;
- u64 npages;
} privcmd_mmap_entry_t;
#endif /* __MINIOS_PUBLIC_PRIVCMD_H__ */
diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c
index 89ab9ad44d..4a5a351aeb 100644
--- a/tools/libxc/xc_minios.c
+++ b/tools/libxc/xc_minios.c
@@ -80,23 +80,26 @@ void *xc_map_foreign_ranges(int xc_handle, uint32_t dom,
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;
-#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;
+ return map_frames_ex(mfns, n, 1, 0, 1, dom, 0, pt_prot);
}
-#endif
+
int do_xen_hypercall(int xc_handle, privcmd_hypercall_t *hypercall)
{