From 50c1e1491e1981ecba14a477897681d8d0602500 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 8 Feb 2012 21:36:02 +0200 Subject: 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 --- xen-all.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'xen-all.c') diff --git a/xen-all.c b/xen-all.c index a58a397ca4..6a11342665 100644 --- a/xen-all.c +++ b/xen-all.c @@ -394,6 +394,14 @@ static void xen_set_memory(struct MemoryListener *listener, } } +static void xen_begin(MemoryListener *listener) +{ +} + +static void xen_commit(MemoryListener *listener) +{ +} + static void xen_region_add(MemoryListener *listener, MemoryRegionSection *section) { @@ -406,6 +414,11 @@ static void xen_region_del(MemoryListener *listener, xen_set_memory(listener, section, false); } +static void xen_region_nop(MemoryListener *listener, + MemoryRegionSection *section) +{ +} + static void xen_sync_dirty_bitmap(XenIOState *state, target_phys_addr_t start_addr, ram_addr_t size) @@ -500,8 +513,11 @@ static void xen_eventfd_del(MemoryListener *listener, } static MemoryListener xen_memory_listener = { + .begin = xen_begin, + .commit = xen_commit, .region_add = xen_region_add, .region_del = xen_region_del, + .region_nop = xen_region_nop, .log_start = xen_log_start, .log_stop = xen_log_stop, .log_sync = xen_log_sync, -- cgit v1.2.1