From c23d387e2f1f755724f3f3fdc06382e573a45cd9 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sun, 30 Aug 2015 10:51:28 +0800 Subject: [PATCH] remove redundant uc_struct.ram --- include/uc_priv.h | 1 - qemu/memory.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/uc_priv.h b/include/uc_priv.h index 686ab9e5..007fecea 100644 --- a/include/uc_priv.h +++ b/include/uc_priv.h @@ -95,7 +95,6 @@ struct uc_struct { void* cpu; MemoryRegion *system_memory; // qemu/exec.c - MemoryRegion *ram; MemoryRegion io_mem_rom; // qemu/exec.c MemoryRegion io_mem_notdirty; // qemu/exec.c MemoryRegion io_mem_unassigned; // qemu/exec.c diff --git a/qemu/memory.c b/qemu/memory.c index 3f8169d9..60f86ae4 100644 --- a/qemu/memory.c +++ b/qemu/memory.c @@ -33,16 +33,16 @@ // Unicorn engine MemoryRegion *memory_map(struct uc_struct *uc, ram_addr_t begin, size_t size, uint32_t perms) { - uc->ram = g_new(MemoryRegion, 1); + MemoryRegion *ram = g_new(MemoryRegion, 1); - memory_region_init_ram(uc, uc->ram, NULL, "pc.ram", size, perms, &error_abort); + memory_region_init_ram(uc, ram, NULL, "pc.ram", size, perms, &error_abort); - memory_region_add_subregion(get_system_memory(uc), begin, uc->ram); + memory_region_add_subregion(get_system_memory(uc), begin, ram); if (uc->current_cpu) tlb_flush(uc->current_cpu, 1); - return uc->ram; + return ram; } int memory_free(struct uc_struct *uc)