@@ -1514,6 +1514,21 @@ void memory_listener_unregister(MemoryListener *listener)
QTAILQ_REMOVE(&memory_listeners, listener, link);
}
+void memory_listener_default_global(MemoryListener *listener)
+{
+}
+
+void memory_listener_default_section(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
+void memory_listener_default_eventfd(MemoryListener *listener,
+ MemoryRegionSection *section,
+ bool match_data, uint64_t data, EventNotifier *e)
+{
+}
+
void address_space_init(AddressSpace *as, MemoryRegion *root)
{
memory_region_transaction_begin();
@@ -223,6 +223,27 @@ struct MemoryListener {
QTAILQ_ENTRY(MemoryListener) link;
};
+#define MEMORY_LISTENER_DEFAULT_OPS \
+ .begin = memory_listener_default_global, \
+ .commit = memory_listener_default_global, \
+ .region_add = memory_listener_default_section, \
+ .region_del = memory_listener_default_section, \
+ .region_nop = memory_listener_default_section, \
+ .log_start = memory_listener_default_section, \
+ .log_stop = memory_listener_default_section, \
+ .log_sync = memory_listener_default_section, \
+ .log_global_start = memory_listener_default_global, \
+ .log_global_stop = memory_listener_default_global, \
+ .eventfd_add = memory_listener_default_eventfd, \
+ .eventfd_del = memory_listener_default_eventfd \
+
+void memory_listener_default_global(MemoryListener *listener);
+void memory_listener_default_section(MemoryListener *listener,
+ MemoryRegionSection *section);
+void memory_listener_default_eventfd(MemoryListener *listener,
+ MemoryRegionSection *section,
+ bool match_data, uint64_t data, EventNotifier *e);
+
/**
* memory_region_init: Initialize a memory region
*
Many listeners don't need to respond to all MemoryListener callbacks; provide suitable defaults instead. Signed-off-by: Avi Kivity <avi@redhat.com> --- memory.c | 15 +++++++++++++++ memory.h | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+)