static CharDriverState *text_console_init(ChardevVC *vc)

{

    CharDriverState *chr;

    QemuConsole *s;

    unsigned width = 0;

    unsigned height = 0;



    chr = g_malloc0(sizeof(CharDriverState));



    if (vc->has_width) {

        width = vc->width;

    } else if (vc->has_cols) {

        width = vc->cols * FONT_WIDTH;

    }



    if (vc->has_height) {

        height = vc->height;

    } else if (vc->has_rows) {

        height = vc->rows * FONT_HEIGHT;

    }



    trace_console_txt_new(width, height);

    if (width == 0 || height == 0) {

        s = new_console(NULL, TEXT_CONSOLE);

    } else {

        s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);

        s->surface = qemu_create_displaysurface(width, height);

    }



    if (!s) {

        g_free(chr);

        return NULL;

    }



    s->chr = chr;

    chr->opaque = s;

    chr->chr_set_echo = text_console_set_echo;

    /* console/chardev init sometimes completes elsewhere in a 2nd

     * stage, so defer OPENED events until they are fully initialized

     */

    chr->explicit_be_open = true;



    if (display_state) {

        text_console_do_init(chr, display_state);

    }

    return chr;

}

static CharDriverState *text_console_init(ChardevVC *vc)

{

    CharDriverState *chr;

    QemuConsole *s;

    unsigned width = 0;

    unsigned height = 0;



    chr = g_malloc0(sizeof(CharDriverState));



    if (vc->has_width) {

        width = vc->width;

    } else if (vc->has_cols) {

        width = vc->cols * FONT_WIDTH;

    }



    if (vc->has_height) {

        height = vc->height;

    } else if (vc->has_rows) {

        height = vc->rows * FONT_HEIGHT;

    }



    trace_console_txt_new(width, height);

    if (width == 0 || height == 0) {

        s = new_console(NULL, TEXT_CONSOLE);

    } else {

        s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);

        s->surface = qemu_create_displaysurface(width, height);

    }



    if (!s) {

        g_free(chr);

        return NULL;

    }



    s->chr = chr;

    chr->opaque = s;

    chr->chr_set_echo = text_console_set_echo;

    





    chr->explicit_be_open = true;



    if (display_state) {

        text_console_do_init(chr, display_state);

    }

    return chr;

}

        s = new_console(NULL, TEXT_CONSOLE);         s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);
static CharDriverState *FUNC_0(ChardevVC *vc)

{

    CharDriverState *chr;

    QemuConsole *s;

    unsigned VAR_0 = 0;

    unsigned VAR_1 = 0;



    chr = g_malloc0(sizeof(CharDriverState));



    if (vc->has_width) {

        VAR_0 = vc->VAR_0;

    } else if (vc->has_cols) {

        VAR_0 = vc->cols * FONT_WIDTH;

    }



    if (vc->has_height) {

        VAR_1 = vc->VAR_1;

    } else if (vc->has_rows) {

        VAR_1 = vc->rows * FONT_HEIGHT;

    }



    trace_console_txt_new(VAR_0, VAR_1);

    if (VAR_0 == 0 || VAR_1 == 0) {

        s = new_console(NULL, TEXT_CONSOLE);

    } else {

        s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);

        s->surface = qemu_create_displaysurface(VAR_0, VAR_1);

    }



    if (!s) {

        g_free(chr);

        return NULL;

    }



    s->chr = chr;

    chr->opaque = s;

    chr->chr_set_echo = text_console_set_echo;

    





    chr->explicit_be_open = true;



    if (display_state) {

        text_console_do_init(chr, display_state);

    }

    return chr;

}

static CharDriverState *FUNC_0(ChardevVC *vc)
{ CharDriverState *chr; QemuConsole *s; unsigned VAR_0 = 0; unsigned VAR_1 = 0; chr = g_malloc0(sizeof(CharDriverState)); if (vc->has_width) { VAR_0 = vc->VAR_0; } else if (vc->has_cols) { VAR_0 = vc->cols * FONT_WIDTH; } if (vc->has_height) { VAR_1 = vc->VAR_1; } else if (vc->has_rows) { VAR_1 = vc->rows * FONT_HEIGHT; } trace_console_txt_new(VAR_0, VAR_1); if (VAR_0 == 0 || VAR_1 == 0) { s = new_console(NULL, TEXT_CONSOLE); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE); s->surface = qemu_create_displaysurface(VAR_0, VAR_1); } if (!s) { g_free(chr); return NULL; } s->chr = chr; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; chr->explicit_be_open = true; if (display_state) { text_console_do_init(chr, display_state); } return chr; }