Store MemoryRegion in RAMBlock
As a step in moving live migration from RAMBlocks to MemoryRegions,
store the MemoryRegion in a RAMBlock.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
diff --git a/cpu-all.h b/cpu-all.h
index 734833a..4acaa8b 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -476,6 +476,7 @@
#define RAM_PREALLOC_MASK (1 << 0)
typedef struct RAMBlock {
+ struct MemoryRegion *mr;
uint8_t *host;
ram_addr_t offset;
ram_addr_t length;
diff --git a/exec.c b/exec.c
index dffceb9..a4116d9 100644
--- a/exec.c
+++ b/exec.c
@@ -2793,6 +2793,7 @@
size = TARGET_PAGE_ALIGN(size);
new_block = g_malloc0(sizeof(*new_block));
+ new_block->mr = mr;
new_block->offset = find_ram_offset(size);
if (host) {
new_block->host = host;