void xen_init_display(int domid)

{

    struct XenDevice *xfb, *xin;

    struct XenFB *fb;

    struct XenInput *in;

    int i = 0;



wait_more:

    i++;

    main_loop_wait(true);

    xfb = xen_be_find_xendev("vfb", domid, 0);

    xin = xen_be_find_xendev("vkbd", domid, 0);

    if (!xfb || !xin) {

        if (i < 256) {

            usleep(10000);

            goto wait_more;

        }

        xen_be_printf(NULL, 1, "displaystate setup failed\n");

        return;

    }



    /* vfb */

    fb = container_of(xfb, struct XenFB, c.xendev);

    fb->c.con = graphic_console_init(xenfb_update,

                                     xenfb_invalidate,

                                     NULL,

                                     NULL,

                                     fb);

    fb->have_console = 1;



    /* vkbd */

    in = container_of(xin, struct XenInput, c.xendev);

    in->c.con = fb->c.con;



    /* retry ->init() */

    xen_be_check_state(xin);

    xen_be_check_state(xfb);

}

void xen_init_display(int domid)

{

    struct XenDevice *xfb, *xin;

    struct XenFB *fb;

    struct XenInput *in;

    int i = 0;



wait_more:

    i++;

    main_loop_wait(true);

    xfb = xen_be_find_xendev("vfb", domid, 0);

    xin = xen_be_find_xendev("vkbd", domid, 0);

    if (!xfb || !xin) {

        if (i < 256) {

            usleep(10000);

            goto wait_more;

        }

        xen_be_printf(NULL, 1, "displaystate setup failed\n");

        return;

    }



    

    fb = container_of(xfb, struct XenFB, c.xendev);

    fb->c.con = graphic_console_init(xenfb_update,

                                     xenfb_invalidate,

                                     NULL,

                                     NULL,

                                     fb);

    fb->have_console = 1;



    

    in = container_of(xin, struct XenInput, c.xendev);

    in->c.con = fb->c.con;



    

    xen_be_check_state(xin);

    xen_be_check_state(xfb);

}

void FUNC_0(int VAR_0)

{

    struct XenDevice *VAR_1, *VAR_2;

    struct XenFB *VAR_3;

    struct XenInput *VAR_4;

    int VAR_5 = 0;



wait_more:

    VAR_5++;

    main_loop_wait(true);

    VAR_1 = xen_be_find_xendev("vfb", VAR_0, 0);

    VAR_2 = xen_be_find_xendev("vkbd", VAR_0, 0);

    if (!VAR_1 || !VAR_2) {

        if (VAR_5 < 256) {

            usleep(10000);

            goto wait_more;

        }

        xen_be_printf(NULL, 1, "displaystate setup failed\n");

        return;

    }



    

    VAR_3 = container_of(VAR_1, struct XenFB, c.xendev);

    VAR_3->c.con = graphic_console_init(xenfb_update,

                                     xenfb_invalidate,

                                     NULL,

                                     NULL,

                                     VAR_3);

    VAR_3->have_console = 1;



    

    VAR_4 = container_of(VAR_2, struct XenInput, c.xendev);

    VAR_4->c.con = VAR_3->c.con;



    

    xen_be_check_state(VAR_2);

    xen_be_check_state(VAR_1);

}

void FUNC_0(int VAR_0)
{ struct XenDevice *VAR_1, *VAR_2; struct XenFB *VAR_3; struct XenInput *VAR_4; int VAR_5 = 0; wait_more:
VAR_5++; main_loop_wait(true); VAR_1 = xen_be_find_xendev("vfb", VAR_0, 0); VAR_2 = xen_be_find_xendev("vkbd", VAR_0, 0); if (!VAR_1 || !VAR_2) { if (VAR_5 < 256) { usleep(10000); goto wait_more; } xen_be_printf(NULL, 1, "displaystate setup failed\n"); return; } VAR_3 = container_of(VAR_1, struct XenFB, c.xendev); VAR_3->c.con = graphic_console_init(xenfb_update,
xenfb_invalidate,
NULL,
NULL,
VAR_3); VAR_3->have_console = 1; VAR_4 = container_of(VAR_2, struct XenInput, c.xendev); VAR_4->c.con = VAR_3->c.con; xen_be_check_state(VAR_2); xen_be_check_state(VAR_1); }