All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl: ocaml: guard x86-specific functions behind an ifdef
@ 2014-01-09 16:36 Anil Madhavapeddy
  2014-01-09 16:43 ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Anil Madhavapeddy @ 2014-01-09 16:36 UTC (permalink / raw)
  To: xen-devel

The various cpuid functions are not available on ARM, so this
makes them raise an OCaml exception.  Omitting the functions
completely them 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.

Signed-off-by: Anil Madhavapeddy <anil@recoil.org>

---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f5cf0ed..76864cc 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -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
+	failwith_xc(_H(xch));
+#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
+	failwith_xc(_H(xch));
+#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
+	failwith_xc(_H(xch));
+#endif
 	CAMLreturn(ret);
 }
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-11 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09 16:36 [PATCH] libxl: ocaml: guard x86-specific functions behind an ifdef Anil Madhavapeddy
2014-01-09 16:43 ` Andrew Cooper
2014-01-09 17:04   ` Anil Madhavapeddy
2014-01-11 23:35   ` Anil Madhavapeddy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.