# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 03b9919f655e5dce0959bfb96a08f8a3c398fd90
# Parent 05f36d13e30c2df3b40e4dce47c1e0d5c58d6022
mlock argument to version hypercall in libxc.
Signed-off-by: Ian Pratt <ian@xxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r 05f36d13e30c -r 03b9919f655e tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Mon Sep 12 12:10:43 2005
+++ b/tools/libxc/xc_private.c Mon Sep 12 12:17:31 2005
@@ -425,23 +425,49 @@
int xc_version(int xc_handle, int cmd, void *arg)
{
- return do_xen_version(xc_handle, cmd, arg);
-}
-
-unsigned long xc_make_page_below_4G(int xc_handle, u32 domid,
- unsigned long mfn)
+ int rc, argsize = 0;
+
+ switch ( cmd )
+ {
+ case XENVER_extraversion: argsize = sizeof(xen_extraversion_t); break;
+ case XENVER_compile_info: argsize = sizeof(xen_compile_info_t); break;
+ case XENVER_capabilities: argsize = sizeof(xen_capabilities_info_t); break;
+ case XENVER_changeset: argsize = sizeof(xen_changeset_info_t); break;
+ case XENVER_parameters: argsize = sizeof(xen_parameters_info_t); break;
+ }
+
+ if ( (argsize != 0) && (mlock(arg, argsize) != 0) )
+ {
+ PERROR("Could not lock memory for version hypercall");
+ return -ENOMEM;
+ }
+
+ rc = do_xen_version(xc_handle, cmd, arg);
+
+ if ( argsize != 0 )
+ safe_munlock(arg, argsize);
+
+ return rc;
+}
+
+unsigned long xc_make_page_below_4G(
+ int xc_handle, u32 domid, unsigned long mfn)
{
unsigned long new_mfn;
+
if ( xc_domain_memory_decrease_reservation(
- xc_handle, domid, 1, 0, &mfn ) != 1 )
+ xc_handle, domid, 1, 0, &mfn) != 1 )
{
fprintf(stderr,"xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn);
return 0;
}
- if ( xc_domain_memory_increase_reservation( xc_handle, domid, 1, 0, 32,
&new_mfn ) != 1 )
+
+ if ( xc_domain_memory_increase_reservation(
+ xc_handle, domid, 1, 0, 32, &new_mfn) != 1 )
{
fprintf(stderr,"xc_make_page_below_4G increase failed. mfn=%lx\n",mfn);
return 0;
}
+
return new_mfn;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|