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

[Xen-devel] [PATCH v3 06/12] tools/ocaml: abi handling: Provide ocaml->C conversion/check



From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

No users of this yet so no overall change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/ocaml/libs/xc/abi-check       |  3 ++-
 tools/ocaml/libs/xc/xenctrl_stubs.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/abi-check b/tools/ocaml/libs/xc/abi-check
index ccc35e79e9..a470c05e0b 100755
--- a/tools/ocaml/libs/xc/abi-check
+++ b/tools/ocaml/libs/xc/abi-check
@@ -22,6 +22,7 @@ our $ei;
 
 # Parse the C file looking for calls to:
 #   c_bitmap_to_ocaml_list()
+#   ocaml_list_to_c_bitmap()
 #
 # followed by anotations of the following form:
 #   /* ! OType OPrefix Mangle */
@@ -30,7 +31,7 @@ our $ei;
 # The function definitions use /* ! */ which simply skips that instance.
 while (<>) {
     if ($cline == -1) {
-        if (m/c_bitmap_to_ocaml_list/) {
+        if (m/c_bitmap_to_ocaml_list|ocaml_list_to_c_bitmap/) {
             $cline = 0;
             $ei = { };
         }
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 352a6bd2d6..c74c2b43a0 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -153,6 +153,21 @@ static value c_bitmap_to_ocaml_list
        CAMLreturn(list);
 }
 
+static unsigned int ocaml_list_to_c_bitmap(value l)
+             /* ! */
+             /*
+             * All calls to this function must be in a form suitable
+             * for xenctrl_abi_check.  The parsing there is ad-hoc.
+             */
+{
+       unsigned int val;
+
+       for ( ; l != Val_none; l = Field(l, 1) )
+               val |= 1u << Int_val(Field(l, 0));
+
+       return val;
+}
+
 CAMLprim value stub_xc_domain_create(value xch, value config)
 {
        CAMLparam2(xch, config);
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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