WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 3 of 9] PoC: ocaml: add bindings for get_boot_cpufeatures
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 11 Jan 2011 10:55:51 +0000
Cc: gianni.tedesco@xxxxxxxxxx, zheng.li@xxxxxxxxxxxxx
Delivery-date: Tue, 11 Jan 2011 03:44:59 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1294743348@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1294743348@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.5.2
# 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

<Prev in Thread] Current Thread [Next in Thread>