Merge pull request #1826 from PhilippTakacs/int128

use int128_get64 in memory_unmap
This commit is contained in:
lazymio 2023-04-19 13:50:43 +02:00 committed by GitHub
commit 98b9373937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,13 +155,13 @@ void memory_unmap(struct uc_struct *uc, MemoryRegion *mr)
if (uc->cpu) { if (uc->cpu) {
// We also need to remove all tb cache // We also need to remove all tb cache
uc->uc_invalidate_tb(uc, mr->addr, mr->size); uc->uc_invalidate_tb(uc, mr->addr, int128_get64(mr->size));
// Make sure all pages associated with the MemoryRegion are flushed // Make sure all pages associated with the MemoryRegion are flushed
// Only need to do this if we are in a running state // Only need to do this if we are in a running state
for (addr = mr->addr; (int64_t)(mr->end - addr) > 0; addr += uc->target_page_size) { for (addr = mr->addr; (int64_t)(mr->end - addr) > 0; addr += uc->target_page_size) {
tlb_flush_page(uc->cpu, addr); tlb_flush_page(uc->cpu, addr);
} }
} }
memory_region_del_subregion(uc->system_memory, mr); memory_region_del_subregion(uc->system_memory, mr);