summaryrefslogtreecommitdiff
path: root/include/exec
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2014-06-05 23:15:52 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2014-07-01 10:20:41 +0200
commitb4fefef9d52003b6d09866501275a9a57995c6b0 (patch)
tree6d9c67e1e535afd09aa7d37609f4871d0ce3ec8b /include/exec
parentb5c2c3d0c81ea97ac8443113b9a7a0c0ce25368e (diff)
downloadqemu-b4fefef9d52003b6d09866501275a9a57995c6b0.tar.gz
memory: MemoryRegion: QOMify
QOMify memory regions as an Object. The former init() and destroy() routines become instance_init() and instance_finalize() resp. memory_region_init() is re-implemented to be: object_initialize() + set fields memory_region_destroy() is re-implemented to call unparent(). Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> [Add newly-created MR as child, unparent on destruction. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/exec')
-rw-r--r--include/exec/memory.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 3d778d70f0..85b56e2e0c 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -32,10 +32,15 @@
#include "qemu/int128.h"
#include "qemu/notify.h"
#include "qapi/error.h"
+#include "qom/object.h"
#define MAX_PHYS_ADDR_SPACE_BITS 62
#define MAX_PHYS_ADDR (((hwaddr)1 << MAX_PHYS_ADDR_SPACE_BITS) - 1)
+#define TYPE_MEMORY_REGION "qemu:memory-region"
+#define MEMORY_REGION(obj) \
+ OBJECT_CHECK(MemoryRegion, (obj), TYPE_MEMORY_REGION)
+
typedef struct MemoryRegionOps MemoryRegionOps;
typedef struct MemoryRegionMmio MemoryRegionMmio;
@@ -131,6 +136,7 @@ typedef struct CoalescedMemoryRange CoalescedMemoryRange;
typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
struct MemoryRegion {
+ Object parent_obj;
/* All fields are private - violators will be prosecuted */
const MemoryRegionOps *ops;
const MemoryRegionIOMMUOps *iommu_ops;