From a490ece557606497db1b470d2371ec6a7891911f Mon Sep 17 00:00:00 2001 From: "Takacs, Philipp" Date: Wed, 18 Jan 2023 16:15:36 +0100 Subject: [PATCH] Do not search for the RAMBlock in split_region The MemoryRegion already contains a pointer to the RAMBlock. So it is not necesary to search for it. --- uc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/uc.c b/uc.c index 667f40ca..964137f8 100644 --- a/uc.c +++ b/uc.c @@ -1254,14 +1254,7 @@ static bool split_region(struct uc_struct *uc, MemoryRegion *mr, // Find the correct and large enough (which contains our target mr) // to create the content backup. - QLIST_FOREACH(block, &uc->ram_list.blocks, next) - { - // block->offset is the offset within ram_addr_t, not GPA - if (block->mr->addr <= mr->addr && - block->used_length + block->mr->addr >= mr->end) { - break; - } - } + block = mr->ram_block; if (block == NULL) { return false; @@ -2431,4 +2424,4 @@ void trace_end(uc_tracer *tracer, trace_loc loc, const char *fmt, ...) fprintf(stderr, "%.6fus\n", (double)(end - tracer->starts[loc]) / (double)(1000)); } -#endif \ No newline at end of file +#endif