• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_xen_guest_handle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_xen_guest_handle函数的典型用法代码示例。如果您正苦于以下问题:C++ set_xen_guest_handle函数的具体用法?C++ set_xen_guest_handle怎么用?C++ set_xen_guest_handle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_xen_guest_handle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: xc_numainfo

int xc_numainfo(xc_interface *xch, unsigned *max_nodes,
                xc_meminfo_t *meminfo, uint32_t *distance)
{
    int ret;
    DECLARE_SYSCTL;
    DECLARE_HYPERCALL_BOUNCE(meminfo, *max_nodes * sizeof(*meminfo),
                             XC_HYPERCALL_BUFFER_BOUNCE_OUT);
    DECLARE_HYPERCALL_BOUNCE(distance,
                             *max_nodes * *max_nodes * sizeof(*distance),
                             XC_HYPERCALL_BUFFER_BOUNCE_OUT);

    if ( (ret = xc_hypercall_bounce_pre(xch, meminfo)) )
        goto out;
    if ((ret = xc_hypercall_bounce_pre(xch, distance)) )
        goto out;

    sysctl.u.numainfo.num_nodes = *max_nodes;
    set_xen_guest_handle(sysctl.u.numainfo.meminfo, meminfo);
    set_xen_guest_handle(sysctl.u.numainfo.distance, distance);

    sysctl.cmd = XEN_SYSCTL_numainfo;

    if ( (ret = do_sysctl(xch, &sysctl)) != 0 )
        goto out;

    *max_nodes = sysctl.u.numainfo.num_nodes;

out:
    xc_hypercall_bounce_post(xch, meminfo);
    xc_hypercall_bounce_post(xch, distance);

    return ret;
}
开发者ID:MrVan,项目名称:xen,代码行数:33,代码来源:xc_misc.c


示例2: xc_pm_get_cxstat

int xc_pm_get_cxstat(xc_interface *xch, int cpuid, struct xc_cx_stat *cxpt)
{
    DECLARE_SYSCTL;
    DECLARE_NAMED_HYPERCALL_BOUNCE(triggers, cxpt->triggers,
                                   cxpt->nr * sizeof(*cxpt->triggers),
                                   XC_HYPERCALL_BUFFER_BOUNCE_OUT);
    DECLARE_NAMED_HYPERCALL_BOUNCE(residencies, cxpt->residencies,
                                   cxpt->nr * sizeof(*cxpt->residencies),
                                   XC_HYPERCALL_BUFFER_BOUNCE_OUT);
    DECLARE_NAMED_HYPERCALL_BOUNCE(pc, cxpt->pc,
                                   cxpt->nr_pc * sizeof(*cxpt->pc),
                                   XC_HYPERCALL_BUFFER_BOUNCE_OUT);
    DECLARE_NAMED_HYPERCALL_BOUNCE(cc, cxpt->cc,
                                   cxpt->nr_cc * sizeof(*cxpt->cc),
                                   XC_HYPERCALL_BUFFER_BOUNCE_OUT);
    int ret = -1;

    if ( xc_hypercall_bounce_pre(xch, triggers) )
        goto unlock_0;
    if ( xc_hypercall_bounce_pre(xch, residencies) )
        goto unlock_1;
    if ( xc_hypercall_bounce_pre(xch, pc) )
        goto unlock_2;
    if ( xc_hypercall_bounce_pre(xch, cc) )
        goto unlock_3;

    sysctl.cmd = XEN_SYSCTL_get_pmstat;
    sysctl.u.get_pmstat.type = PMSTAT_get_cxstat;
    sysctl.u.get_pmstat.cpuid = cpuid;
    sysctl.u.get_pmstat.u.getcx.nr = cxpt->nr;
    sysctl.u.get_pmstat.u.getcx.nr_pc = cxpt->nr_pc;
    sysctl.u.get_pmstat.u.getcx.nr_cc = cxpt->nr_cc;
    set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.triggers, triggers);
    set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.residencies, residencies);
    set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.pc, pc);
    set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.cc, cc);

    if ( (ret = xc_sysctl(xch, &sysctl)) )
        goto unlock_4;

    cxpt->nr = sysctl.u.get_pmstat.u.getcx.nr;
    cxpt->last = sysctl.u.get_pmstat.u.getcx.last;
    cxpt->idle_time = sysctl.u.get_pmstat.u.getcx.idle_time;
    cxpt->nr_pc = sysctl.u.get_pmstat.u.getcx.nr_pc;
    cxpt->nr_cc = sysctl.u.get_pmstat.u.getcx.nr_cc;

