libxl: ocaml: guard x86-specific functions behind an ifdef
authorAnil Madhavapeddy <anil@recoil.org>
Sat, 11 Jan 2014 23:33:25 +0000 (23:33 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 15 Jan 2014 13:08:56 +0000 (13:08 +0000)
The various cpuid functions are not available on ARM, so this
makes them raise an OCaml exception.  Omitting the functions
completely results in a link failure in oxenstored due to the
missing symbols, so this is preferable to the much bigger patch
that would result from adding conditional compilation into the
OCaml interfaces.

With this patch, oxenstored can successfully start a domain on
Xen/ARM.

Signed-off-by: Anil Madhavapeddy <anil@recoil.org>
Acked-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/ocaml/libs/xc/xenctrl_stubs.c

index f5cf0edb241c61f09542c0a579fe47b95ed05722..ff29b4702ff183de8cb695d800846dee4e019733 100644 (file)
@@ -714,6 +714,7 @@ CAMLprim value stub_xc_domain_cpuid_set(value xch, value domid,
 {
        CAMLparam4(xch, domid, input, config);
        CAMLlocal2(array, tmp);
+#if defined(__i386__) || defined(__x86_64__)
        int r;
        unsigned int c_input[2];
        char *c_config[4], *out_config[4];
@@ -742,17 +743,24 @@ CAMLprim value stub_xc_domain_cpuid_set(value xch, value domid,
                         c_input, (const char **)c_config, out_config);
        if (r < 0)
                failwith_xc(_H(xch));
+#else
+       caml_failwith("xc_domain_cpuid_set: not implemented");
+#endif
        CAMLreturn(array);
 }
 
 CAMLprim value stub_xc_domain_cpuid_apply_policy(value xch, value domid)
 {
        CAMLparam2(xch, domid);
+#if defined(__i386__) || defined(__x86_64__)
        int r;
 
        r = xc_cpuid_apply_policy(_H(xch), _D(domid));
        if (r < 0)
                failwith_xc(_H(xch));
+#else
+       caml_failwith("xc_domain_cpuid_apply_policy: not implemented");
+#endif
        CAMLreturn(Val_unit);
 }
 
@@ -760,6 +768,7 @@ CAMLprim value stub_xc_cpuid_check(value xch, value input, value config)
 {
        CAMLparam3(xch, input, config);
        CAMLlocal3(ret, array, tmp);
+#if defined(__i386__) || defined(__x86_64__)
        int r;
        unsigned int c_input[2];
        char *c_config[4], *out_config[4];
@@ -792,6 +801,9 @@ CAMLprim value stub_xc_cpuid_check(value xch, value input, value config)
        Store_field(ret, 0, Val_bool(r));
        Store_field(ret, 1, array);
 
+#else
+       caml_failwith("xc_domain_cpuid_check: not implemented");
+#endif
        CAMLreturn(ret);
 }