From patchwork Thu Feb 17 03:27:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 83425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3B0D2B70FC for ; Thu, 17 Feb 2011 14:31:35 +1100 (EST) Received: from localhost ([127.0.0.1]:44827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ppuaa-00030j-4A for incoming@patchwork.ozlabs.org; Wed, 16 Feb 2011 22:31:32 -0500 Received: from [140.186.70.92] (port=35845 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpuXn-0001uz-TW for qemu-devel@nongnu.org; Wed, 16 Feb 2011 22:28:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpuXl-0004OY-NB for qemu-devel@nongnu.org; Wed, 16 Feb 2011 22:28:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpuXl-0004OH-Fz for qemu-devel@nongnu.org; Wed, 16 Feb 2011 22:28:37 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1H3SY5j027053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 16 Feb 2011 22:28:34 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1H3SY04027120; Wed, 16 Feb 2011 22:28:34 -0500 Received: from amt.cnet (vpn-11-176.rdu.redhat.com [10.11.11.176]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p1H3SXLd000445; Wed, 16 Feb 2011 22:28:33 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 2C3CE68A00E; Thu, 17 Feb 2011 01:27:20 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p1H3RJdS022848; Thu, 17 Feb 2011 01:27:19 -0200 Date: Thu, 17 Feb 2011 01:27:19 -0200 From: Marcelo Tosatti To: Blue Swirl Message-ID: <20110217032719.GA22836@amt.cnet> References: <20110217025336.GA22404@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110217025336.GA22404@amt.cnet> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] Fix vmport segfault (v2) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 void *opaque[VMPORT_ENTRIES]; } VMPortState; -static VMPortState port_state; +static VMPortState *port_state; void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque) { if (command >= VMPORT_ENTRIES) return; - port_state.func[command] = func; - port_state.opaque[command] = opaque; + port_state->func[command] = func; + port_state->opaque[command] = opaque; } static uint32_t vmport_ioport_read(void *opaque, uint32_t addr) @@ -125,9 +125,10 @@ static int vmport_initfn(ISADevice *dev) { VMPortState *s = DO_UPCAST(VMPortState, dev, dev); - register_ioport_read(0x5658, 1, 4, vmport_ioport_read, &s); - register_ioport_write(0x5658, 1, 4, vmport_ioport_write, &s); + register_ioport_read(0x5658, 1, 4, vmport_ioport_read, s); + register_ioport_write(0x5658, 1, 4, vmport_ioport_write, s); isa_init_ioport(dev, 0x5658); + port_state = s; /* Register some generic port commands */ vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL); vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);