aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-12-08 15:58:43 +0200
committerAvi Kivity <avi@redhat.com>2011-12-20 14:14:06 +0200
commit8ea9252abe08631611effb905fbb4a015ec1514c (patch)
treea2fd996baedd546dc76d687ae8f78b181e4405d8 /memory.c
parent62ec4832ea1093b20a8a0893a016a00ef8145496 (diff)
memory: add memory_region_is_ram()
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index a7e615ad15..4264b42222 100644
--- a/memory.c
+++ b/memory.c
@@ -832,6 +832,7 @@ void memory_region_init(MemoryRegion *mr,
mr->offset = 0;
mr->enabled = true;
mr->terminates = false;
+ mr->ram = false;
mr->readable = true;
mr->readonly = false;
mr->destructor = memory_region_destructor_none;
@@ -998,6 +999,7 @@ void memory_region_init_ram(MemoryRegion *mr,
uint64_t size)
{
memory_region_init(mr, name, size);
+ mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
mr->ram_addr = qemu_ram_alloc(dev, name, size, mr);
@@ -1011,6 +1013,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
void *ptr)
{
memory_region_init(mr, name, size);
+ mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram_from_ptr;
mr->ram_addr = qemu_ram_alloc_from_ptr(dev, name, size, ptr, mr);
@@ -1066,6 +1069,11 @@ uint64_t memory_region_size(MemoryRegion *mr)
return int128_get64(mr->size);
}
+bool memory_region_is_ram(MemoryRegion *mr)
+{
+ return mr->ram;
+}
+
void memory_region_set_offset(MemoryRegion *mr, target_phys_addr_t offset)
{
mr->offset = offset;