Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix https://github.com/unicorn-engine/unicorn/issues/1588 #1593

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev
More reasonable fix #1588
  • Loading branch information
liyansong2018 committed Apr 14, 2022
commit 31389e59457f304be3809f9679f91a42daa7ebaa
2 changes: 1 addition & 1 deletion qemu/exec.c
Expand Up @@ -1130,7 +1130,7 @@ void qemu_ram_free(struct uc_struct *uc, RAMBlock *block)
// ram_block_notify_remove(block->host, block->max_length);
//}

QLIST_SAFE_REMOVE(block, next);
QLIST_REMOVE(block, next);
uc->ram_list.mru_block = NULL;
/* Write list before version */
//smp_wmb();
Expand Down
9 changes: 7 additions & 2 deletions qemu/softmmu/memory.c
Expand Up @@ -43,12 +43,17 @@ MemoryRegion *memory_map(struct uc_struct *uc, hwaddr begin, size_t size, uint32
MemoryRegion *ram = g_new(MemoryRegion, 1);

memory_region_init_ram(uc, ram, size, perms);
if (ram->addr == -1) {
// out of memory
if (!ram->ram_block->host) {
g_free(ram->ram_block);
g_free(ram);
return NULL;
}

memory_region_add_subregion(uc->system_memory, begin, ram);
if (ram->addr == -1) {
// out of memory
return NULL;
}

if (uc->cpu) {
tlb_flush(uc->cpu);
Expand Down