本文整理汇总了C++中HYPERVISOR_xen_version函数的典型用法代码示例。如果您正苦于以下问题:C++ HYPERVISOR_xen_version函数的具体用法?C++ HYPERVISOR_xen_version怎么用?C++ HYPERVISOR_xen_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HYPERVISOR_xen_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xen_set_version
/*
* Update the xenver data. We maintain two copies, boot and
* current. If we are setting the boot, then also set current.
*/
static void
xen_set_version(xen_version_t idx)
{
ulong_t ver;
bzero(&xenver[idx], sizeof (xenver[idx]));
ver = HYPERVISOR_xen_version(XENVER_version, 0);
xenver[idx].xv_major = BITX(ver, 31, 16);
xenver[idx].xv_minor = BITX(ver, 15, 0);
(void) HYPERVISOR_xen_version(XENVER_extraversion, &xenver[idx].xv_ver);
/*
* The revision is buried in the extraversion information that is
* maintained by the hypervisor. For our purposes we expect that
* the revision number is:
* - the second character in the extraversion information
* - one character long
* - numeric digit
* If it isn't then we can't extract the revision and we leave it
* set to 0.
*/
if (strlen(xenver[idx].xv_ver) > 1 && isdigit(xenver[idx].xv_ver[1]))
xenver[idx].xv_revision = xenver[idx].xv_ver[1] - '0';
else
cmn_err(CE_WARN, "Cannot extract revision on this hypervisor "
"version: v%s, unexpected version format",
xenver[idx].xv_ver);
xenver[idx].xv_is_xvm = 0;
if (strstr(xenver[idx].xv_ver, "-xvm") != NULL)
xenver[idx].xv_is_xvm = 1;
(void) HYPERVISOR_xen_version(XENVER_changeset,
&xenver[idx].xv_chgset);
(void) HYPERVISOR_xen_version(XENVER_compile_info,
&xenver[idx].xv_build);
/*
* Capabilities are a set of space separated ascii strings
* e.g. 'xen-3.1-x86_32p' or 'hvm-3.2-x86_64'
*/
(void) HYPERVISOR_xen_version(XENVER_capabilities,
&xenver[idx].xv_caps);
cmn_err(CE_CONT, "?v%lu.%lu%s chgset '%s'\n", xenver[idx].xv_major,
xenver[idx].xv_minor, xenver[idx].xv_ver, xenver[idx].xv_chgset);
if (idx == XENVER_BOOT_IDX)
bcopy(&xenver[XENVER_BOOT_IDX], &xenver[XENVER_CURRENT_IDX],
sizeof (xenver[XENVER_BOOT_IDX]));
}
示例2: xen_banner
static void __init xen_banner(void)
{
unsigned version = HYPERVISOR_xen_version(XENVER_version, NULL);
struct xen_extraversion extra;
HYPERVISOR_xen_version(XENVER_extraversion, &extra);
printk(KERN_INFO "Booting paravirtualized kernel on %s\n",
pv_info.name);
printk(KERN_INFO "Xen version: %d.%d%s%s\n",
version >> 16, version & 0xffff, extra.extraversion,
xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
}
示例3: minor_show
static ssize_t minor_show(struct hyp_sysfs_attr *attr, char *buffer)
{
int version = HYPERVISOR_xen_version(XENVER_version, NULL);
if (version)
return sprintf(buffer, "%d\n", version & 0xff);
return -ENODEV;
}
示例4: pagesize_show
static ssize_t pagesize_show(struct hyp_sysfs_attr *attr, char *buffer)
{
int ret;
ret = HYPERVISOR_xen_version(XENVER_pagesize, NULL);
if (ret > 0)
ret = sprintf(buffer, "%x\n", ret);
return ret;
}
示例5: uuid_show
static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer)
{
xen_domain_handle_t uuid;
int ret;
ret = HYPERVISOR_xen_version(XENVER_guest_handle, uuid);
if (ret)
return uuid_show_fallback(attr, buffer);
ret = sprintf(buffer, "%pU\n", uuid);
return ret;
}
示例6: xen_feature_show
static ssize_t xen_feature_show(int index, char *buffer)
{
ssize_t ret;
struct xen_feature_info info;
info.submap_idx = index;
ret = HYPERVISOR_xen_version(XENVER_get_features, &info);
if (!ret)
ret = sprintf(buffer, "%08x", info.submap);
return ret;
}
示例7: xen_setup_features
void xen_setup_features(void)
{
struct xen_feature_info fi;
int i, j;
for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) {
fi.submap_idx = i;
if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
break;
for (j = 0; j < 32; j++)
xen_features[i * 32 + j] = !!(fi.submap & 1<<j);
}
}
示例8: privcmd_HYPERVISOR_xen_version
static int
privcmd_HYPERVISOR_xen_version(int cmd, void *arg)
{
int error;
int size = 0;
import_export_t op_ie;
uint32_t flags = IE_EXPORT;
switch (cmd) {
case XENVER_version:
break;
case XENVER_extraversion:
size = sizeof (xen_extraversion_t);
break;
case XENVER_compile_info:
size = sizeof (xen_compile_info_t);
break;
case XENVER_capabilities:
size = sizeof (xen_capabilities_info_t);
break;
case XENVER_changeset:
size = sizeof (xen_changeset_info_t);
break;
case XENVER_platform_parameters:
size = sizeof (xen_platform_parameters_t);
break;
case XENVER_get_features:
flags = IE_IMPEXP;
size = sizeof (xen_feature_info_t);
break;
case XENVER_pagesize:
break;
case XENVER_guest_handle:
size = sizeof (xen_domain_handle_t);
break;
default:
#ifdef DEBUG
printf("unrecognized HYPERVISOR_xen_version op %d\n", cmd);
#endif
return (-X_EINVAL);
}
error = import_buffer(&op_ie, arg, NULL, size, flags);
if (error == 0)
error = HYPERVISOR_xen_version(cmd, op_ie.ie_kaddr);
export_buffer(&op_ie, &error);
return (error);
}
示例9: compile_date_show
static ssize_t compile_date_show(struct hyp_sysfs_attr *attr, char *buffer)
{
int ret = -ENOMEM;
struct xen_compile_info *info;
info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL);
if (info) {
ret = HYPERVISOR_xen_version(XENVER_compile_info, info);
if (!ret)
ret = sprintf(buffer, "%s\n", info->compile_date);
kfree(info);
}
return ret;
}
示例10: changeset_show
static ssize_t changeset_show(struct hyp_sysfs_attr *attr, char *buffer)
{
int ret = -ENOMEM;
char *cset;
cset = kmalloc(XEN_CHANGESET_INFO_LEN, GFP_KERNEL);
if (cset) {
ret = HYPERVISOR_xen_version(XENVER_changeset, cset);
if (!ret)
ret = sprintf(buffer, "%s\n", cset);
kfree(cset);
}
return ret;
}
示例11: capabilities_show
static ssize_t capabilities_show(struct hyp_sysfs_attr *attr, char *buffer)
{
int ret = -ENOMEM;
char *caps;
caps = kmalloc(XEN_CAPABILITIES_INFO_LEN, GFP_KERNEL);
if (caps) {
ret = HYPERVISOR_xen_version(XENVER_capabilities, caps);
if (!ret)
ret = sprintf(buffer, "%s\n", caps);
kfree(caps);
}
return ret;
}
示例12: extra_show
static ssize_t extra_show(struct hyp_sysfs_attr *attr, char *buffer)
{
int ret = -ENOMEM;
char *extra;
extra = kmalloc(XEN_EXTRAVERSION_LEN, GFP_KERNEL);
if (extra) {
ret = HYPERVISOR_xen_version(XENVER_extraversion, extra);
if (!ret)
ret = sprintf(buffer, "%s\n", extra);
kfree(extra);
}
return ret;
}
示例13: virtual_start_show
static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer)
{
int ret = -ENOMEM;
struct xen_platform_parameters *parms;
parms = kmalloc(sizeof(struct xen_platform_parameters), GFP_KERNEL);
if (parms) {
ret = HYPERVISOR_xen_version(XENVER_platform_parameters,
parms);
if (!ret)
ret = sprintf(buffer, "%lx\n", parms->virt_start);
kfree(parms);
}
return ret;
}
示例14: hypervisor_attach
/*
* Attach the hypervisor.
*/
void
hypervisor_attach(device_t parent, device_t self, void *aux)
{
#if NPCI >0
#ifdef PCI_BUS_FIXUP
int pci_maxbus = 0;
#endif
#endif /* NPCI */
union hypervisor_attach_cookie hac;
char xen_extra_version[XEN_EXTRAVERSION_LEN];
static char xen_version_string[20];
int rc;
const struct sysctlnode *node = NULL;
xenkernfs_init();
xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
memset(xen_extra_version, 0, sizeof(xen_extra_version));
HYPERVISOR_xen_version(XENVER_extraversion, xen_extra_version);
rc = snprintf(xen_version_string, 20, "%d.%d%s", XEN_MAJOR(xen_version),
XEN_MINOR(xen_version), xen_extra_version);
aprint_normal(": Xen version %s\n", xen_version_string);
if (rc >= 20)
aprint_debug(": xen_version_string truncated\n");
sysctl_createv(NULL, 0, NULL, &node, 0,
CTLTYPE_NODE, "xen",
SYSCTL_DESCR("Xen top level node"),
NULL, 0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
if (node != NULL) {
sysctl_createv(NULL, 0, &node, NULL, CTLFLAG_READONLY,
CTLTYPE_STRING, "version",
SYSCTL_DESCR("Xen hypervisor version"),
NULL, 0, xen_version_string, 0, CTL_CREATE, CTL_EOL);
}
aprint_verbose_dev(self, "features: ");
#define XEN_TST_F(n) \
if (xen_feature(XENFEAT_##n)) \
aprint_verbose(" %s", #n);
XEN_TST_F(writable_page_tables);
XEN_TST_F(writable_descriptor_tables);
XEN_TST_F(auto_translated_physmap);
XEN_TST_F(supervisor_mode_kernel);
XEN_TST_F(pae_pgdir_above_4gb);
XEN_TST_F(mmu_pt_update_preserve_ad);
XEN_TST_F(highmem_assist);
XEN_TST_F(gnttab_map_avail_bits);
XEN_TST_F(hvm_callback_vector);
XEN_TST_F(hvm_safe_pvclock);
XEN_TST_F(hvm_pirqs);
#undef XEN_TST_F
aprint_verbose("\n");
xengnt_init();
events_init();
memset(&hac, 0, sizeof(hac));
hac.hac_vcaa.vcaa_name = "vcpu";
hac.hac_vcaa.vcaa_caa.cpu_number = 0;
hac.hac_vcaa.vcaa_caa.cpu_role = CPU_ROLE_BP;
hac.hac_vcaa.vcaa_caa.cpu_func = NULL; /* See xen/x86/cpu.c:vcpu_attach() */
config_found_ia(self, "xendevbus", &hac.hac_vcaa, hypervisor_print);
#ifdef MULTIPROCESSOR
/*
* The xenstore contains the configured number of vcpus.
* The xenstore however, is not accessible until much later in
* the boot sequence. We therefore bruteforce check for
* allocated vcpus (See: cpu.c:vcpu_match()) by iterating
* through the maximum supported by NetBSD MP.
*/
cpuid_t vcpuid;
for (vcpuid = 1; vcpuid < maxcpus; vcpuid++) {
memset(&hac, 0, sizeof(hac));
hac.hac_vcaa.vcaa_name = "vcpu";
hac.hac_vcaa.vcaa_caa.cpu_number = vcpuid;
hac.hac_vcaa.vcaa_caa.cpu_role = CPU_ROLE_AP;
hac.hac_vcaa.vcaa_caa.cpu_func = NULL; /* See xen/x86/cpu.c:vcpu_attach() */
if (NULL == config_found_ia(self, "xendevbus", &hac.hac_vcaa,
hypervisor_vcpu_print)) {
break;
}
}
#endif /* MULTIPROCESSOR */
#if NXENBUS > 0
memset(&hac, 0, sizeof(hac));
hac.hac_xenbus.xa_device = "xenbus";
config_found_ia(self, "xendevbus", &hac.hac_xenbus, hypervisor_print);
#endif
//.........这里部分代码省略.........
示例15: force_evtchn_callback
/*
* Force a proper event-channel callback from Xen after clearing the
* callback mask. We do this in a very simple manner, by making a call
* down into Xen. The pending flag will be checked by Xen on return.
*/
void force_evtchn_callback(void)
{
(void)HYPERVISOR_xen_version(0, NULL);
}