コード例 #1
0
ファイル: xen-common.c プロジェクト: AmesianX/panda
static int xen_init(MachineState *ms)
{
    PCMachineState *pcms = PC_MACHINE(ms);

    /* Disable ACPI build because Xen handles it */
    pcms->acpi_build_enabled = false;

    xen_xc = xc_interface_open(0, 0, 0);
    if (xen_xc == NULL) {
        xen_pv_printf(NULL, 0, "can't open xen interface\n");
        return -1;
    }
    xen_fmem = xenforeignmemory_open(0, 0);
    if (xen_fmem == NULL) {
        xen_pv_printf(NULL, 0, "can't open xen fmem interface\n");
        xc_interface_close(xen_xc);
        return -1;
    }
    qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);

    global_state_set_optional();
    savevm_skip_configuration();
    savevm_skip_section_footers();

    return 0;
}
コード例 #2
0
ファイル: xc_private.c プロジェクト: tklengyel/xen
struct xc_interface_core *xc_interface_open(xentoollog_logger *logger,
                                            xentoollog_logger *dombuild_logger,
                                            unsigned open_flags)
{
    struct xc_interface_core xch_buf = { 0 }, *xch = &xch_buf;

    xch->flags = open_flags;
    xch->dombuild_logger_file = 0;
    xc_clear_last_error(xch);

    xch->error_handler   = logger;           xch->error_handler_tofree   = 0;
    xch->dombuild_logger = dombuild_logger;  xch->dombuild_logger_tofree = 0;

    if (!xch->error_handler) {
        xch->error_handler = xch->error_handler_tofree =
            (xentoollog_logger*)
            xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0);
        if (!xch->error_handler)
            goto err;
    }

    xch = malloc(sizeof(*xch));
    if (!xch) {
        xch = &xch_buf;
        PERROR("Could not allocate new xc_interface struct");
        goto err;
    }
    *xch = xch_buf;

    if (open_flags & XC_OPENFLAG_DUMMY)
        return xch; /* We are done */

    xch->xcall = xencall_open(xch->error_handler,
        open_flags & XC_OPENFLAG_NON_REENTRANT ? XENCALL_OPENFLAG_NON_REENTRANT : 0U);
    if ( xch->xcall == NULL )
        goto err;

    xch->fmem = xenforeignmemory_open(xch->error_handler, 0);
    if ( xch->fmem == NULL )
        goto err;

    xch->dmod = xendevicemodel_open(xch->error_handler, 0);
    if ( xch->dmod == NULL )
        goto err;

    return xch;

 err:
    xenforeignmemory_close(xch->fmem);
    xencall_close(xch->xcall);
    xtl_logger_destroy(xch->error_handler_tofree);
    if (xch != &xch_buf) free(xch);
    return NULL;
}
コード例 #3
0
ファイル: xen-common.c プロジェクト: Icenowy/qemu
static int xen_init(MachineState *ms)
{
    xen_xc = xc_interface_open(0, 0, 0);
    if (xen_xc == NULL) {
        xen_pv_printf(NULL, 0, "can't open xen interface\n");
        return -1;
    }
    xen_fmem = xenforeignmemory_open(0, 0);
    if (xen_fmem == NULL) {
        xen_pv_printf(NULL, 0, "can't open xen fmem interface\n");
        xc_interface_close(xen_xc);
        return -1;
    }
    qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);

    global_state_set_optional();
    savevm_skip_configuration();
    savevm_skip_section_footers();

    return 0;
}
コード例 #4
0
ファイル: xen-common.c プロジェクト: 8tab/qemu
static int xen_init(MachineState *ms)
{
    xen_xc = xc_interface_open(0, 0, 0);
    if (xen_xc == NULL) {
        xen_pv_printf(NULL, 0, "can't open xen interface\n");
        return -1;
    }
    xen_fmem = xenforeignmemory_open(0, 0);
    if (xen_fmem == NULL) {
        xen_pv_printf(NULL, 0, "can't open xen fmem interface\n");
        xc_interface_close(xen_xc);
        return -1;
    }
    xen_dmod = xendevicemodel_open(0, 0);
    if (xen_dmod == NULL) {
        xen_pv_printf(NULL, 0, "can't open xen devicemodel interface\n");
        xenforeignmemory_close(xen_fmem);
        xc_interface_close(xen_xc);
        return -1;
    }
    qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
    return 0;
}