[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] ioport/memory: check that both .read and .write cal
From: |
Hervé Poussineau |
Subject: |
[Qemu-devel] [PATCH] ioport/memory: check that both .read and .write callbacks are defined |
Date: |
Wed, 5 Jun 2013 21:42:28 +0800 |
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 <address@hidden>
---
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
- [Qemu-devel] [PATCH] ioport/memory: check that both .read and .write callbacks are defined,
Hervé Poussineau <=