qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ioport/memory: check that both .read and .write callbacks are defined
@ 2013-06-05 13:42 Hervé Poussineau
  2013-06-08  7:51 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
  0 siblings, 1 reply; 7+ messages in thread
From: Hervé Poussineau @ 2013-06-05 13:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Hervé Poussineau

If that's not the case, QEMU will may during execution.
This has recently been fixed for:
- acpi (2d3b989529727ccace243b953a181fbae04a30d1)
- kvmapic (0c1cd0ae2a4faabeb948b9a07ea1696e853de174)
- xhci (6d3bc22e31bcee74dc1e05a5370cabb33b7c3fda)

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
I started all current QEMU system emulations with
qemu-system-{arch} -M {machine} , and none broke on these
additionnal asserts.
However, lots of them exited for other reasons, like not having the
right number of CPUs, no -kernel argument, or fetching invalid
instructions from RAM.

 ioport.c |    1 +
 memory.c |    2 ++
 2 files changed, 3 insertions(+)

diff --git a/ioport.c b/ioport.c
index a0ac2a0..8dd9d50 100644
--- a/ioport.c
+++ b/ioport.c
@@ -337,6 +337,7 @@ void portio_list_init(PortioList *piolist,
     unsigned n = 0;
 
     while (callbacks[n].size) {
+        assert(callbacks[n].read && callbacks[n].write);
         ++n;
     }
 
diff --git a/memory.c b/memory.c
index 5cb8f4a..654d1ce 100644
--- a/memory.c
+++ b/memory.c
@@ -1008,6 +1008,8 @@ void memory_region_init_io(MemoryRegion *mr,
                            uint64_t size)
 {
     memory_region_init(mr, name, size);
+    assert(ops->read || ops->old_mmio.read);
+    assert(ops->write || ops->old_mmio.write);
     mr->ops = ops;
     mr->opaque = opaque;
     mr->terminates = true;
-- 
1.7.10.4

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

end of thread, other threads:[~2013-06-10 22:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 13:42 [Qemu-devel] [PATCH] ioport/memory: check that both .read and .write callbacks are defined Hervé Poussineau
2013-06-08  7:51 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-10  5:27   ` Gerd Hoffmann
2013-06-10  9:14     ` Peter Crosthwaite
2013-06-10 17:06       ` Michael S. Tsirkin
2013-06-10 22:30         ` Peter Crosthwaite
2013-06-10 22:53           ` Edgar E. Iglesias

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