python ../doc/doc.py $(DOCDIR) "xc" "package" "$(OBJS)" "." "mmap,uuid" ""
clean:
- rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) $(INTF)
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) $(INTF) *~ *.rej *.orig
#include <xen/domctl.h>
#include <xen/sched.h>
#include <xen/sysctl.h>
+#include <xen/platform.h>
#if XEN_SYSCTL_INTERFACE_VERSION < 4
#include <xen/linux/privcmd.h>
#else
int xc_domain_trigger_power(int handle, unsigned int domid);
int xc_domain_trigger_sleep(int handle, unsigned int domid);
+int xc_get_boot_cpufeatures(int handle, uint32_t *, uint32_t *, uint32_t *,
+ uint32_t *, uint32_t *, uint32_t *, uint32_t *, uint32_t *);
+
#if XEN_SYSCTL_INTERFACE_VERSION >= 6
#define SAFEDIV(a, b) (((b) >= 0) ? (a) / (b) : (a))
#define COMPAT_FIELD_physinfo_get_nr_cpus(p) (p).nr_cpus
external watchdog : handle -> int -> int32 -> int
= "stub_xc_watchdog"
+external get_boot_cpufeatures: handle ->
+ (int32 * int32 * int32 * int32 * int32 * int32 * int32 * int32) = "stub_xc_get_boot_cpufeatures"
+
(* core dump structure *)
type core_magic = Magic_hvm | Magic_pv
external cpuid_check: (int64 * (int64 option)) -> string option array -> (bool * string option array)
= "stub_xc_cpuid_check"
+external get_boot_cpufeatures: handle ->
+ (int32 * int32 * int32 * int32 * int32 * int32 * int32 * int32) = "stub_xc_get_boot_cpufeatures"
+
.interface_version = XEN_SYSCTL_INTERFACE_VERSION, \
}
+#define DECLARE_PLATFORM(_cmd) \
+ struct xen_platform_op platform = { \
+ .cmd = _cmd, \
+ .interface_version = XENPF_INTERFACE_VERSION, \
+ }
+
#define DECLARE_HYPERCALL2(_cmd, _arg0, _arg1) \
privcmd_hypercall_t hypercall = { \
.op = _cmd, \
return ret;
}
+static int do_platform(int handle, struct xen_platform_op *platform)
+{
+ int ret;
+ DECLARE_HYPERCALL1(__HYPERVISOR_platform_op, platform);
+
+ if (mlock(platform, sizeof(*platform)) != 0) {
+ xc_error_set("mlock failed: %s", strerror(errno));
+ return -1;
+ }
+
+ ret = do_xen_hypercall(handle, &hypercall);
+ if (ret < 0)
+ xc_error_hypercall(hypercall, ret);
+
+ munlock(platform, sizeof(*platform));
+ return ret;
+}
+
static int do_evtchnctl(int handle, int cmd, void *arg, size_t arg_size)
{
DECLARE_HYPERCALL2(__HYPERVISOR_event_channel_op, cmd, arg);
return ret;
}
+int xc_get_boot_cpufeatures(int handle,
+ uint32_t *base_ecx, uint32_t *base_edx,
+ uint32_t *ext_ecx, uint32_t *ext_edx,
+ uint32_t *masked_base_ecx,
+ uint32_t *masked_base_edx,
+ uint32_t *masked_ext_ecx,
+ uint32_t *masked_ext_edx)
+{
+ int ret = -EINVAL;
+#ifdef XENPF_get_cpu_features
+ DECLARE_PLATFORM(XENPF_get_cpu_features);
+
+ ret = do_platform(handle, &platform);
+ if (ret != 0)
+ xc_error_set("getting boot cpu features failed: %s", xc_error_get());
+ else {
+ *base_ecx = platform.u.cpu_features.base_ecx;
+ *base_edx = platform.u.cpu_features.base_edx;
+ *ext_ecx = platform.u.cpu_features.ext_ecx;
+ *ext_edx = platform.u.cpu_features.ext_edx;
+ *masked_base_ecx = platform.u.cpu_features.masked_base_ecx;
+ *masked_base_edx = platform.u.cpu_features.masked_base_edx;
+ *masked_ext_ecx = platform.u.cpu_features.masked_ext_ecx;
+ *masked_ext_edx = platform.u.cpu_features.masked_ext_edx;
+ }
+#endif
+ return ret;
+}
+
/*
* Local variables:
* indent-tabs-mode: t
CAMLreturn(Val_unit);
}
+CAMLprim value stub_xc_get_boot_cpufeatures(value handle)
+{
+ CAMLparam1(handle);
+ CAMLlocal1(v);
+ uint32_t a, b, c, d, e, f, g, h;
+ int ret;
+
+ ret = xc_get_boot_cpufeatures(_H(handle), &a, &b, &c, &d, &e, &f, &g, &h);
+ if (ret < 0)
+ failwith_xc();
+
+ v = caml_alloc_tuple(8);
+ Store_field(v, 0, caml_copy_int32(a));
+ Store_field(v, 1, caml_copy_int32(b));
+ Store_field(v, 2, caml_copy_int32(c));
+ Store_field(v, 3, caml_copy_int32(d));
+ Store_field(v, 4, caml_copy_int32(e));
+ Store_field(v, 5, caml_copy_int32(f));
+ Store_field(v, 6, caml_copy_int32(g));
+ Store_field(v, 7, caml_copy_int32(h));
+
+ CAMLreturn(v);
+}
+
/*
* Local variables:
* indent-tabs-mode: t