unlock_4:
    xc_hypercall_bounce_post(xch, cc);
unlock_3:
    xc_hypercall_bounce_post(xch, pc);
unlock_2:
    xc_hypercall_bounce_post(xch, residencies);
unlock_1:
    xc_hypercall_bounce_post(xch, triggers);
unlock_0:
    return ret;
}
开发者ID:CPFL,项目名称:xen,代码行数:57,代码来源:xc_pm.c


示例3: xencomm_hypercall_memory_op

int
xencomm_hypercall_memory_op(unsigned int cmd, void *arg)
{
	GUEST_HANDLE(xen_pfn_t) extent_start_va[2] = { {NULL}, {NULL} };
	struct xen_memory_reservation *xmr = NULL;
	int rc;
	struct xencomm_handle *desc;
	unsigned int argsize;
	XENCOMM_MINI_ALIGNED(xc_area, 2);

	switch (cmd) {
	case XENMEM_increase_reservation:
	case XENMEM_decrease_reservation:
	case XENMEM_populate_physmap:
		xmr = (struct xen_memory_reservation *)arg;
		set_xen_guest_handle(extent_start_va[0],
				     xen_guest_handle(xmr->extent_start));

		argsize = sizeof(*xmr);
		rc = xencommize_memory_reservation(xc_area, xmr);
		if (rc)
			return rc;
		xc_area++;
		break;

	case XENMEM_maximum_ram_page:
		argsize = 0;
		break;

	case XENMEM_add_to_physmap:
		argsize = sizeof(struct xen_add_to_physmap);
		break;

	default:
		printk(KERN_DEBUG "%s: unknown memory op %d\n", __func__, cmd);
		return -ENOSYS;
	}

	desc = xencomm_map_no_alloc(arg, argsize);
	if (desc == NULL)
		return -EINVAL;

	rc = xencomm_arch_hypercall_memory_op(cmd, desc);

	switch (cmd) {
	case XENMEM_increase_reservation:
	case XENMEM_decrease_reservation:
	case XENMEM_populate_physmap:
		set_xen_guest_handle(xmr->extent_start,
				     xen_guest_handle(extent_start_va[0]));
		break;
	}

	return rc;
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:55,代码来源:xcom_hcall.c


示例4: xc_perfc_reset

int xc_perfc_reset(xc_interface *xch)
{
    DECLARE_SYSCTL;

    sysctl.cmd = XEN_SYSCTL_perfc_op;
    sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_reset;
    set_xen_guest_handle(sysctl.u.perfc_op.desc, HYPERCALL_BUFFER_NULL);
    set_xen_guest_handle(sysctl.u.perfc_op.val, HYPERCALL_BUFFER_NULL);

    return do_sysctl(xch, &sysctl);
}
开发者ID:MrVan,项目名称:xen,代码行数:11,代码来源:xc_misc.c


示例5: xc_pm_get_pxstat

int xc_pm_get_pxstat(xc_interface *xch, int cpuid, struct xc_px_stat *pxpt)
{
    DECLARE_SYSCTL;
    /* Sizes unknown until xc_pm_get_max_px */
    DECLARE_NAMED_HYPERCALL_BOUNCE(trans, pxpt->trans_pt, 0, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
    DECLARE_NAMED_HYPERCALL_BOUNCE(pt, pxpt->pt, 0, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);

    int max_px, ret;

    if ( !pxpt->trans_pt || !pxpt->pt )
    {
        errno = EINVAL;
        return -1;
    }
    if ( (ret = xc_pm_get_max_px(xch, cpuid, &max_px)) != 0)
        return ret;

    HYPERCALL_BOUNCE_SET_SIZE(trans, max_px * max_px * sizeof(uint64_t));
    HYPERCALL_BOUNCE_SET_SIZE(pt, max_px * sizeof(struct xc_px_val));

    if ( xc_hypercall_bounce_pre(xch, trans) )
        return ret;

    if ( xc_hypercall_bounce_pre(xch, pt) )
    {
        xc_hypercall_bounce_post(xch, trans);
        return ret;
    }

    sysctl.cmd = XEN_SYSCTL_get_pmstat;
    sysctl.u.get_pmstat.type = PMSTAT_get_pxstat;
    sysctl.u.get_pmstat.cpuid = cpuid;
    sysctl.u.get_pmstat.u.getpx.total = max_px;
    set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.trans_pt, trans);
    set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.pt, pt);

    ret = xc_sysctl(xch, &sysctl);
    if ( ret )
    {
	xc_hypercall_bounce_post(xch, trans);
	xc_hypercall_bounce_post(xch, pt);
        return ret;
    }

    pxpt->total = sysctl.u.get_pmstat.u.getpx.total;
    pxpt->usable = sysctl.u.get_pmstat.u.getpx.usable;
    pxpt->last = sysctl.u.get_pmstat.u.getpx.last;
    pxpt->cur = sysctl.u.get_pmstat.u.getpx.cur;

    xc_hypercall_bounce_post(xch, trans);
    xc_hypercall_bounce_post(xch, pt);

    return ret;
}
开发者ID:CPFL,项目名称:xen,代码行数:54,代码来源:xc_pm.c


