mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-01 23:11:02 +00:00
memory: Move AddressSpaceDispatch from AddressSpace to FlatView
As we are going to share FlatView's between AddressSpace's, and AddressSpaceDispatch is a structure to perform quick lookup in FlatView, this moves ASD to FlatView. After previosly open coded ASD rendering, we can also remove as->next_dispatch as the new FlatView pointer is stored on a stack and set to an AS atomically. flatview_destroy() is executed under RCU instead of address_space_dispatch_free() now. This makes mem_begin/mem_commit to work with ASD and mem_add with FV as later on mem_add will be taking FV as an argument anyway. This should cause no behavioural change. Backports commit 66a6df1dc6d5b28cc3e65db0d71683fbdddc6b62 from qemu
This commit is contained in:
parent
cc8fd90124
commit
1591f208c0
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_aarch64
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_aarch64
|
||||
#define address_space_destroy address_space_destroy_aarch64
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_aarch64
|
||||
#define address_space_dispatch_free address_space_dispatch_free_aarch64
|
||||
#define address_space_get_flatview address_space_get_flatview_aarch64
|
||||
#define address_space_init address_space_init_aarch64
|
||||
#define address_space_init_dispatch address_space_init_dispatch_aarch64
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_aarch64
|
||||
#define address_space_stw_le address_space_stw_le_aarch64
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_aarch64
|
||||
#define address_space_to_dispatch address_space_to_dispatch_aarch64
|
||||
#define address_space_translate address_space_translate_aarch64
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_aarch64
|
||||
#define address_space_translate_internal address_space_translate_internal_aarch64
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_aarch64
|
||||
#define flatview_ref flatview_ref_aarch64
|
||||
#define flatview_simplify flatview_simplify_aarch64
|
||||
#define flatview_to_dispatch flatview_to_dispatch_aarch64
|
||||
#define flatview_unref flatview_unref_aarch64
|
||||
#define float128ToCommonNaN float128ToCommonNaN_aarch64
|
||||
#define float128_add float128_add_aarch64
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_aarch64
|
||||
#define phys_map_node_reserve phys_map_node_reserve_aarch64
|
||||
#define phys_mem_alloc phys_mem_alloc_aarch64
|
||||
#define phys_mem_clean phys_mem_clean_aarch64
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_aarch64
|
||||
#define phys_page_compact phys_page_compact_aarch64
|
||||
#define phys_page_compact_all phys_page_compact_all_aarch64
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_aarch64eb
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_aarch64eb
|
||||
#define address_space_destroy address_space_destroy_aarch64eb
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_aarch64eb
|
||||
#define address_space_dispatch_free address_space_dispatch_free_aarch64eb
|
||||
#define address_space_get_flatview address_space_get_flatview_aarch64eb
|
||||
#define address_space_init address_space_init_aarch64eb
|
||||
#define address_space_init_dispatch address_space_init_dispatch_aarch64eb
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_aarch64eb
|
||||
#define address_space_stw_le address_space_stw_le_aarch64eb
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_aarch64eb
|
||||
#define address_space_to_dispatch address_space_to_dispatch_aarch64eb
|
||||
#define address_space_translate address_space_translate_aarch64eb
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_aarch64eb
|
||||
#define address_space_translate_internal address_space_translate_internal_aarch64eb
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_aarch64eb
|
||||
#define flatview_ref flatview_ref_aarch64eb
|
||||
#define flatview_simplify flatview_simplify_aarch64eb
|
||||
#define flatview_to_dispatch flatview_to_dispatch_aarch64eb
|
||||
#define flatview_unref flatview_unref_aarch64eb
|
||||
#define float128ToCommonNaN float128ToCommonNaN_aarch64eb
|
||||
#define float128_add float128_add_aarch64eb
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_aarch64eb
|
||||
#define phys_map_node_reserve phys_map_node_reserve_aarch64eb
|
||||
#define phys_mem_alloc phys_mem_alloc_aarch64eb
|
||||
#define phys_mem_clean phys_mem_clean_aarch64eb
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_aarch64eb
|
||||
#define phys_page_compact phys_page_compact_aarch64eb
|
||||
#define phys_page_compact_all phys_page_compact_all_aarch64eb
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_arm
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_arm
|
||||
#define address_space_destroy address_space_destroy_arm
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_arm
|
||||
#define address_space_dispatch_free address_space_dispatch_free_arm
|
||||
#define address_space_get_flatview address_space_get_flatview_arm
|
||||
#define address_space_init address_space_init_arm
|
||||
#define address_space_init_dispatch address_space_init_dispatch_arm
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_arm
|
||||
#define address_space_stw_le address_space_stw_le_arm
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_arm
|
||||
#define address_space_to_dispatch address_space_to_dispatch_arm
|
||||
#define address_space_translate address_space_translate_arm
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_arm
|
||||
#define address_space_translate_internal address_space_translate_internal_arm
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_arm
|
||||
#define flatview_ref flatview_ref_arm
|
||||
#define flatview_simplify flatview_simplify_arm
|
||||
#define flatview_to_dispatch flatview_to_dispatch_arm
|
||||
#define flatview_unref flatview_unref_arm
|
||||
#define float128ToCommonNaN float128ToCommonNaN_arm
|
||||
#define float128_add float128_add_arm
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_arm
|
||||
#define phys_map_node_reserve phys_map_node_reserve_arm
|
||||
#define phys_mem_alloc phys_mem_alloc_arm
|
||||
#define phys_mem_clean phys_mem_clean_arm
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_arm
|
||||
#define phys_page_compact phys_page_compact_arm
|
||||
#define phys_page_compact_all phys_page_compact_all_arm
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_armeb
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_armeb
|
||||
#define address_space_destroy address_space_destroy_armeb
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_armeb
|
||||
#define address_space_dispatch_free address_space_dispatch_free_armeb
|
||||
#define address_space_get_flatview address_space_get_flatview_armeb
|
||||
#define address_space_init address_space_init_armeb
|
||||
#define address_space_init_dispatch address_space_init_dispatch_armeb
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_armeb
|
||||
#define address_space_stw_le address_space_stw_le_armeb
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_armeb
|
||||
#define address_space_to_dispatch address_space_to_dispatch_armeb
|
||||
#define address_space_translate address_space_translate_armeb
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_armeb
|
||||
#define address_space_translate_internal address_space_translate_internal_armeb
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_armeb
|
||||
#define flatview_ref flatview_ref_armeb
|
||||
#define flatview_simplify flatview_simplify_armeb
|
||||
#define flatview_to_dispatch flatview_to_dispatch_armeb
|
||||
#define flatview_unref flatview_unref_armeb
|
||||
#define float128ToCommonNaN float128ToCommonNaN_armeb
|
||||
#define float128_add float128_add_armeb
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_armeb
|
||||
#define phys_map_node_reserve phys_map_node_reserve_armeb
|
||||
#define phys_mem_alloc phys_mem_alloc_armeb
|
||||
#define phys_mem_clean phys_mem_clean_armeb
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_armeb
|
||||
#define phys_page_compact phys_page_compact_armeb
|
||||
#define phys_page_compact_all phys_page_compact_all_armeb
|
||||
|
|
57
qemu/exec.c
57
qemu/exec.c
|
@ -408,7 +408,7 @@ static MemoryRegionSection address_space_do_translate(AddressSpace *as,
|
|||
|
||||
for (;;) {
|
||||
// Unicorn: atomic_read used instead of atomic_rcu_read
|
||||
AddressSpaceDispatch *d = atomic_read(&as->dispatch);
|
||||
AddressSpaceDispatch *d = address_space_to_dispatch(as);
|
||||
section = address_space_translate_internal(d, addr, &addr, plen, is_mmio);
|
||||
mr = section->mr;
|
||||
|
||||
|
@ -968,7 +968,7 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu,
|
|||
AddressSpaceDispatch *d;
|
||||
|
||||
// Unicorn: uses atomic_read instead of atomic_rcu_read
|
||||
d = atomic_read(§ion->address_space->dispatch);
|
||||
d = address_space_to_dispatch(section->address_space);
|
||||
iotlb = section - d->map.sections;
|
||||
iotlb += xlat;
|
||||
}
|
||||
|
@ -1094,9 +1094,9 @@ static void register_multipage(struct uc_struct *uc,
|
|||
phys_page_set(uc, d, start_addr >> TARGET_PAGE_BITS, num_pages, section_index);
|
||||
}
|
||||
|
||||
void mem_add(AddressSpace *as, MemoryRegionSection *section)
|
||||
void mem_add(AddressSpace *as, FlatView *fv, MemoryRegionSection *section)
|
||||
{
|
||||
AddressSpaceDispatch *d = as->next_dispatch;
|
||||
AddressSpaceDispatch *d = flatview_to_dispatch(fv);
|
||||
MemoryRegionSection now = *section, remain = *section;
|
||||
Int128 page_size = int128_make64(TARGET_PAGE_SIZE);
|
||||
|
||||
|
@ -1852,13 +1852,7 @@ MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr index, MemTxAttrs attrs)
|
|||
return sections[index & ~TARGET_PAGE_MASK].mr;
|
||||
}
|
||||
|
||||
void phys_mem_clean(AddressSpace *as)
|
||||
{
|
||||
AddressSpaceDispatch* d = as->next_dispatch;
|
||||
g_free(d->map.sections);
|
||||
}
|
||||
|
||||
void mem_begin(AddressSpace *as)
|
||||
AddressSpaceDispatch *mem_begin(AddressSpace *as)
|
||||
{
|
||||
AddressSpaceDispatch *d = g_new0(AddressSpaceDispatch, 1);
|
||||
uint16_t n;
|
||||
|
@ -1876,22 +1870,19 @@ void mem_begin(AddressSpace *as)
|
|||
|
||||
d->phys_map = ppe;
|
||||
d->as = as;
|
||||
as->next_dispatch = d;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void mem_commit(AddressSpace *as)
|
||||
void address_space_dispatch_free(AddressSpaceDispatch *d)
|
||||
{
|
||||
AddressSpaceDispatch *cur = as->dispatch;
|
||||
AddressSpaceDispatch *next = as->next_dispatch;
|
||||
phys_sections_free(&d->map);
|
||||
g_free(d);
|
||||
}
|
||||
|
||||
phys_page_compact_all(next, next->map.nodes_nb);
|
||||
|
||||
as->dispatch = next;
|
||||
|
||||
if (cur) {
|
||||
phys_sections_free(&cur->map);
|
||||
g_free(cur);
|
||||
}
|
||||
void mem_commit(AddressSpaceDispatch *d)
|
||||
{
|
||||
phys_page_compact_all(d, d->map.nodes_nb);
|
||||
}
|
||||
|
||||
static void tcg_commit(MemoryListener *listener)
|
||||
|
@ -1907,30 +1898,12 @@ static void tcg_commit(MemoryListener *listener)
|
|||
* We reload the dispatch pointer now because cpu_reloading_memory_map()
|
||||
* may have split the RCU critical section.
|
||||
*/
|
||||
// Unicorn: uses atomic_read instead of atomic_rcu_read
|
||||
d = atomic_read(&cpuas->as->dispatch);
|
||||
d = address_space_to_dispatch(cpuas->as);
|
||||
// Unicorn: atomic_set used instead of atomic_rcu_set
|
||||
atomic_set(&cpuas->memory_dispatch, d);
|
||||
tlb_flush(cpuas->cpu);
|
||||
}
|
||||
|
||||
void address_space_destroy_dispatch(AddressSpace *as)
|
||||
{
|
||||
AddressSpaceDispatch *d = as->dispatch;
|
||||
|
||||
g_free(d->map.nodes);
|
||||
g_free(d);
|
||||
|
||||
if (as->dispatch != as->next_dispatch) {
|
||||
d = as->next_dispatch;
|
||||
g_free(d->map.nodes);
|
||||
g_free(d);
|
||||
}
|
||||
|
||||
as->dispatch = NULL;
|
||||
as->next_dispatch = NULL;
|
||||
}
|
||||
|
||||
static void memory_map_init(struct uc_struct *uc)
|
||||
{
|
||||
uc->system_memory = g_malloc(sizeof(*(uc->system_memory)));
|
||||
|
|
|
@ -60,7 +60,7 @@ symbols = (
|
|||
'address_space_cache_init',
|
||||
'address_space_cache_invalidate',
|
||||
'address_space_destroy',
|
||||
'address_space_destroy_dispatch',
|
||||
'address_space_dispatch_free',
|
||||
'address_space_get_flatview',
|
||||
'address_space_init',
|
||||
'address_space_init_dispatch',
|
||||
|
@ -114,6 +114,7 @@ symbols = (
|
|||
'address_space_stw_cached',
|
||||
'address_space_stw_le',
|
||||
'address_space_stw_le_cached',
|
||||
'address_space_to_dispatch',
|
||||
'address_space_translate',
|
||||
'address_space_translate_for_iotlb',
|
||||
'address_space_translate_internal',
|
||||
|
@ -457,6 +458,7 @@ symbols = (
|
|||
'flatview_lookup',
|
||||
'flatview_ref',
|
||||
'flatview_simplify',
|
||||
'flatview_to_dispatch',
|
||||
'flatview_unref',
|
||||
'float128ToCommonNaN',
|
||||
'float128_add',
|
||||
|
@ -1983,7 +1985,6 @@ symbols = (
|
|||
'phys_map_node_alloc',
|
||||
'phys_map_node_reserve',
|
||||
'phys_mem_alloc',
|
||||
'phys_mem_clean',
|
||||
'phys_mem_set_alloc',
|
||||
'phys_page_compact',
|
||||
'phys_page_compact_all',
|
||||
|
|
|
@ -361,9 +361,6 @@ static inline bool cpu_can_do_io(CPUState *cpu)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Unicorn: Used for freeing
|
||||
void phys_mem_clean(AddressSpace *as);
|
||||
|
||||
// Unicorn: Prototype place here
|
||||
void page_size_init(struct uc_struct *uc);
|
||||
|
||||
|
|
|
@ -22,16 +22,18 @@
|
|||
#ifndef CONFIG_USER_ONLY
|
||||
typedef struct AddressSpaceDispatch AddressSpaceDispatch;
|
||||
|
||||
void address_space_destroy_dispatch(AddressSpace *as);
|
||||
|
||||
extern const MemoryRegionOps unassigned_mem_ops;
|
||||
|
||||
bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
|
||||
unsigned size, bool is_write);
|
||||
|
||||
void mem_add(AddressSpace *as, MemoryRegionSection *section);
|
||||
void mem_begin(AddressSpace *as);
|
||||
void mem_commit(AddressSpace *as);
|
||||
void mem_add(AddressSpace *as, FlatView *fv, MemoryRegionSection *section);
|
||||
AddressSpaceDispatch *mem_begin(AddressSpace *as);
|
||||
void mem_commit(AddressSpaceDispatch *d);
|
||||
|
||||
AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as);
|
||||
AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv);
|
||||
void address_space_dispatch_free(AddressSpaceDispatch *d);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -224,8 +224,6 @@ struct AddressSpace {
|
|||
int ref_count;
|
||||
bool malloced;
|
||||
struct FlatView *current_map;
|
||||
struct AddressSpaceDispatch *dispatch;
|
||||
struct AddressSpaceDispatch *next_dispatch;
|
||||
struct uc_struct* uc;
|
||||
|
||||
QTAILQ_HEAD(memory_listeners_as, MemoryListener) listeners;
|
||||
|
|
|
@ -24,6 +24,7 @@ typedef struct DisplaySurface DisplaySurface;
|
|||
typedef struct DriveInfo DriveInfo;
|
||||
typedef struct Error Error;
|
||||
typedef struct EventNotifier EventNotifier;
|
||||
typedef struct FlatView FlatView;
|
||||
typedef struct FWCfgState FWCfgState;
|
||||
typedef struct HCIInfo HCIInfo;
|
||||
typedef struct I2CBus I2CBus;
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_m68k
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_m68k
|
||||
#define address_space_destroy address_space_destroy_m68k
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_m68k
|
||||
#define address_space_dispatch_free address_space_dispatch_free_m68k
|
||||
#define address_space_get_flatview address_space_get_flatview_m68k
|
||||
#define address_space_init address_space_init_m68k
|
||||
#define address_space_init_dispatch address_space_init_dispatch_m68k
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_m68k
|
||||
#define address_space_stw_le address_space_stw_le_m68k
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_m68k
|
||||
#define address_space_to_dispatch address_space_to_dispatch_m68k
|
||||
#define address_space_translate address_space_translate_m68k
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_m68k
|
||||
#define address_space_translate_internal address_space_translate_internal_m68k
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_m68k
|
||||
#define flatview_ref flatview_ref_m68k
|
||||
#define flatview_simplify flatview_simplify_m68k
|
||||
#define flatview_to_dispatch flatview_to_dispatch_m68k
|
||||
#define flatview_unref flatview_unref_m68k
|
||||
#define float128ToCommonNaN float128ToCommonNaN_m68k
|
||||
#define float128_add float128_add_m68k
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_m68k
|
||||
#define phys_map_node_reserve phys_map_node_reserve_m68k
|
||||
#define phys_mem_alloc phys_mem_alloc_m68k
|
||||
#define phys_mem_clean phys_mem_clean_m68k
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_m68k
|
||||
#define phys_page_compact phys_page_compact_m68k
|
||||
#define phys_page_compact_all phys_page_compact_all_m68k
|
||||
|
|
|
@ -260,6 +260,7 @@ struct FlatView {
|
|||
FlatRange *ranges;
|
||||
unsigned nr;
|
||||
unsigned nr_allocated;
|
||||
struct AddressSpaceDispatch *dispatch;
|
||||
};
|
||||
|
||||
typedef struct AddressSpaceOps AddressSpaceOps;
|
||||
|
@ -319,6 +320,9 @@ static void flatview_destroy(FlatView *view)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (view->dispatch) {
|
||||
address_space_dispatch_free(view->dispatch);
|
||||
}
|
||||
for (i = 0; i < view->nr; i++) {
|
||||
memory_region_unref(view->ranges[i].mr);
|
||||
}
|
||||
|
@ -338,6 +342,22 @@ static void flatview_unref(FlatView *view)
|
|||
}
|
||||
}
|
||||
|
||||
static FlatView *address_space_to_flatview(AddressSpace *as)
|
||||
{
|
||||
// Unicorn: atomic_read used instead of atomic_rcu_read
|
||||
return atomic_read(&as->current_map);
|
||||
}
|
||||
|
||||
AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
|
||||
{
|
||||
return fv->dispatch;
|
||||
}
|
||||
|
||||
AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)
|
||||
{
|
||||
return flatview_to_dispatch(address_space_to_flatview(as));
|
||||
}
|
||||
|
||||
static bool can_merge(FlatRange *r1, FlatRange *r2)
|
||||
{
|
||||
return int128_eq(addrrange_end(r1->addr), r2->addr.start)
|
||||
|
@ -761,21 +781,22 @@ static void address_space_update_topology(AddressSpace *as)
|
|||
FlatView *new_view = generate_memory_topology(as->root);
|
||||
int i;
|
||||
|
||||
mem_begin(as);
|
||||
new_view->dispatch = mem_begin(as);
|
||||
for (i = 0; i < new_view->nr; i++) {
|
||||
MemoryRegionSection mrs =
|
||||
section_from_flat_range(&new_view->ranges[i], as);
|
||||
mem_add(as, &mrs);
|
||||
mem_add(as, new_view, &mrs);
|
||||
}
|
||||
mem_commit(as);
|
||||
mem_commit(new_view->dispatch);
|
||||
|
||||
if (!QTAILQ_EMPTY(&as->listeners)) {
|
||||
address_space_update_topology_pass(as, old_view, new_view, false);
|
||||
address_space_update_topology_pass(as, old_view, new_view, true);
|
||||
}
|
||||
|
||||
flatview_unref(as->current_map);
|
||||
as->current_map = new_view;
|
||||
/* Writes are protected by the BQL. */
|
||||
atomic_set(&as->current_map, new_view);
|
||||
flatview_unref(old_view);
|
||||
|
||||
/* Note that all the old MemoryRegions are still alive up to this
|
||||
* point. This relieves most MemoryListeners from the need to
|
||||
|
@ -1797,7 +1818,6 @@ void address_space_init(struct uc_struct *uc, AddressSpace *as, MemoryRegion *ro
|
|||
QTAILQ_INIT(&as->listeners);
|
||||
QTAILQ_INSERT_TAIL(&uc->address_spaces, as, address_spaces_link);
|
||||
as->name = g_strdup(name ? name : "anonymous");
|
||||
as->dispatch = NULL;
|
||||
uc->memory_region_update_pending |= root->enabled;
|
||||
memory_region_transaction_commit(uc);
|
||||
}
|
||||
|
@ -1807,8 +1827,6 @@ static void do_address_space_destroy(AddressSpace *as)
|
|||
// Unicorn: commented out
|
||||
bool do_free = as->malloced;
|
||||
|
||||
address_space_destroy_dispatch(as);
|
||||
|
||||
// TODO(danghvu): why assert fail here?
|
||||
//QTAILQ_FOREACH(listener, &as->uc->memory_listeners, link) {
|
||||
// assert(QTAILQ_EMPTY(&as->listeners));
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_mips
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_mips
|
||||
#define address_space_destroy address_space_destroy_mips
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_mips
|
||||
#define address_space_dispatch_free address_space_dispatch_free_mips
|
||||
#define address_space_get_flatview address_space_get_flatview_mips
|
||||
#define address_space_init address_space_init_mips
|
||||
#define address_space_init_dispatch address_space_init_dispatch_mips
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_mips
|
||||
#define address_space_stw_le address_space_stw_le_mips
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_mips
|
||||
#define address_space_to_dispatch address_space_to_dispatch_mips
|
||||
#define address_space_translate address_space_translate_mips
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_mips
|
||||
#define address_space_translate_internal address_space_translate_internal_mips
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_mips
|
||||
#define flatview_ref flatview_ref_mips
|
||||
#define flatview_simplify flatview_simplify_mips
|
||||
#define flatview_to_dispatch flatview_to_dispatch_mips
|
||||
#define flatview_unref flatview_unref_mips
|
||||
#define float128ToCommonNaN float128ToCommonNaN_mips
|
||||
#define float128_add float128_add_mips
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_mips
|
||||
#define phys_map_node_reserve phys_map_node_reserve_mips
|
||||
#define phys_mem_alloc phys_mem_alloc_mips
|
||||
#define phys_mem_clean phys_mem_clean_mips
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_mips
|
||||
#define phys_page_compact phys_page_compact_mips
|
||||
#define phys_page_compact_all phys_page_compact_all_mips
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_mips64
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_mips64
|
||||
#define address_space_destroy address_space_destroy_mips64
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_mips64
|
||||
#define address_space_dispatch_free address_space_dispatch_free_mips64
|
||||
#define address_space_get_flatview address_space_get_flatview_mips64
|
||||
#define address_space_init address_space_init_mips64
|
||||
#define address_space_init_dispatch address_space_init_dispatch_mips64
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_mips64
|
||||
#define address_space_stw_le address_space_stw_le_mips64
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_mips64
|
||||
#define address_space_to_dispatch address_space_to_dispatch_mips64
|
||||
#define address_space_translate address_space_translate_mips64
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_mips64
|
||||
#define address_space_translate_internal address_space_translate_internal_mips64
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_mips64
|
||||
#define flatview_ref flatview_ref_mips64
|
||||
#define flatview_simplify flatview_simplify_mips64
|
||||
#define flatview_to_dispatch flatview_to_dispatch_mips64
|
||||
#define flatview_unref flatview_unref_mips64
|
||||
#define float128ToCommonNaN float128ToCommonNaN_mips64
|
||||
#define float128_add float128_add_mips64
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_mips64
|
||||
#define phys_map_node_reserve phys_map_node_reserve_mips64
|
||||
#define phys_mem_alloc phys_mem_alloc_mips64
|
||||
#define phys_mem_clean phys_mem_clean_mips64
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_mips64
|
||||
#define phys_page_compact phys_page_compact_mips64
|
||||
#define phys_page_compact_all phys_page_compact_all_mips64
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_mips64el
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_mips64el
|
||||
#define address_space_destroy address_space_destroy_mips64el
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_mips64el
|
||||
#define address_space_dispatch_free address_space_dispatch_free_mips64el
|
||||
#define address_space_get_flatview address_space_get_flatview_mips64el
|
||||
#define address_space_init address_space_init_mips64el
|
||||
#define address_space_init_dispatch address_space_init_dispatch_mips64el
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_mips64el
|
||||
#define address_space_stw_le address_space_stw_le_mips64el
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_mips64el
|
||||
#define address_space_to_dispatch address_space_to_dispatch_mips64el
|
||||
#define address_space_translate address_space_translate_mips64el
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_mips64el
|
||||
#define address_space_translate_internal address_space_translate_internal_mips64el
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_mips64el
|
||||
#define flatview_ref flatview_ref_mips64el
|
||||
#define flatview_simplify flatview_simplify_mips64el
|
||||
#define flatview_to_dispatch flatview_to_dispatch_mips64el
|
||||
#define flatview_unref flatview_unref_mips64el
|
||||
#define float128ToCommonNaN float128ToCommonNaN_mips64el
|
||||
#define float128_add float128_add_mips64el
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_mips64el
|
||||
#define phys_map_node_reserve phys_map_node_reserve_mips64el
|
||||
#define phys_mem_alloc phys_mem_alloc_mips64el
|
||||
#define phys_mem_clean phys_mem_clean_mips64el
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_mips64el
|
||||
#define phys_page_compact phys_page_compact_mips64el
|
||||
#define phys_page_compact_all phys_page_compact_all_mips64el
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_mipsel
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_mipsel
|
||||
#define address_space_destroy address_space_destroy_mipsel
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_mipsel
|
||||
#define address_space_dispatch_free address_space_dispatch_free_mipsel
|
||||
#define address_space_get_flatview address_space_get_flatview_mipsel
|
||||
#define address_space_init address_space_init_mipsel
|
||||
#define address_space_init_dispatch address_space_init_dispatch_mipsel
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_mipsel
|
||||
#define address_space_stw_le address_space_stw_le_mipsel
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_mipsel
|
||||
#define address_space_to_dispatch address_space_to_dispatch_mipsel
|
||||
#define address_space_translate address_space_translate_mipsel
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_mipsel
|
||||
#define address_space_translate_internal address_space_translate_internal_mipsel
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_mipsel
|
||||
#define flatview_ref flatview_ref_mipsel
|
||||
#define flatview_simplify flatview_simplify_mipsel
|
||||
#define flatview_to_dispatch flatview_to_dispatch_mipsel
|
||||
#define flatview_unref flatview_unref_mipsel
|
||||
#define float128ToCommonNaN float128ToCommonNaN_mipsel
|
||||
#define float128_add float128_add_mipsel
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_mipsel
|
||||
#define phys_map_node_reserve phys_map_node_reserve_mipsel
|
||||
#define phys_mem_alloc phys_mem_alloc_mipsel
|
||||
#define phys_mem_clean phys_mem_clean_mipsel
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_mipsel
|
||||
#define phys_page_compact phys_page_compact_mipsel
|
||||
#define phys_page_compact_all phys_page_compact_all_mipsel
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_powerpc
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_powerpc
|
||||
#define address_space_destroy address_space_destroy_powerpc
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_powerpc
|
||||
#define address_space_dispatch_free address_space_dispatch_free_powerpc
|
||||
#define address_space_get_flatview address_space_get_flatview_powerpc
|
||||
#define address_space_init address_space_init_powerpc
|
||||
#define address_space_init_dispatch address_space_init_dispatch_powerpc
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_powerpc
|
||||
#define address_space_stw_le address_space_stw_le_powerpc
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_powerpc
|
||||
#define address_space_to_dispatch address_space_to_dispatch_powerpc
|
||||
#define address_space_translate address_space_translate_powerpc
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_powerpc
|
||||
#define address_space_translate_internal address_space_translate_internal_powerpc
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_powerpc
|
||||
#define flatview_ref flatview_ref_powerpc
|
||||
#define flatview_simplify flatview_simplify_powerpc
|
||||
#define flatview_to_dispatch flatview_to_dispatch_powerpc
|
||||
#define flatview_unref flatview_unref_powerpc
|
||||
#define float128ToCommonNaN float128ToCommonNaN_powerpc
|
||||
#define float128_add float128_add_powerpc
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_powerpc
|
||||
#define phys_map_node_reserve phys_map_node_reserve_powerpc
|
||||
#define phys_mem_alloc phys_mem_alloc_powerpc
|
||||
#define phys_mem_clean phys_mem_clean_powerpc
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_powerpc
|
||||
#define phys_page_compact phys_page_compact_powerpc
|
||||
#define phys_page_compact_all phys_page_compact_all_powerpc
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_sparc
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_sparc
|
||||
#define address_space_destroy address_space_destroy_sparc
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_sparc
|
||||
#define address_space_dispatch_free address_space_dispatch_free_sparc
|
||||
#define address_space_get_flatview address_space_get_flatview_sparc
|
||||
#define address_space_init address_space_init_sparc
|
||||
#define address_space_init_dispatch address_space_init_dispatch_sparc
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_sparc
|
||||
#define address_space_stw_le address_space_stw_le_sparc
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_sparc
|
||||
#define address_space_to_dispatch address_space_to_dispatch_sparc
|
||||
#define address_space_translate address_space_translate_sparc
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_sparc
|
||||
#define address_space_translate_internal address_space_translate_internal_sparc
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_sparc
|
||||
#define flatview_ref flatview_ref_sparc
|
||||
#define flatview_simplify flatview_simplify_sparc
|
||||
#define flatview_to_dispatch flatview_to_dispatch_sparc
|
||||
#define flatview_unref flatview_unref_sparc
|
||||
#define float128ToCommonNaN float128ToCommonNaN_sparc
|
||||
#define float128_add float128_add_sparc
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_sparc
|
||||
#define phys_map_node_reserve phys_map_node_reserve_sparc
|
||||
#define phys_mem_alloc phys_mem_alloc_sparc
|
||||
#define phys_mem_clean phys_mem_clean_sparc
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_sparc
|
||||
#define phys_page_compact phys_page_compact_sparc
|
||||
#define phys_page_compact_all phys_page_compact_all_sparc
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_sparc64
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_sparc64
|
||||
#define address_space_destroy address_space_destroy_sparc64
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_sparc64
|
||||
#define address_space_dispatch_free address_space_dispatch_free_sparc64
|
||||
#define address_space_get_flatview address_space_get_flatview_sparc64
|
||||
#define address_space_init address_space_init_sparc64
|
||||
#define address_space_init_dispatch address_space_init_dispatch_sparc64
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_sparc64
|
||||
#define address_space_stw_le address_space_stw_le_sparc64
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_sparc64
|
||||
#define address_space_to_dispatch address_space_to_dispatch_sparc64
|
||||
#define address_space_translate address_space_translate_sparc64
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_sparc64
|
||||
#define address_space_translate_internal address_space_translate_internal_sparc64
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_sparc64
|
||||
#define flatview_ref flatview_ref_sparc64
|
||||
#define flatview_simplify flatview_simplify_sparc64
|
||||
#define flatview_to_dispatch flatview_to_dispatch_sparc64
|
||||
#define flatview_unref flatview_unref_sparc64
|
||||
#define float128ToCommonNaN float128ToCommonNaN_sparc64
|
||||
#define float128_add float128_add_sparc64
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_sparc64
|
||||
#define phys_map_node_reserve phys_map_node_reserve_sparc64
|
||||
#define phys_mem_alloc phys_mem_alloc_sparc64
|
||||
#define phys_mem_clean phys_mem_clean_sparc64
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_sparc64
|
||||
#define phys_page_compact phys_page_compact_sparc64
|
||||
#define phys_page_compact_all phys_page_compact_all_sparc64
|
||||
|
|
|
@ -26,11 +26,9 @@ static inline void free_address_spaces(struct uc_struct *uc)
|
|||
{
|
||||
int i;
|
||||
|
||||
phys_mem_clean(&uc->as);
|
||||
address_space_destroy(&uc->as);
|
||||
for (i = 0; i < uc->cpu->num_ases; i++) {
|
||||
AddressSpace *as = uc->cpu->cpu_ases[i].as;
|
||||
phys_mem_clean(as);
|
||||
address_space_destroy(as);
|
||||
g_free(as);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#define address_space_cache_init address_space_cache_init_x86_64
|
||||
#define address_space_cache_invalidate address_space_cache_invalidate_x86_64
|
||||
#define address_space_destroy address_space_destroy_x86_64
|
||||
#define address_space_destroy_dispatch address_space_destroy_dispatch_x86_64
|
||||
#define address_space_dispatch_free address_space_dispatch_free_x86_64
|
||||
#define address_space_get_flatview address_space_get_flatview_x86_64
|
||||
#define address_space_init address_space_init_x86_64
|
||||
#define address_space_init_dispatch address_space_init_dispatch_x86_64
|
||||
|
@ -108,6 +108,7 @@
|
|||
#define address_space_stw_cached address_space_stw_cached_x86_64
|
||||
#define address_space_stw_le address_space_stw_le_x86_64
|
||||
#define address_space_stw_le_cached address_space_stw_le_cached_x86_64
|
||||
#define address_space_to_dispatch address_space_to_dispatch_x86_64
|
||||
#define address_space_translate address_space_translate_x86_64
|
||||
#define address_space_translate_for_iotlb address_space_translate_for_iotlb_x86_64
|
||||
#define address_space_translate_internal address_space_translate_internal_x86_64
|
||||
|
@ -451,6 +452,7 @@
|
|||
#define flatview_lookup flatview_lookup_x86_64
|
||||
#define flatview_ref flatview_ref_x86_64
|
||||
#define flatview_simplify flatview_simplify_x86_64
|
||||
#define flatview_to_dispatch flatview_to_dispatch_x86_64
|
||||
#define flatview_unref flatview_unref_x86_64
|
||||
#define float128ToCommonNaN float128ToCommonNaN_x86_64
|
||||
#define float128_add float128_add_x86_64
|
||||
|
@ -1977,7 +1979,6 @@
|
|||
#define phys_map_node_alloc phys_map_node_alloc_x86_64
|
||||
#define phys_map_node_reserve phys_map_node_reserve_x86_64
|
||||
#define phys_mem_alloc phys_mem_alloc_x86_64
|
||||
#define phys_mem_clean phys_mem_clean_x86_64
|
||||
#define phys_mem_set_alloc phys_mem_set_alloc_x86_64
|
||||
#define phys_page_compact phys_page_compact_x86_64
|
||||
#define phys_page_compact_all phys_page_compact_all_x86_64
|
||||
|
|
Loading…
Reference in a new issue