qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Anthony Liguori" <aliguori@us.ibm.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion
Date: Fri, 11 Jan 2013 15:04:54 +0000	[thread overview]
Message-ID: <50F02A16.7000603@citrix.com> (raw)
In-Reply-To: <1357895886-14283-7-git-send-email-stefanha@redhat.com>

From: Julien Grall <julien.grall@citrix.com>

The commit 258711 introduced MemoryRegion to replace ioport_region*
for ioport 80h and F0h.
A MemoryRegion needs to have both read and write callback otherwise a segfault
will occur when an access is made.

The previous behaviour of this both ioport is to return 0xffffffffffffffff.
So keep this behaviour.

Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/pc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/pc.c b/hw/pc.c
index df0c48e..90b1bf7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data,
 {
 }
 
+static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size)
+{
+    return 0xffffffffffffffffULL;
+}
+
 /* MSDOS compatibility mode FPU exception support */
 static qemu_irq ferr_irq;
 
@@ -123,6 +128,11 @@ static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data,
     qemu_irq_lower(ferr_irq);
 }
 
+static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size)
+{
+    return 0xffffffffffffffffULL;
+}
+
 /* TSC handling */
 uint64_t cpu_get_tsc(CPUX86State *env)
 {
@@ -960,6 +970,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
 
 static const MemoryRegionOps ioport80_io_ops = {
     .write = ioport80_write,
+    .read = ioport80_read,
     .endianness = DEVICE_NATIVE_ENDIAN,
     .impl = {
         .min_access_size = 1,
@@ -969,6 +980,7 @@ static const MemoryRegionOps ioport80_io_ops = {
 
 static const MemoryRegionOps ioportF0_io_ops = {
     .write = ioportF0_write,
+    .read = ioportF0_read,
     .endianness = DEVICE_NATIVE_ENDIAN,
     .impl = {
         .min_access_size = 1,
-- 1.8.0.2 

  parent reply	other threads:[~2013-01-11 15:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
2013-01-11  9:18 ` [Qemu-devel] [PATCH 1/6] readline: avoid memcpy() of overlapping regions Stefan Hajnoczi
2013-01-11  9:18 ` [Qemu-devel] [PATCH 2/6] configure: Fix comment (copy+paste bug) Stefan Hajnoczi
2013-01-11  9:18 ` [Qemu-devel] [PATCH 3/6] qga/channel-posix.c: Explicitly include string.h Stefan Hajnoczi
2013-01-11  9:18 ` [Qemu-devel] [PATCH 4/6] savevm: Remove MinGW specific code which is no longer needed Stefan Hajnoczi
2013-01-11  9:18 ` [Qemu-devel] [PATCH 5/6] Replace remaining gmtime, localtime by gmtime_r, localtime_r Stefan Hajnoczi
2013-01-11  9:18 ` [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion Stefan Hajnoczi
2013-01-11 11:50   ` Andreas Färber
2013-01-11 14:53     ` Julien Grall
2013-01-11 15:17       ` Andreas Färber
2013-01-11 15:04   ` Julien Grall [this message]
2013-01-11 16:46 ` [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Anthony Liguori

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=50F02A16.7000603@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).