tools/ocaml: Extend domain_create() to take arch_domainconfig

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>
This commit is contained in:
Jon Ludlam authored and Wei Liu committed 2018-01-16 18:34:04 +00:00
1 parent 9d683b5e37
commit b38d96f596
3 files changed
+22 -4

No files matched your search

+1 -1
View 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 =
+1 -1
View 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"
+20 -2
View 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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.