]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
tools/ocaml: Extend domain_create() to take arch_domainconfig
authorJon Ludlam <jonathan.ludlam@citrix.com>
Thu, 11 Jan 2018 17:47:59 +0000 (17:47 +0000)
committerRoger Pau Monne <roger.pau@citrix.com>
Thu, 11 Jan 2018 17:51:18 +0000 (17:51 +0000)
No longer passing NULL into xc_domain_create() allows for the creation
of PVH guests.

Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
tools/ocaml/libs/xc/xenctrl_stubs.c

index d549068d60a157013c28b35c812419fdd5bbf2b5..9116aa222cefeb2936c048185ff48bbb8e8e0a25 100644 (file)
@@ -143,7 +143,7 @@ let with_intf f =
        interface_close xc;
        r
 
-external _domain_create: handle -> int32 -> domain_create_flag list -> int array -> domid
+external _domain_create: handle -> int32 -> domain_create_flag list -> int array -> arch_domainconfig -> domid
        = "stub_xc_domain_create"
 
 let int_array_of_uuid_string s =
index 08f1fd26ae4e23eae1ed96b81503d5a32b958997..54c099c88fbad0fc20a39bb8b21df8793404f1c6 100644 (file)
@@ -102,7 +102,7 @@ external sizeof_xen_pfn : unit -> int = "stub_sizeof_xen_pfn"
 external interface_open : unit -> handle = "stub_xc_interface_open"
 external interface_close : handle -> unit = "stub_xc_interface_close"
 val with_intf : (handle -> 'a) -> 'a
-val domain_create : handle -> int32 -> domain_create_flag list -> string -> domid
+val domain_create : handle -> int32 -> domain_create_flag list -> string -> arch_domainconfig -> domid
 val domain_sethandle : handle -> domid -> string -> unit
 external domain_max_vcpus : handle -> domid -> int -> unit
   = "stub_xc_domain_max_vcpus"
index 124aa34fe850ca367bc911fb19373ad98ee73749..0b5a2361c068c89054d9d117eb689a52aabe11e9 100644 (file)
@@ -144,7 +144,8 @@ static int domain_create_flag_table[] = {
 };
 
 CAMLprim value stub_xc_domain_create(value xch, value ssidref,
-                                     value flags, value handle)
+                                     value flags, value handle,
+                                     value domconfig)
 {
        CAMLparam4(xch, ssidref, flags, handle);
 
@@ -155,6 +156,7 @@ CAMLprim value stub_xc_domain_create(value xch, value ssidref,
        uint32_t c_ssidref = Int32_val(ssidref);
        unsigned int c_flags = 0;
        value l;
+       xc_domain_configuration_t config = {};
 
         if (Wosize_val(handle) != 16)
                caml_invalid_argument("Handle not a 16-integer array");
@@ -168,8 +170,24 @@ CAMLprim value stub_xc_domain_create(value xch, value ssidref,
                c_flags |= domain_create_flag_table[v];
        }
 
+       switch(Tag_val(domconfig)) {
+       case 0: /* ARM - nothing to do */
+               caml_failwith("Unhandled: ARM");
+               break;
+
+       case 1: /* X86 - emulation flags in the block */
+               for (l = Field(Field(domconfig, 0), 0);
+                    l != Val_none;
+                    l = Field(l, 1))
+                       config.emulation_flags |= 1u << Int_val(Field(l, 0));
+               break;
+
+       default:
+               caml_failwith("Unhandled domconfig type");
+       }
+
        caml_enter_blocking_section();
-       result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid, NULL);
+       result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid, &config);
        caml_leave_blocking_section();
 
        if (result < 0)