From: Vincent Hanquez Date: Fri, 26 Jun 2009 09:57:59 +0000 (+0100) Subject: pass the capabilities in physinfo X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=aad7a6db03de73f2c2338907f5d18d9cf8f1b892;p=xenclient%2Ftoolstack.git pass the capabilities in physinfo --- diff --git a/libs/xc/xc.ml b/libs/xc/xc.ml index 4d93d29..36a6efc 100644 --- a/libs/xc/xc.ml +++ b/libs/xc/xc.ml @@ -54,6 +54,10 @@ type sched_control = cap : int; } +type physinfo_cap_flag = + | CAP_HVM + | CAP_DirectIO + type physinfo = { nr_cpus : int; @@ -66,6 +70,7 @@ type physinfo = free_pages : nativeint; scrub_pages : nativeint; (* XXX hw_cap *) + capabilities : physinfo_cap_flag list; } type version = diff --git a/libs/xc/xc.mli b/libs/xc/xc.mli index cbb3c83..e6ee2d1 100644 --- a/libs/xc/xc.mli +++ b/libs/xc/xc.mli @@ -41,6 +41,7 @@ type domaininfo = { handle : int array; } type sched_control = { weight : int; cap : int; } +type physinfo_cap_flag = CAP_HVM | CAP_DirectIO type physinfo = { nr_cpus : int; threads_per_core : int; @@ -51,6 +52,7 @@ type physinfo = { total_pages : nativeint; free_pages : nativeint; scrub_pages : nativeint; + capabilities : physinfo_cap_flag list; } type version = { major : int; minor : int; extra : string; } type compile_info = { diff --git a/libs/xc/xc_stubs.c b/libs/xc/xc_stubs.c index f86ac7d..7ff73f2 100644 --- a/libs/xc/xc_stubs.c +++ b/libs/xc/xc_stubs.c @@ -513,7 +513,7 @@ CAMLprim value stub_xc_send_debug_keys(value xc_handle, value keys) CAMLprim value stub_xc_physinfo(value xc_handle) { CAMLparam1(xc_handle); - CAMLlocal1(physinfo); + CAMLlocal3(physinfo, cap_list, tmp); xc_physinfo_t c_physinfo; int r; @@ -524,7 +524,17 @@ CAMLprim value stub_xc_physinfo(value xc_handle) if (r) failwith_xc(); - physinfo = caml_alloc_tuple(9); + tmp = cap_list = Val_emptylist; + for (r = 0; r < 2; r++) { + if ((c_physinfo.capabilities >> r) & 1) { + tmp = caml_alloc_small(2, Tag_cons); + Field(tmp, 0) = Val_int(r); + Field(tmp, 1) = cap_list; + cap_list = tmp; + } + } + + physinfo = caml_alloc_tuple(10); Store_field(physinfo, 0, Val_int(COMPAT_FIELD_physinfo_get_nr_cpus(c_physinfo))); Store_field(physinfo, 1, Val_int(c_physinfo.threads_per_core)); Store_field(physinfo, 2, Val_int(c_physinfo.cores_per_socket)); @@ -534,6 +544,7 @@ CAMLprim value stub_xc_physinfo(value xc_handle) Store_field(physinfo, 6, caml_copy_nativeint(c_physinfo.total_pages)); Store_field(physinfo, 7, caml_copy_nativeint(c_physinfo.free_pages)); Store_field(physinfo, 8, caml_copy_nativeint(c_physinfo.scrub_pages)); + Store_field(physinfo, 9, cap_list); CAMLreturn(physinfo); }