mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
4855d41a61
commit
50c1e1491e
6 changed files with 88 additions and 0 deletions
32
exec.c
32
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue