Revision 058bc4b5 exec.c
b/exec.c | ||
---|---|---|
754 | 754 |
static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, |
755 | 755 |
uint16_t section); |
756 | 756 |
static subpage_t *subpage_init(AddressSpace *as, hwaddr base); |
757 |
static void destroy_page_desc(uint16_t section_index) |
|
758 |
{ |
|
759 |
MemoryRegionSection *section = &phys_sections[section_index]; |
|
760 |
MemoryRegion *mr = section->mr; |
|
761 |
|
|
762 |
if (mr->subpage) { |
|
763 |
subpage_t *subpage = container_of(mr, subpage_t, iomem); |
|
764 |
memory_region_destroy(&subpage->iomem); |
|
765 |
g_free(subpage); |
|
766 |
} |
|
767 |
} |
|
768 | 757 |
|
769 | 758 |
static void destroy_l2_mapping(PhysPageEntry *lp, unsigned level) |
770 | 759 |
{ |
... | ... | |
779 | 768 |
for (i = 0; i < L2_SIZE; ++i) { |
780 | 769 |
if (!p[i].is_leaf) { |
781 | 770 |
destroy_l2_mapping(&p[i], level - 1); |
782 |
} else { |
|
783 |
destroy_page_desc(p[i].ptr); |
|
784 | 771 |
} |
785 | 772 |
} |
786 | 773 |
lp->is_leaf = 0; |
... | ... | |
810 | 797 |
return phys_sections_nb++; |
811 | 798 |
} |
812 | 799 |
|
800 |
static void phys_section_destroy(MemoryRegion *mr) |
|
801 |
{ |
|
802 |
if (mr->subpage) { |
|
803 |
subpage_t *subpage = container_of(mr, subpage_t, iomem); |
|
804 |
memory_region_destroy(&subpage->iomem); |
|
805 |
g_free(subpage); |
|
806 |
} |
|
807 |
} |
|
808 |
|
|
813 | 809 |
static void phys_sections_clear(void) |
814 | 810 |
{ |
815 |
phys_sections_nb = 0; |
|
811 |
while (phys_sections_nb > 0) { |
|
812 |
MemoryRegionSection *section = &phys_sections[--phys_sections_nb]; |
|
813 |
phys_section_destroy(section->mr); |
|
814 |
} |
|
816 | 815 |
} |
817 | 816 |
|
818 | 817 |
static void register_subpage(AddressSpaceDispatch *d, MemoryRegionSection *section) |
Also available in: Unified diff