示例6: xc_livepatch_upload

int xc_livepatch_upload(xc_interface *xch,
                        char *name,
                        unsigned char *payload,
                        uint32_t size)
{
    int rc;
    DECLARE_SYSCTL;
    DECLARE_HYPERCALL_BUFFER(char, local);
    DECLARE_HYPERCALL_BOUNCE(name, 0 /* later */, XC_HYPERCALL_BUFFER_BOUNCE_IN);
    xen_livepatch_name_t def_name = { .pad = { 0, 0, 0 } };

    if ( !name || !payload )
    {
        errno = EINVAL;
        return -1;
    }

    def_name.size = strlen(name) + 1;
    if ( def_name.size > XEN_LIVEPATCH_NAME_SIZE )
    {
        errno = EINVAL;
        return -1;
    }

    HYPERCALL_BOUNCE_SET_SIZE(name, def_name.size);

    if ( xc_hypercall_bounce_pre(xch, name) )
        return -1;

    local = xc_hypercall_buffer_alloc(xch, local, size);
    if ( !local )
    {
        xc_hypercall_bounce_post(xch, name);
        return -1;
    }
    memcpy(local, payload, size);

    sysctl.cmd = XEN_SYSCTL_livepatch_op;
    sysctl.u.livepatch.cmd = XEN_SYSCTL_LIVEPATCH_UPLOAD;
    sysctl.u.livepatch.pad = 0;
    sysctl.u.livepatch.u.upload.size = size;
    set_xen_guest_handle(sysctl.u.livepatch.u.upload.payload, local);

    sysctl.u.livepatch.u.upload.name = def_name;
    set_xen_guest_handle(sysctl.u.livepatch.u.upload.name.name, name);

    rc = do_sysctl(xch, &sysctl);

    xc_hypercall_buffer_free(xch, local);
    xc_hypercall_bounce_post(xch, name);

    return rc;
}
开发者ID:MrVan,项目名称:xen,代码行数:53,代码来源:xc_misc.c


示例7: bind_virq_for_mce

int __init bind_virq_for_mce(void)
{
	int ret;
	xen_mc_t mc_op;

	g_mi = kmalloc(sizeof(*g_mi), GFP_KERNEL);
	if (!g_mi)
		return -ENOMEM;

	/* fetch physical CPU count */
	mc_op.cmd = XEN_MC_physcpuinfo;
	mc_op.interface_version = XEN_MCA_INTERFACE_VERSION;
	set_xen_guest_handle(mc_op.u.mc_physcpuinfo.info, NULL);
	ret = HYPERVISOR_mca(&mc_op);
	if (ret) {
		printk(KERN_ERR "MCE: Failed to get physical CPU count\n");
		kfree(g_mi);
		return ret;
	}

	/* fetch CPU physical info for later reference */
	ncpus = mc_op.u.mc_physcpuinfo.ncpus;
	g_physinfo = kmalloc(sizeof(*g_physinfo) * ncpus, GFP_KERNEL);
	if (!g_physinfo) {
		kfree(g_mi);
		return -ENOMEM;
	}
	set_xen_guest_handle(mc_op.u.mc_physcpuinfo.info, g_physinfo);
	ret = HYPERVISOR_mca(&mc_op);
	if (ret) {
		printk(KERN_ERR "MCE: Failed to get physical CPUs' info\n");
		kfree(g_mi);
		kfree(g_physinfo);
		return ret;
	}

	ret  = bind_virq_to_irqhandler(VIRQ_MCA, 0, 
		mce_dom0_interrupt, 0, "mce", NULL);

	if (ret < 0) {
		printk(KERN_ERR "MCE: Failed to bind vIRQ for Dom0\n");
		kfree(g_mi);
		kfree(g_physinfo);
		return ret;
	}

	/* Log the machine checks left over from the previous reset. */
	mce_dom0_interrupt(VIRQ_MCA, NULL);

	return 0;
}
开发者ID:AsadRaza,项目名称:OCTEON-Linux,代码行数:51,代码来源:mce_dom0.c


