aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_core_x86.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-01 14:13:53 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-01 14:13:53 +0100
commit1472f8177f8ec6d81b471d678cf22e04c36e1a2a (patch)
tree9843b9100fe183bf09a8979026d1da24b2d00d14 /tools/libxc/xc_core_x86.c
parent8b9c6bce94a7bc9341a4943c12457f4a419b4c17 (diff)
downloadxen-1472f8177f8ec6d81b471d678cf22e04c36e1a2a.tar.gz
xen-1472f8177f8ec6d81b471d678cf22e04c36e1a2a.tar.bz2
xen-1472f8177f8ec6d81b471d678cf22e04c36e1a2a.zip
libxc: Export xc_core_arch_map_p2m_writable()
This patch firstly change the xc_core_arch_map_p2m() to map the p2m to be writable, then it export this function. One notice for this patch is, caller should make sure change the p2m in flight will not cause trouble. Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Diffstat (limited to 'tools/libxc/xc_core_x86.c')
-rw-r--r--tools/libxc/xc_core_x86.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/libxc/xc_core_x86.c b/tools/libxc/xc_core_x86.c
index 765c745cb6..fc2a7a1192 100644
--- a/tools/libxc/xc_core_x86.c
+++ b/tools/libxc/xc_core_x86.c
@@ -75,10 +75,10 @@ xc_core_arch_memory_map_get(int xc_handle, struct xc_core_arch_context *unused,
return 0;
}
-int
-xc_core_arch_map_p2m(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
- shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
- unsigned long *pfnp)
+static int
+xc_core_arch_map_p2m_rw(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
+ shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
+ unsigned long *pfnp, int rw)
{
/* Double and single indirect references to the live P2M table */
xen_pfn_t *live_p2m_frame_list_list = NULL;
@@ -156,7 +156,8 @@ xc_core_arch_map_p2m(int xc_handle, unsigned int guest_width, xc_dominfo_t *info
for ( i = P2M_FL_ENTRIES - 1; i >= 0; i-- )
p2m_frame_list[i] = ((uint32_t *)p2m_frame_list)[i];
- *live_p2m = xc_map_foreign_pages(xc_handle, dom, PROT_READ,
+ *live_p2m = xc_map_foreign_pages(xc_handle, dom,
+ rw ? (PROT_READ | PROT_WRITE) : PROT_READ,
p2m_frame_list,
P2M_FL_ENTRIES);
@@ -189,6 +190,23 @@ out:
return ret;
}
+int
+xc_core_arch_map_p2m(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
+ shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
+ unsigned long *pfnp)
+{
+ return xc_core_arch_map_p2m_rw(xc_handle, guest_width, info,
+ live_shinfo, live_p2m, pfnp, 0);
+}
+
+int
+xc_core_arch_map_p2m_writable(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
+ shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
+ unsigned long *pfnp)
+{
+ return xc_core_arch_map_p2m_rw(xc_handle, guest_width, info,
+ live_shinfo, live_p2m, pfnp, 1);
+}
/*
* Local variables:
* mode: C