aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-02-08 21:16:05 +0200
committerAvi Kivity <avi@redhat.com>2012-02-29 13:44:42 +0200
commit4855d41a61301a04e54c074f1139040e4cb4dd00 (patch)
treedf2d18594696874c1ca3668a385ee0ddbf949f78
parent947f562c989d034c6a82920e11f4641f1681583d (diff)
memory: split memory listener for the two address spaces
The memory and I/O address spaces do different things, so split them into two memory listeners. Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--exec.c80
1 files changed, 66 insertions, 14 deletions
diff --git a/exec.c b/exec.c
index aa54eb1d7b..16973a675f 100644
--- a/exec.c
+++ b/exec.c
@@ -3491,24 +3491,13 @@ static void io_mem_init(void)
static void core_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
- if (section->address_space == get_system_memory()) {
- cpu_register_physical_memory_log(section, section->readonly);
- } else {
- iorange_init(&section->mr->iorange, &memory_region_iorange_ops,
- section->offset_within_address_space, section->size);
- ioport_register(&section->mr->iorange);
- }
+ cpu_register_physical_memory_log(section, section->readonly);
}
static void core_region_del(MemoryListener *listener,
MemoryRegionSection *section)
{
- if (section->address_space == get_system_memory()) {
- cpu_register_physical_memory_log(section, false);
- } else {
- isa_unassign_ioport(section->offset_within_address_space,
- section->size);
- }
+ cpu_register_physical_memory_log(section, false);
}
static void core_log_start(MemoryListener *listener,
@@ -3548,6 +3537,55 @@ static void core_eventfd_del(MemoryListener *listener,
{
}
+static void io_region_add(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+ iorange_init(&section->mr->iorange, &memory_region_iorange_ops,
+ section->offset_within_address_space, section->size);
+ ioport_register(&section->mr->iorange);
+}
+
+static void io_region_del(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+ isa_unassign_ioport(section->offset_within_address_space, section->size);
+}
+
+static void io_log_start(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
+static void io_log_stop(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
+static void io_log_sync(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
+static void io_log_global_start(MemoryListener *listener)
+{
+}
+
+static void io_log_global_stop(MemoryListener *listener)
+{
+}
+
+static void io_eventfd_add(MemoryListener *listener,
+ MemoryRegionSection *section,
+ bool match_data, uint64_t data, int fd)
+{
+}
+
+static void io_eventfd_del(MemoryListener *listener,
+ MemoryRegionSection *section,
+ bool match_data, uint64_t data, int fd)
+{
+}
+
static MemoryListener core_memory_listener = {
.region_add = core_region_add,
.region_del = core_region_del,
@@ -3561,6 +3599,19 @@ static MemoryListener core_memory_listener = {
.priority = 0,
};
+static MemoryListener io_memory_listener = {
+ .region_add = io_region_add,
+ .region_del = io_region_del,
+ .log_start = io_log_start,
+ .log_stop = io_log_stop,
+ .log_sync = io_log_sync,
+ .log_global_start = io_log_global_start,
+ .log_global_stop = io_log_global_stop,
+ .eventfd_add = io_eventfd_add,
+ .eventfd_del = io_eventfd_del,
+ .priority = 0,
+};
+
static void memory_map_init(void)
{
system_memory = g_malloc(sizeof(*system_memory));
@@ -3571,7 +3622,8 @@ static void memory_map_init(void)
memory_region_init(system_io, "io", 65536);
set_system_io_map(system_io);
- memory_listener_register(&core_memory_listener, NULL);
+ memory_listener_register(&core_memory_listener, system_memory);
+ memory_listener_register(&io_memory_listener, system_io);
}
MemoryRegion *get_system_memory(void)