示例8: memset

static PyObject *chgpolicy(PyObject *self, PyObject *args)
{
    struct acm_change_policy chgpolicy;
    int xc_handle, rc;
    char *bin_pol = NULL, *del_arr = NULL, *chg_arr = NULL;
    int bin_pol_len = 0, del_arr_len = 0, chg_arr_len = 0;
    uint errarray_mbrs = 20 * 2;
    uint32_t error_array[errarray_mbrs];
    PyObject *result;
    uint len;

    memset(&chgpolicy, 0x0, sizeof(chgpolicy));

    if (!PyArg_ParseTuple(args, "s#s#s#" ,&bin_pol, &bin_pol_len,
                          &del_arr, &del_arr_len,
                          &chg_arr, &chg_arr_len)) {
        PyErr_SetString(PyExc_TypeError, bad_arg);
        return NULL;
    }

    chgpolicy.policy_pushcache_size = bin_pol_len;
    chgpolicy.delarray_size = del_arr_len;
    chgpolicy.chgarray_size = chg_arr_len;
    chgpolicy.errarray_size = sizeof(error_array);

    set_xen_guest_handle(chgpolicy.policy_pushcache, bin_pol);
    set_xen_guest_handle(chgpolicy.del_array, del_arr);
    set_xen_guest_handle(chgpolicy.chg_array, chg_arr);
    set_xen_guest_handle(chgpolicy.err_array, error_array);

    if ((xc_handle = xc_interface_open()) <= 0) {
        PyErr_SetString(PyExc_IOError, ctrlif_op);
        return NULL;
    }

    rc = xc_acm_op(xc_handle, ACMOP_chgpolicy, &chgpolicy, sizeof(chgpolicy));

    xc_interface_close(xc_handle);

    /* only pass the filled error codes */
    for (len = 0; (len + 1) < errarray_mbrs; len += 2) {
        if (error_array[len] == 0) {
            len *= sizeof(error_array[0]);
            break;
        }
    }

    result = Py_BuildValue("is#", rc, error_array, len);
    return result;
}
开发者ID:avsm,项目名称:xen-unstable,代码行数:50,代码来源:acm.c


示例9: xc_perfc_query

int xc_perfc_query(xc_interface *xch,
                   struct xc_hypercall_buffer *desc,
                   struct xc_hypercall_buffer *val)
{
    DECLARE_SYSCTL;
    DECLARE_HYPERCALL_BUFFER_ARGUMENT(desc);
    DECLARE_HYPERCALL_BUFFER_ARGUMENT(val);

    sysctl.cmd = XEN_SYSCTL_perfc_op;
    sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_query;
    set_xen_guest_handle(sysctl.u.perfc_op.desc, desc);
    set_xen_guest_handle(sysctl.u.perfc_op.val, val);

    return do_sysctl(xch, &sysctl);
}
开发者ID:MrVan,项目名称:xen,代码行数:15,代码来源:xc_misc.c


示例10: gnttab_map

