[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2 of 2] Tools: Libxc wrappers to automatically fill in page oud page contents on prepare
tools/libxc/xc_mem_event.c | 4 ++-- tools/libxc/xc_mem_paging.c | 23 +++++++++++++++++++++++ tools/libxc/xenctrl.h | 2 ++ 3 files changed, 27 insertions(+), 2 deletions(-) Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> diff -r 0ce71e5bfaac -r 15da109b0c7d tools/libxc/xc_mem_event.c --- a/tools/libxc/xc_mem_event.c +++ b/tools/libxc/xc_mem_event.c @@ -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 @@ int xc_mem_event_control(xc_interface *x 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 0ce71e5bfaac -r 15da109b0c7d tools/libxc/xc_mem_paging.c --- a/tools/libxc/xc_mem_paging.c +++ b/tools/libxc/xc_mem_paging.c @@ -65,6 +65,29 @@ int xc_mem_paging_prep(xc_interface *xch 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 0ce71e5bfaac -r 15da109b0c7d tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1866,6 +1866,8 @@ int xc_mem_paging_nominate(xc_interface 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-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |