aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-02-08 21:36:02 +0200
committerAvi Kivity <avi@redhat.com>2012-02-29 13:44:42 +0200
commit50c1e1491e1981ecba14a477897681d8d0602500 (patch)
treeb978d61c3b39d9ed2f811df18f13fad93097d372 /exec.c
parent4855d41a61301a04e54c074f1139040e4cb4dd00 (diff)
memory: support stateless memory listeners
Current memory listeners are incremental; that is, they are expected to maintain their own state, and receive callbacks for changes to that state. This patch adds support for stateless listeners; these work by receiving a ->begin() callback (which tells them that new state is coming), a sequence of ->region_add() and ->region_nop() callbacks, and then a ->commit() callback which signifies the end of the new state. They should ignore ->region_del() callbacks. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 16973a675f..6726afd347 100644
--- a/exec.c
+++ b/exec.c
@@ -3488,6 +3488,14 @@ static void io_mem_init(void)
"watch", UINT64_MAX);
}
+static void core_begin(MemoryListener *listener)
+{
+}
+
+static void core_commit(MemoryListener *listener)
+{
+}
+
static void core_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3500,6 +3508,11 @@ static void core_region_del(MemoryListener *listener,
cpu_register_physical_memory_log(section, false);
}
+static void core_region_nop(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
static void core_log_start(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3537,6 +3550,14 @@ static void core_eventfd_del(MemoryListener *listener,
{
}
+static void io_begin(MemoryListener *listener)
+{
+}
+
+static void io_commit(MemoryListener *listener)
+{
+}
+
static void io_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3551,6 +3572,11 @@ static void io_region_del(MemoryListener *listener,
isa_unassign_ioport(section->offset_within_address_space, section->size);
}
+static void io_region_nop(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
static void io_log_start(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3587,8 +3613,11 @@ static void io_eventfd_del(MemoryListener *listener,
}
static MemoryListener core_memory_listener = {
+ .begin = core_begin,
+ .commit = core_commit,
.region_add = core_region_add,
.region_del = core_region_del,
+ .region_nop = core_region_nop,
.log_start = core_log_start,
.log_stop = core_log_stop,
.log_sync = core_log_sync,
@@ -3600,8 +3629,11 @@ static MemoryListener core_memory_listener = {
};
static MemoryListener io_memory_listener = {
+ .begin = io_begin,
+ .commit = io_commit,
.region_add = io_region_add,
.region_del = io_region_del,
+ .region_nop = io_region_nop,
.log_start = io_log_start,
.log_stop = io_log_stop,
.log_sync = io_log_sync,