static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
{
	struct gnttab_setup_table setup;
	unsigned long *frames;
	unsigned int nr_gframes = end_idx + 1;
	int rc;

	frames = kmalloc(nr_gframes * sizeof(unsigned long), GFP_ATOMIC);
	if (!frames)
		return -ENOMEM;

	setup.dom        = DOMID_SELF;
	setup.nr_frames  = nr_gframes;
	set_xen_guest_handle(setup.frame_list, frames);

	rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1);
	if (rc == -ENOSYS) {
		kfree(frames);
		return -ENOSYS;
	}

	BUG_ON(rc || setup.status);

	rc = arch_gnttab_map_shared(frames, nr_gframes, max_nr_grant_frames(),
				    &shared);
	BUG_ON(rc);

	kfree(frames);

	return 0;
}
开发者ID:mikuhatsune001,项目名称:linux-2.6,代码行数:31,代码来源:grant-table.c


示例11: xc_flask_context_to_sid

int xc_flask_context_to_sid(xc_interface *xch, char *buf, uint32_t size, uint32_t *sid)
{
    int err;
    DECLARE_FLASK_OP;
    DECLARE_HYPERCALL_BOUNCE(buf, size, XC_HYPERCALL_BUFFER_BOUNCE_IN);

    if ( xc_hypercall_bounce_pre(xch, buf) )
    {
        PERROR("Could not bounce memory for flask op hypercall");
        return -1;
    }

    op.cmd = FLASK_CONTEXT_TO_SID;
    op.u.sid_context.size = size;
    set_xen_guest_handle(op.u.sid_context.context, buf);
    
    err = xc_flask_op(xch, &op);

    if ( !err )
        *sid = op.u.sid_context.sid;

    xc_hypercall_bounce_post(xch, buf);

    return err;
}
开发者ID:HackLinux,项目名称:xen-1,代码行数:25,代码来源:xc_flask.c


示例12: xc_hvm_track_dirty_vram

int xc_hvm_track_dirty_vram(
    xc_interface *xch, domid_t dom,
    uint64_t first_pfn, uint64_t nr,
    unsigned long *dirty_bitmap)
{
    DECLARE_HYPERCALL_BOUNCE(dirty_bitmap, (nr+7) / 8, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
    DECLARE_HYPERCALL_BUFFER(struct xen_hvm_track_dirty_vram, arg);
    int rc;

    arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg));
    if ( arg == NULL || xc_hypercall_bounce_pre(xch, dirty_bitmap) )
    {
        PERROR("Could not bounce memory for xc_hvm_track_dirty_vram hypercall");
        rc = -1;
        goto out;
    }

    arg->domid     = dom;
    arg->first_pfn = first_pfn;
    arg->nr        = nr;
    set_xen_guest_handle(arg->dirty_bitmap, dirty_bitmap);

    rc = xencall2(xch->xcall, __HYPERVISOR_hvm_op,
                  HVMOP_track_dirty_vram,
                  HYPERCALL_BUFFER_AS_ARG(arg));

out:
    xc_hypercall_buffer_free(xch, arg);
    xc_hypercall_bounce_post(xch, dirty_bitmap);
    return rc;
}
开发者ID:MrVan,项目名称:xen,代码行数:31,代码来源:xc_misc.c


示例13: xc_domain_getinfolist

