mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 05:45:36 +00:00
Move RAMBlock deallocation to reclaim_ramblock
Backports a minor portion of commit 43771539d4666cba16298fc6b0ea63867425277c from qemu
This commit is contained in:
parent
aa0ce52b97
commit
6a7974277a
24
qemu/exec.c
24
qemu/exec.c
|
@ -1205,15 +1205,8 @@ 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(struct uc_struct *uc, ram_addr_t addr)
|
||||
static void reclaim_ramblock(RAMBlock *block)
|
||||
{
|
||||
RAMBlock *block;
|
||||
|
||||
QLIST_FOREACH(block, &uc->ram_list.blocks, next) {
|
||||
if (addr == block->offset) {
|
||||
QLIST_REMOVE(block, next);
|
||||
uc->ram_list.mru_block = NULL;
|
||||
uc->ram_list.version++;
|
||||
if (block->flags & RAM_PREALLOC) {
|
||||
;
|
||||
#ifndef _WIN32
|
||||
|
@ -1225,6 +1218,21 @@ void qemu_ram_free(struct uc_struct *uc, ram_addr_t addr)
|
|||
qemu_anon_ram_free(block->host, block->max_length);
|
||||
}
|
||||
g_free(block);
|
||||
}
|
||||
|
||||
void qemu_ram_free(struct uc_struct *uc, ram_addr_t addr)
|
||||
{
|
||||
RAMBlock *block;
|
||||
|
||||
QLIST_FOREACH(block, &uc->ram_list.blocks, next) {
|
||||
if (addr == block->offset) {
|
||||
QLIST_REMOVE(block, next);
|
||||
uc->ram_list.mru_block = NULL;
|
||||
/* Write list before version */
|
||||
smp_wmb();
|
||||
uc->ram_list.version++;
|
||||
// Unicorn: call directly instead of via call_rcu
|
||||
reclaim_ramblock(block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue