mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-04-01 23:07:03 +00:00
exec: Eliminate qemu_ram_free_from_ptr()
Replace qemu_ram_free_from_ptr() with qemu_ram_free(). The only difference between qemu_ram_free_from_ptr() and qemu_ram_free() is that g_free_rcu() is used instead of call_rcu(reclaim_ramblock). We can safely replace it because: * RAM blocks allocated by qemu_ram_alloc_from_ptr() always have RAM_PREALLOC set; * reclaim_ramblock(block) will do nothing except g_free(block) if RAM_PREALLOC is set at block->flags. Backports commit a29ac16632aec6065c72985b9f7eeb1ca6fbef4a from qemu
This commit is contained in:
parent
587c9f0570
commit
26791ea61b
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_aarch64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_aarch64
|
||||
#define qemu_ram_free qemu_ram_free_aarch64
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_aarch64
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_aarch64
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_aarch64
|
||||
#define qemu_ram_remap qemu_ram_remap_aarch64
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_aarch64eb
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_aarch64eb
|
||||
#define qemu_ram_free qemu_ram_free_aarch64eb
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_aarch64eb
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_aarch64eb
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_aarch64eb
|
||||
#define qemu_ram_remap qemu_ram_remap_aarch64eb
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_arm
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_arm
|
||||
#define qemu_ram_free qemu_ram_free_arm
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_arm
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_arm
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_arm
|
||||
#define qemu_ram_remap qemu_ram_remap_arm
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_armeb
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_armeb
|
||||
#define qemu_ram_free qemu_ram_free_armeb
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_armeb
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_armeb
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_armeb
|
||||
#define qemu_ram_remap qemu_ram_remap_armeb
|
||||
|
|
15
qemu/exec.c
15
qemu/exec.c
|
@ -1169,21 +1169,6 @@ ram_addr_t qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t maxsz,
|
|||
return qemu_ram_alloc_internal(size, maxsz, resized, NULL, true, mr, errp);
|
||||
}
|
||||
|
||||
void qemu_ram_free_from_ptr(struct uc_struct *uc, ram_addr_t addr)
|
||||
{
|
||||
RAMBlock *block;
|
||||
|
||||
QTAILQ_FOREACH(block, &uc->ram_list.blocks, next) {
|
||||
if (addr == block->offset) {
|
||||
QTAILQ_REMOVE(&uc->ram_list.blocks, block, next);
|
||||
uc->ram_list.mru_block = NULL;
|
||||
uc->ram_list.version++;
|
||||
g_free(block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void qemu_ram_free(struct uc_struct *uc, ram_addr_t addr)
|
||||
{
|
||||
RAMBlock *block;
|
||||
|
|
|
@ -2448,7 +2448,6 @@ symbols = (
|
|||
'qemu_ram_block_from_host',
|
||||
'qemu_ram_foreach_block',
|
||||
'qemu_ram_free',
|
||||
'qemu_ram_free_from_ptr',
|
||||
'qemu_ram_get_idstr',
|
||||
'qemu_ram_ptr_length',
|
||||
'qemu_ram_remap',
|
||||
|
|
|
@ -35,7 +35,6 @@ int qemu_get_ram_fd(struct uc_struct *uc, ram_addr_t addr);
|
|||
void *qemu_get_ram_block_host_ptr(struct uc_struct *uc, ram_addr_t addr);
|
||||
void *qemu_get_ram_ptr(struct uc_struct *uc, ram_addr_t addr);
|
||||
void qemu_ram_free(struct uc_struct *c, ram_addr_t addr);
|
||||
void qemu_ram_free_from_ptr(struct uc_struct *uc, ram_addr_t addr);
|
||||
|
||||
int qemu_ram_resize(struct uc_struct *c, ram_addr_t base, ram_addr_t newsize, Error **errp);
|
||||
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_m68k
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_m68k
|
||||
#define qemu_ram_free qemu_ram_free_m68k
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_m68k
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_m68k
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_m68k
|
||||
#define qemu_ram_remap qemu_ram_remap_m68k
|
||||
|
|
|
@ -824,7 +824,7 @@ static void memory_region_destructor_alias(MemoryRegion *mr)
|
|||
|
||||
static void memory_region_destructor_ram_from_ptr(MemoryRegion *mr)
|
||||
{
|
||||
qemu_ram_free_from_ptr(mr->uc, mr->ram_addr);
|
||||
qemu_ram_free(mr->uc, mr->ram_addr);
|
||||
}
|
||||
|
||||
static bool memory_region_need_escape(char c)
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mips
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mips
|
||||
#define qemu_ram_free qemu_ram_free_mips
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_mips
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_mips
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_mips
|
||||
#define qemu_ram_remap qemu_ram_remap_mips
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mips64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mips64
|
||||
#define qemu_ram_free qemu_ram_free_mips64
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_mips64
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_mips64
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_mips64
|
||||
#define qemu_ram_remap qemu_ram_remap_mips64
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mips64el
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mips64el
|
||||
#define qemu_ram_free qemu_ram_free_mips64el
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_mips64el
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_mips64el
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_mips64el
|
||||
#define qemu_ram_remap qemu_ram_remap_mips64el
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_mipsel
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_mipsel
|
||||
#define qemu_ram_free qemu_ram_free_mipsel
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_mipsel
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_mipsel
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_mipsel
|
||||
#define qemu_ram_remap qemu_ram_remap_mipsel
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_powerpc
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_powerpc
|
||||
#define qemu_ram_free qemu_ram_free_powerpc
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_powerpc
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_powerpc
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_powerpc
|
||||
#define qemu_ram_remap qemu_ram_remap_powerpc
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_sparc
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_sparc
|
||||
#define qemu_ram_free qemu_ram_free_sparc
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_sparc
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_sparc
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_sparc
|
||||
#define qemu_ram_remap qemu_ram_remap_sparc
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_sparc64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_sparc64
|
||||
#define qemu_ram_free qemu_ram_free_sparc64
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_sparc64
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_sparc64
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_sparc64
|
||||
#define qemu_ram_remap qemu_ram_remap_sparc64
|
||||
|
|
|
@ -2442,7 +2442,6 @@
|
|||
#define qemu_ram_block_from_host qemu_ram_block_from_host_x86_64
|
||||
#define qemu_ram_foreach_block qemu_ram_foreach_block_x86_64
|
||||
#define qemu_ram_free qemu_ram_free_x86_64
|
||||
#define qemu_ram_free_from_ptr qemu_ram_free_from_ptr_x86_64
|
||||
#define qemu_ram_get_idstr qemu_ram_get_idstr_x86_64
|
||||
#define qemu_ram_ptr_length qemu_ram_ptr_length_x86_64
|
||||
#define qemu_ram_remap qemu_ram_remap_x86_64
|
||||
|
|
Loading…
Reference in a new issue