From: Ian Jackson Date: Wed, 2 Jul 2008 17:24:35 +0000 (+0100) Subject: qemu-xen: Fix PV segfault X-Git-Tag: xen-3.3.0-rc1~62 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=df9ad571ba52b72eda7ab70ba4846eadbd3f1b0d;p=qemu-xen-3.3-testing.git qemu-xen: Fix PV segfault Create a dummy CPU during PV machine initialization. This avoids NULL pointer accesses. Signed-off-by: Kevin Wolf --- diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c index 0fec0aae..e51addb3 100644 --- a/hw/xen_machine_pv.c +++ b/hw/xen_machine_pv.c @@ -45,13 +45,16 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size, { struct xenfb *xenfb; extern int domid; - + CPUState *env; #ifndef CONFIG_STUBDOM /* Initialize tapdisk client */ init_blktap(); #endif + /* Initialize a dummy CPU */ + env = cpu_init(NULL); + /* Connect to text console */ if (serial_hds[0]) { if (xencons_init(domid, serial_hds[0]) < 0) { diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c index 44bed2bf..6437c373 100644 --- a/i386-dm/helper2.c +++ b/i386-dm/helper2.c @@ -112,6 +112,10 @@ CPUX86State *cpu_x86_init(const char *cpu_model) return NULL; cpu_exec_init(env); + /* There is no shared_page for PV, we're done now */ + if (shared_page == NULL) + return env; + /* init various static tables */ if (!inited) { inited = 1;