qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix vmport segfault
@ 2011-02-17  2:53 Marcelo Tosatti
  2011-02-17  3:27 ` [Qemu-devel] [PATCH] Fix vmport segfault (v2) Marcelo Tosatti
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2011-02-17  2:53 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel


Fix regression caused by qdev conversion.

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

diff --git a/hw/vmport.c b/hw/vmport.c
index 292d78f..38ec259 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)
@@ -128,6 +128,7 @@ static int vmport_initfn(ISADevice *dev)
     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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH] Fix vmport segfault (v2)
  2011-02-17  2:53 [Qemu-devel] [PATCH] Fix vmport segfault Marcelo Tosatti
@ 2011-02-17  3:27 ` Marcelo Tosatti
  2011-02-17 19:36   ` [Qemu-devel] " Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2011-02-17  3:27 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: [PATCH] Fix vmport segfault (v2)
  2011-02-17  3:27 ` [Qemu-devel] [PATCH] Fix vmport segfault (v2) Marcelo Tosatti
@ 2011-02-17 19:36   ` Blue Swirl
  0 siblings, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2011-02-17 19:36 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: qemu-devel

Thanks, applied.

On Thu, Feb 17, 2011 at 5:27 AM, Marcelo Tosatti <mtosatti@redhat.com> wrote:
> 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);
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-17 19:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-17  2:53 [Qemu-devel] [PATCH] Fix vmport segfault Marcelo Tosatti
2011-02-17  3:27 ` [Qemu-devel] [PATCH] Fix vmport segfault (v2) Marcelo Tosatti
2011-02-17 19:36   ` [Qemu-devel] " Blue Swirl

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