Fix wrong offset used in split_region

This commit is contained in:
lazymio 2021-11-23 23:22:53 +01:00
parent c1c5f72918
commit c733bbada3
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
2 changed files with 5 additions and 2 deletions

View File

@ -985,7 +985,9 @@ static void uc_invalidate_tb(struct uc_struct *uc, uint64_t start_addr, size_t l
{
tb_page_addr_t start, end;
// GVA to GPA (GPA -> HVA via page_find, HVA->HPA via host mmu)
// GVA to GPA
// (GPA -> HVA via memory_region_get_ram_addr(mr) + GPA + block->host,
// HVA->HPA via host mmu)
start = get_page_addr_code(uc->cpu->env_ptr, start_addr) & (target_ulong)(-1);
// For 32bit target.

3
uc.c
View File

@ -1090,7 +1090,8 @@ static bool split_region(struct uc_struct *uc, MemoryRegion *mr,
QLIST_FOREACH(block, &uc->ram_list.blocks, next)
{
if (block->offset <= mr->addr &&
// block->offset is the offset within ram_addr_t, not GPA
if (block->mr->addr <= mr->addr &&
block->used_length >= (mr->end - mr->addr)) {
break;
}