qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix vmport segfault (v2)
Date: Thu, 17 Feb 2011 01:27:19 -0200	[thread overview]
Message-ID: <20110217032719.GA22836@amt.cnet> (raw)
In-Reply-To: <20110217025336.GA22404@amt.cnet>

Fix regression caused by qdev conversion.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

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);

  reply	other threads:[~2011-02-17  3:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-17  2:53 [Qemu-devel] [PATCH] Fix vmport segfault Marcelo Tosatti
2011-02-17  3:27 ` Marcelo Tosatti [this message]
2011-02-17 19:36   ` [Qemu-devel] Re: [PATCH] Fix vmport segfault (v2) Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110217032719.GA22836@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).