int xc_domain_getinfolist(int xc_handle,
                          uint32_t first_domain,
                          unsigned int max_domains,
                          xc_domaininfo_t *info)
{
    int ret = 0;
    DECLARE_SYSCTL;

    if ( lock_pages(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
        return -1;

    sysctl.cmd = XEN_SYSCTL_getdomaininfolist;
    sysctl.u.getdomaininfolist.first_domain = first_domain;
    sysctl.u.getdomaininfolist.max_domains  = max_domains;
    set_xen_guest_handle(sysctl.u.getdomaininfolist.buffer, info);

    if ( xc_sysctl(xc_handle, &sysctl) < 0 )
        ret = -1;
    else
        ret = sysctl.u.getdomaininfolist.num_domains;

    unlock_pages(info, max_domains*sizeof(xc_domaininfo_t));

    return ret;
}
开发者ID:a2k2,项目名称:xen-unstable,代码行数:25,代码来源:xc_domain.c


示例14: xc_domain_memory_increase_reservation

int xc_domain_memory_increase_reservation(int xc_handle,
                                          uint32_t domid,
                                          unsigned long nr_extents,
                                          unsigned int extent_order,
                                          unsigned int mem_flags,
                                          xen_pfn_t *extent_start)
{
    int err;
    struct xen_memory_reservation reservation = {
        .nr_extents   = nr_extents,
        .extent_order = extent_order,
        .mem_flags    = mem_flags,
        .domid        = domid
    };

    /* may be NULL */
    set_xen_guest_handle(reservation.extent_start, extent_start);

    err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation);
    if ( err == nr_extents )
        return 0;

    if ( err >= 0 )
    {
        DPRINTF("Failed allocation for dom %d: "
                "%ld extents of order %d, mem_flags %x\n",
                domid, nr_extents, extent_order, mem_flags);
        errno = ENOMEM;
        err = -1;
    }

    return err;
}
开发者ID:a2k2,项目名称:xen-unstable,代码行数:33,代码来源:xc_domain.c


示例15: xc_readconsolering

int xc_readconsolering(int xc_handle,
                       char **pbuffer,
                       unsigned int *pnr_chars,
                       int clear, int incremental, uint32_t *pindex)
{
    int ret;
    DECLARE_SYSCTL;
    char *buffer = *pbuffer;
    unsigned int nr_chars = *pnr_chars;

    sysctl.cmd = XEN_SYSCTL_readconsole;
    set_xen_guest_handle(sysctl.u.readconsole.buffer, buffer);
    sysctl.u.readconsole.count = nr_chars;
    sysctl.u.readconsole.clear = clear;
    sysctl.u.readconsole.incremental = 0;
    if ( pindex )
    {
        sysctl.u.readconsole.index = *pindex;
        sysctl.u.readconsole.incremental = incremental;
    }

    if ( (ret = lock_pages(buffer, nr_chars)) != 0 )
        return ret;

    if ( (ret = do_sysctl(xc_handle, &sysctl)) == 0 )
    {
        *pnr_chars = sysctl.u.readconsole.count;
        if ( pindex )
            *pindex = sysctl.u.readconsole.index;
    }

    unlock_pages(buffer, nr_chars);

    return ret;
}
开发者ID:a2k2,项目名称:xen-unstable,代码行数:35,代码来源:xc_misc.c


示例16: xc_domain_decrease_reservation

int xc_domain_decrease_reservation(xc_interface *xch,
                                   uint32_t domid,
                                   unsigned long nr_extents,
                                   unsigned int extent_order,
                                   xen_pfn_t *extent_start)
{
    int err;
    DECLARE_HYPERCALL_BOUNCE(extent_start, nr_extents * sizeof(*extent_start), XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
    struct xen_memory_reservation reservation = {
        .nr_extents   = nr_extents,
        .extent_order = extent_order,
        .mem_flags    = 0,
        .domid        = domid
    };

    if ( extent_start == NULL )
    {
        DPRINTF("decrease_reservation extent_start is NULL!\n");
        errno = EINVAL;
        return -1;
    }

    if ( xc_hypercall_bounce_pre(xch, extent_start) )
    {
        PERROR("Could not bounce memory for XENMEM_decrease_reservation hypercall");
        return -1;
    }
    set_xen_guest_handle(reservation.extent_start, extent_start);

    err = do_memory_op(xch, XENMEM_decrease_reservation, &reservation, sizeof(reservation));

    xc_hypercall_bounce_post(xch, extent_start);

    return err;
}

int xc_domain_decrease_reservation_exact(xc_interface *xch,
                                         uint32_t domid,
                                         unsigned long nr_extents,
                                         unsigned int extent_order,
                                         xen_pfn_t *extent_start)
{
    int err;

    err = xc_domain_decrease_reservation(xch, domid, nr_extents,
                                         extent_order, extent_start);

    if ( err == nr_extents )
        return 0;

    if ( err >= 0 )
    {
        DPRINTF("Failed deallocation for dom %d: %ld extents of order %d\n",
                domid, nr_extents, extent_order);
        errno = EINVAL;
        err = -1;
    }

    return err;
}
开发者ID:HackLinux,项目名称:xen,代码行数:60,代码来源:xc_domain.c


示例17: xc_domain_hvm_getcontext_partial

/* Get just one element of the HVM guest context.
 * size must be >= HVM_SAVE_LENGTH(type) */
int xc_domain_hvm_getcontext_partial(xc_interface *xch,
                                     uint32_t domid,
                                     uint16_t typecode,
                                     uint16_t instance,
                                     void *ctxt_buf,
                                     uint32_t size)
{
    int ret;
    DECLARE_DOMCTL;
    DECLARE_HYPERCALL_BOUNCE(ctxt_buf, size, XC_HYPERCALL_BUFFER_BOUNCE_OUT);

    if ( !ctxt_buf || xc_hypercall_bounce_pre(xch, ctxt_buf) )
        return -1;

    domctl.cmd = XEN_DOMCTL_gethvmcontext_partial;
    domctl.domain = (domid_t) domid;
    domctl.u.hvmcontext_partial.type = typecode;
    domctl.u.hvmcontext_partial.instance = instance;
    set_xen_guest_handle(domctl.u.hvmcontext_partial.buffer, ctxt_buf);

    ret = do_domctl(xch, &domctl);

    if ( ctxt_buf )
        xc_hypercall_bounce_post(xch, ctxt_buf);

    return ret ? -1 : 0;
}
开发者ID:HackLinux,项目名称:xen,代码行数:29,代码来源:xc_domain.c


示例18: check_mfn

static int check_mfn(int nr)
{
	struct xen_memory_reservation reservation = {
		.extent_order = 0,
		.domid        = DOMID_SELF
	};

	if (likely(alloc_index >= nr))
		return 0;

	set_xen_guest_handle(reservation.extent_start, mfn_list + alloc_index);
	reservation.nr_extents = MAX_MFN_ALLOC - alloc_index;
	alloc_index += HYPERVISOR_memory_op(XENMEM_increase_reservation,
					    &reservation);

	return alloc_index >= nr ? 0 : -ENOMEM;
}

static inline void maybe_schedule_tx_action(void)
{
	smp_mb();
	if ((NR_PENDING_REQS < (MAX_PENDING_REQS/2)) &&
	    !list_empty(&net_schedule_list))
		tasklet_schedule(&net_tx_tasklet);
}
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:25,代码来源:netback.c


示例19: xc_vcpu_setaffinity

int xc_vcpu_setaffinity(int xc_handle,
                        uint32_t domid,
                        int vcpu,
                        uint64_t cpumap)
{
    DECLARE_DOMCTL;
    int ret = -1;
    uint8_t local[sizeof (cpumap)];

    domctl.cmd = XEN_DOMCTL_setvcpuaffinity;
    domctl.domain = (domid_t)domid;
    domctl.u.vcpuaffinity.vcpu    = vcpu;

    bitmap_64_to_byte(local, &cpumap, sizeof(cpumap) * 8);

    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);

    domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
    
    if ( lock_pages(local, sizeof(local)) != 0 )
    {
        PERROR("Could not lock memory for Xen hypercall");
        goto out;
    }

    ret = do_domctl(xc_handle, &domctl);

    unlock_pages(local, sizeof(local));

 out:
    return ret;
}
开发者ID:a2k2,项目名称:xen-unstable,代码行数:32,代码来源:xc_domain.c


示例20: xc_get_device_group

int xc_get_device_group(
    int xc_handle,
    uint32_t domid,
    uint32_t machine_bdf,
    uint32_t max_sdevs,
    uint32_t *num_sdevs,
    uint32_t *sdev_array)
{
    int rc;
    DECLARE_DOMCTL;

    domctl.cmd = XEN_DOMCTL_get_device_group;
    domctl.domain = (domid_t)domid;

    domctl.u.get_device_group.machine_bdf = machine_bdf;
    domctl.u.get_device_group.max_sdevs = max_sdevs;

    set_xen_guest_handle(domctl.u.get_device_group.sdev_array, sdev_array);

    if ( lock_pages(sdev_array, max_sdevs * sizeof(*sdev_array)) != 0 )
    {
        PERROR("Could not lock memory for xc_get_device_group\n");
        return -ENOMEM;
    }
    rc = do_domctl(xc_handle, &domctl);
    unlock_pages(sdev_array, max_sdevs * sizeof(*sdev_array));

    *num_sdevs = domctl.u.get_device_group.num_sdevs;
    return rc;
}
开发者ID:a2k2,项目名称:xen-unstable,代码行数:30,代码来源:xc_domain.c



注:本文中的set_xen_guest_handle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_xy函数代码示例发布时间:2022-05-30
下一篇:
C++ set_weight函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap