From 83f3c251422b0724044f976a7ff26b2e8a47c374 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 7 Oct 2012 12:59:55 +0200 Subject: memory: add address_space_destroy() Since address spaces can be created dynamically by device hotplug, they can also be destroyed dynamically. Signed-off-by: Avi Kivity --- exec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'exec.c') diff --git a/exec.c b/exec.c index bfc4acc206..17e8ba21d4 100644 --- a/exec.c +++ b/exec.c @@ -3234,6 +3234,16 @@ void address_space_init_dispatch(AddressSpace *as) memory_listener_register(&d->listener, as); } +void address_space_destroy_dispatch(AddressSpace *as) +{ + AddressSpaceDispatch *d = as->dispatch; + + memory_listener_unregister(&d->listener); + destroy_l2_mapping(&d->phys_map, P_L2_LEVELS - 1); + g_free(d); + as->dispatch = NULL; +} + static void memory_map_init(void) { system_memory = g_malloc(sizeof(*system_memory)); -- cgit v1.2.3