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

[Xen-API] [PATCH 3 of 9] PoC: ocaml: add bindings for get_boot_cpufeatures



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1294742831 0
# Node ID 89a18365bb0c1296444bcfdac3bd0df23696d9e6
# Parent  439cf43e55018acb0b4b287b32e647ef2b893950
PoC: ocaml: add bindings for get_boot_cpufeatures

Required by xapi.

Taken from xen-api-libs.hg/xc and adjusted for upstream libxc+ocaml.

(should be folded into previous patch cpuid-before-mask)
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 439cf43e5501 -r 89a18365bb0c tools/ocaml/libs/xc/xc.ml
--- a/tools/ocaml/libs/xc/xc.ml Tue Jan 11 10:47:11 2011 +0000
+++ b/tools/ocaml/libs/xc/xc.ml Tue Jan 11 10:47:11 2011 +0000
@@ -237,6 +237,9 @@ external version_capabilities: handle ->
 external watchdog : handle -> int -> int32 -> int
   = "stub_xc_watchdog"
 
+external get_boot_cpufeatures: handle ->
+        (int32 * int32 * int32 * int32 * int32 * int32 * int32 * int32) = 
"stub_xc_get_boot_cpufeatures"
+
 (* core dump structure *)
 type core_magic = Magic_hvm | Magic_pv
 
diff -r 439cf43e5501 -r 89a18365bb0c tools/ocaml/libs/xc/xc.mli
--- a/tools/ocaml/libs/xc/xc.mli        Tue Jan 11 10:47:11 2011 +0000
+++ b/tools/ocaml/libs/xc/xc.mli        Tue Jan 11 10:47:11 2011 +0000
@@ -182,3 +182,5 @@ external domain_cpuid_apply_policy: hand
 external cpuid_check: handle -> (int64 * (int64 option)) -> string option 
array -> (bool * string option array)
        = "stub_xc_cpuid_check"
 
+external get_boot_cpufeatures: handle ->
+        (int32 * int32 * int32 * int32 * int32 * int32 * int32 * int32) = 
"stub_xc_get_boot_cpufeatures"
diff -r 439cf43e5501 -r 89a18365bb0c tools/ocaml/libs/xc/xc_stubs.c
--- a/tools/ocaml/libs/xc/xc_stubs.c    Tue Jan 11 10:47:11 2011 +0000
+++ b/tools/ocaml/libs/xc/xc_stubs.c    Tue Jan 11 10:47:11 2011 +0000
@@ -1152,6 +1152,30 @@ CAMLprim value stub_xc_watchdog(value xc
        CAMLreturn(Val_int(ret));
 }
 
+CAMLprim value stub_xc_get_boot_cpufeatures(value xch)
+{
+       CAMLparam1(xch);
+       CAMLlocal1(v);
+       uint32_t a, b, c, d, e, f, g, h;
+       int ret;
+
+       ret = xc_get_boot_cpufeatures(_H(xch), &a, &b, &c, &d, &e, &f, &g, &h);
+       if (ret < 0)
+               failwith_xc(_H(xch));
+
+       v = caml_alloc_tuple(8);
+       Store_field(v, 0, caml_copy_int32(a));
+       Store_field(v, 1, caml_copy_int32(b));
+       Store_field(v, 2, caml_copy_int32(c));
+       Store_field(v, 3, caml_copy_int32(d));
+       Store_field(v, 4, caml_copy_int32(e));
+       Store_field(v, 5, caml_copy_int32(f));
+       Store_field(v, 6, caml_copy_int32(g));
+       Store_field(v, 7, caml_copy_int32(h));
+
+       CAMLreturn(v);
+}
+
 /*
  * Local variables:
  *  indent-tabs-mode: t

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

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