Skip to content

Commit c733bba

Browse files
committed
Fix wrong offset used in split_region
1 parent c1c5f72 commit c733bba

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

qemu/accel/tcg/translate-all.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,9 @@ static void uc_invalidate_tb(struct uc_struct *uc, uint64_t start_addr, size_t l
985985
{
986986
tb_page_addr_t start, end;
987987

988-
// GVA to GPA (GPA -> HVA via page_find, HVA->HPA via host mmu)
988+
// GVA to GPA
989+
// (GPA -> HVA via memory_region_get_ram_addr(mr) + GPA + block->host,
990+
// HVA->HPA via host mmu)
989991
start = get_page_addr_code(uc->cpu->env_ptr, start_addr) & (target_ulong)(-1);
990992

991993
// For 32bit target.

uc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,8 @@ static bool split_region(struct uc_struct *uc, MemoryRegion *mr,
10901090

10911091
QLIST_FOREACH(block, &uc->ram_list.blocks, next)
10921092
{
1093-
if (block->offset <= mr->addr &&
1093+
// block->offset is the offset within ram_addr_t, not GPA
1094+
if (block->mr->addr <= mr->addr &&
10941095
block->used_length >= (mr->end - mr->addr)) {
10951096
break;
10961097
}

0 commit comments

Comments
 (0)