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

[Xen-changelog] [xen-unstable] Tools: Libxc wrappers to automatically fill in page oud page contents on prepare



# HG changeset patch
# User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
# Date 1322763264 0
# Node ID 8ad47b48047db130d5cce138c7a704bc57741de6
# Parent  8529bca7a3f00cf58e2e92ab152407a7f90279d4
Tools: Libxc wrappers to automatically fill in page oud page contents on prepare
Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---


diff -r 8529bca7a3f0 -r 8ad47b48047d tools/libxc/xc_mem_event.c
--- a/tools/libxc/xc_mem_event.c        Thu Dec 01 18:14:24 2011 +0000
+++ b/tools/libxc/xc_mem_event.c        Thu Dec 01 18:14:24 2011 +0000
@@ -24,7 +24,7 @@
 #include "xc_private.h"
 
 int xc_mem_event_control(xc_interface *xch, domid_t domain_id, unsigned int op,
-                         unsigned int mode, void *shared_page,
+                         unsigned int mode, void *page,
                          void *ring_page, unsigned long gfn)
 {
     DECLARE_DOMCTL;
@@ -34,7 +34,7 @@
     domctl.u.mem_event_op.op = op;
     domctl.u.mem_event_op.mode = mode;
 
-    domctl.u.mem_event_op.shared_addr = (unsigned long)shared_page;
+    domctl.u.mem_event_op.u.shared_addr = (unsigned long)page;
     domctl.u.mem_event_op.ring_addr = (unsigned long)ring_page;
 
     domctl.u.mem_event_op.gfn = gfn;
diff -r 8529bca7a3f0 -r 8ad47b48047d tools/libxc/xc_mem_paging.c
--- a/tools/libxc/xc_mem_paging.c       Thu Dec 01 18:14:24 2011 +0000
+++ b/tools/libxc/xc_mem_paging.c       Thu Dec 01 18:14:24 2011 +0000
@@ -65,6 +65,29 @@
                                 NULL, NULL, gfn);
 }
 
+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id, 
+                                unsigned long gfn, void *buffer)
+{
+    int rc;
+
+    if ( !buffer )
+        return -EINVAL;
+
+    if ( ((unsigned long) buffer) & (XC_PAGE_SIZE - 1) )
+        return -EINVAL;
+
+    if ( mlock(buffer, XC_PAGE_SIZE) )
+        return -errno;
+        
+    rc = xc_mem_event_control(xch, domain_id,
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+                                buffer, NULL, gfn);
+
+    (void)munlock(buffer, XC_PAGE_SIZE);
+    return rc;
+}
+
 int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long 
gfn)
 {
     return xc_mem_event_control(xch, domain_id,
diff -r 8529bca7a3f0 -r 8ad47b48047d tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Thu Dec 01 18:14:24 2011 +0000
+++ b/tools/libxc/xenctrl.h     Thu Dec 01 18:14:24 2011 +0000
@@ -1868,6 +1868,8 @@
                            unsigned long gfn);
 int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long 
gfn);
 int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long 
gfn);
+int xc_mem_paging_load(xc_interface *xch, domid_t domain_id, 
+                        unsigned long gfn, void *buffer);
 int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id,
                          unsigned long gfn);
 

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


 


Rackspace

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