From: Andrew Cooper Date: Tue, 10 Sep 2019 11:18:45 +0000 (+0100) Subject: tools/ocaml: abi handling: Provide ocaml->C conversion/check X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1618 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=133821e5959ec4605978f6d10964c3166aaad636;p=xen.git tools/ocaml: abi handling: Provide ocaml->C conversion/check No users of this yet so no overall change. Signed-off-by: Andrew Cooper Reviewed-by: Ian Jackson Signed-off-by: Ian Jackson Acked-by: Christian Lindig --- 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..522c2c59dd 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -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);