From 8f2841ecdb4db099d5670fa396012810179d7a06 Mon Sep 17 00:00:00 2001 From: Choongwoo Han Date: Mon, 20 Mar 2023 17:07:15 -0700 Subject: [PATCH] Cache index for find_memory_region --- uc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/uc.c b/uc.c index 76c4eb28..ed9663ef 100644 --- a/uc.c +++ b/uc.c @@ -1532,8 +1532,10 @@ MemoryRegion *find_memory_region(struct uc_struct *uc, uint64_t address) if (i < uc->mapped_block_count && address >= uc->mapped_blocks[i]->addr && - address <= uc->mapped_blocks[i]->end - 1) + address < uc->mapped_blocks[i]->end) { + uc->mapped_block_cache_index = i; return uc->mapped_blocks[i]; + } // not found return NULL;