]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
tools/ocaml: abi handling: Provide ocaml->C conversion/check
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Sep 2019 11:18:45 +0000 (12:18 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 10 Sep 2019 13:44:33 +0000 (14:44 +0100)
No users of this yet so no overall change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/libs/xc/abi-check
tools/ocaml/libs/xc/xenctrl_stubs.c

index ccc35e79e98fed4415049c69d4c3770727811b78..a470c05e0b39bcd078518988666fb31e80f08167 100755 (executable)
@@ -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 = { };
         }
index 352a6bd2d6e279e2da5fbfea6f6208c0e7c0ee0e..522c2c59dd613b23290f294f3d6c8d60e14bd1d0 100644 (file)
@@ -153,6 +153,23 @@ static value c_bitmap_to_ocaml_list
        CAMLreturn(list);
 }
 
+#if 0 /* unused, will be used in a moment */
+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;
+}
+#endif
+
 CAMLprim value stub_xc_domain_create(value xch, value config)
 {
        CAMLparam2(xch, config);