memory: add backward compatibility for old mmio registration
This eases the transition to the new API.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/memory.c b/memory.c
index 5f2c9ef..7dd7cac 100644
--- a/memory.c
+++ b/memory.c
@@ -14,6 +14,7 @@
#include "memory.h"
#include "exec-memory.h"
#include "ioport.h"
+#include "bitops.h"
#include <assert.h>
typedef struct AddrRange AddrRange;
@@ -506,6 +507,10 @@
return -1U; /* FIXME: better signalling */
}
+ if (!mr->ops->read) {
+ return mr->ops->old_mmio.read[bitops_ffsl(size)](mr->opaque, addr);
+ }
+
/* FIXME: support unaligned access */
access_size_min = mr->ops->impl.min_access_size;
@@ -542,6 +547,11 @@
return; /* FIXME: better signalling */
}
+ if (!mr->ops->write) {
+ mr->ops->old_mmio.write[bitops_ffsl(size)](mr->opaque, addr, data);
+ return;
+ }
+
/* FIXME: support unaligned access */
access_size_min = mr->ops->impl.min_access_size;