From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51145 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pq9eU-0004g7-5G for qemu-devel@nongnu.org; Thu, 17 Feb 2011 14:39:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pq9eR-0006Uk-6I for qemu-devel@nongnu.org; Thu, 17 Feb 2011 14:36:32 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:57328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pq9eR-0006Ua-3w for qemu-devel@nongnu.org; Thu, 17 Feb 2011 14:36:31 -0500 Received: by gye5 with SMTP id 5so1392982gye.4 for ; Thu, 17 Feb 2011 11:36:30 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20110217032719.GA22836@amt.cnet> References: <20110217025336.GA22404@amt.cnet> <20110217032719.GA22836@amt.cnet> From: Blue Swirl Date: Thu, 17 Feb 2011 21:36:09 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] Fix vmport segfault (v2) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: qemu-devel@nongnu.org Thanks, applied. On Thu, Feb 17, 2011 at 5:27 AM, Marcelo Tosatti wrot= e: > Fix regression caused by qdev conversion. > > Signed-off-by: Marcelo Tosatti > > v2: pass correct register_ioport parameter > > diff --git a/hw/vmport.c b/hw/vmport.c > index 292d78f..19010e4 100644 > --- a/hw/vmport.c > +++ b/hw/vmport.c > @@ -43,15 +43,15 @@ typedef struct _VMPortState > =C2=A0 =C2=A0 void *opaque[VMPORT_ENTRIES]; > =C2=A0} VMPortState; > > -static VMPortState port_state; > +static VMPortState *port_state; > > =C2=A0void vmport_register(unsigned char command, IOPortReadFunc *func, v= oid *opaque) > =C2=A0{ > =C2=A0 =C2=A0 if (command >=3D VMPORT_ENTRIES) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; > > - =C2=A0 =C2=A0port_state.func[command] =3D func; > - =C2=A0 =C2=A0port_state.opaque[command] =3D opaque; > + =C2=A0 =C2=A0port_state->func[command] =3D func; > + =C2=A0 =C2=A0port_state->opaque[command] =3D opaque; > =C2=A0} > > =C2=A0static uint32_t vmport_ioport_read(void *opaque, uint32_t addr) > @@ -125,9 +125,10 @@ static int vmport_initfn(ISADevice *dev) > =C2=A0{ > =C2=A0 =C2=A0 VMPortState *s =3D DO_UPCAST(VMPortState, dev, dev); > > - =C2=A0 =C2=A0register_ioport_read(0x5658, 1, 4, vmport_ioport_read, &s)= ; > - =C2=A0 =C2=A0register_ioport_write(0x5658, 1, 4, vmport_ioport_write, &= s); > + =C2=A0 =C2=A0register_ioport_read(0x5658, 1, 4, vmport_ioport_read, s); > + =C2=A0 =C2=A0register_ioport_write(0x5658, 1, 4, vmport_ioport_write, s= ); > =C2=A0 =C2=A0 isa_init_ioport(dev, 0x5658); > + =C2=A0 =C2=A0port_state =3D s; > =C2=A0 =C2=A0 /* Register some generic port commands */ > =C2=A0 =C2=A0 vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_versi= on, NULL); > =C2=A0 =C2=A0 vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size,= NULL); >