[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/6] Export xc_core_arch_map_p2m_writable()


  • To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
  • From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
  • Date: Sun, 31 May 2009 19:11:21 +0800
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Sun, 31 May 2009 04:14:49 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Acnh4Ib8LS9AP5CGSXyMEhgtnjiruw==
  • Thread-topic: [PATCH 3/6] 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@xxxxxxxxx>

diff -r df5c0b078d8d tools/libxc/xc_core.h
--- a/tools/libxc/xc_core.h     Wed Mar 18 20:14:41 2009 +0800
+++ b/tools/libxc/xc_core.h     Wed Mar 18 21:38:41 2009 +0800
@@ -143,6 +143,11 @@ int xc_core_arch_map_p2m(int xc_handle, 
                          xc_dominfo_t *info, shared_info_any_t *live_shinfo,
                          xen_pfn_t **live_p2m, unsigned long *pfnp);
 
+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);
+
 
 #if defined (__i386__) || defined (__x86_64__)
 # include "xc_core_x86.h"
diff -r df5c0b078d8d tools/libxc/xc_core_x86.c
--- a/tools/libxc/xc_core_x86.c Wed Mar 18 20:14:41 2009 +0800
+++ b/tools/libxc/xc_core_x86.c Wed Mar 18 21:39:14 2009 +0800
@@ -75,10 +75,10 @@ xc_core_arch_memory_map_get(int xc_handl
     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, unsi
         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

Attachment: writable_p2m.patch
Description: writable_p2m.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.