93 |
93 |
* The bottom level has pointers to MemoryRegionSections.
|
94 |
94 |
*/
|
95 |
95 |
PhysPageEntry phys_map;
|
96 |
|
MemoryListener listener;
|
97 |
96 |
AddressSpace *as;
|
98 |
97 |
};
|
99 |
98 |
|
... | ... | |
841 |
840 |
|
842 |
841 |
static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
|
843 |
842 |
{
|
844 |
|
AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch, listener);
|
|
843 |
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
|
|
844 |
AddressSpaceDispatch *d = as->dispatch;
|
845 |
845 |
MemoryRegionSection now = *section, remain = *section;
|
846 |
846 |
Int128 page_size = int128_make64(TARGET_PAGE_SIZE);
|
847 |
847 |
|
... | ... | |
1703 |
1703 |
|
1704 |
1704 |
static void mem_begin(MemoryListener *listener)
|
1705 |
1705 |
{
|
1706 |
|
AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch, listener);
|
|
1706 |
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
|
|
1707 |
AddressSpaceDispatch *d = as->dispatch;
|
1707 |
1708 |
|
1708 |
1709 |
d->phys_map.ptr = PHYS_MAP_NODE_NIL;
|
1709 |
1710 |
}
|
... | ... | |
1772 |
1773 |
AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1);
|
1773 |
1774 |
|
1774 |
1775 |
d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0 };
|
1775 |
|
d->listener = (MemoryListener) {
|
|
1776 |
d->as = as;
|
|
1777 |
as->dispatch = d;
|
|
1778 |
as->dispatch_listener = (MemoryListener) {
|
1776 |
1779 |
.begin = mem_begin,
|
1777 |
1780 |
.region_add = mem_add,
|
1778 |
1781 |
.region_nop = mem_add,
|
1779 |
1782 |
.priority = 0,
|
1780 |
1783 |
};
|
1781 |
|
d->as = as;
|
1782 |
|
as->dispatch = d;
|
1783 |
|
memory_listener_register(&d->listener, as);
|
|
1784 |
memory_listener_register(&as->dispatch_listener, as);
|
1784 |
1785 |
}
|
1785 |
1786 |
|
1786 |
1787 |
void address_space_destroy_dispatch(AddressSpace *as)
|
1787 |
1788 |
{
|
1788 |
1789 |
AddressSpaceDispatch *d = as->dispatch;
|
1789 |
1790 |
|
1790 |
|
memory_listener_unregister(&d->listener);
|
|
1791 |
memory_listener_unregister(&as->dispatch_listener);
|
1791 |
1792 |
g_free(d);
|
1792 |
1793 |
as->dispatch = NULL;
|
1793 |
1794 |
}
|