mirror of
https://github.com/ish-app/ish.git
synced 2026-02-01 14:32:26 +00:00
Fix crashes and memory leaks
This commit is contained in:
parent
601ed99dc3
commit
1cf549de34
@ -38,6 +38,7 @@ void mem_release(struct mem *mem) {
|
||||
pt_unmap(mem, 0, MEM_PAGES, PT_FORCE);
|
||||
free(mem->pt);
|
||||
write_wrunlock(&mem->lock);
|
||||
jit_free(mem->jit);
|
||||
free(mem);
|
||||
}
|
||||
}
|
||||
@ -140,7 +141,9 @@ int pt_copy_on_write(struct mem *src, page_t src_start, struct mem *dst, page_t
|
||||
entry->flags |= P_COW;
|
||||
entry->flags &= ~P_COMPILED;
|
||||
entry->data->refcount++;
|
||||
dst->pt[dst_page] = *entry;
|
||||
dst->pt[dst_page].data = entry->data;
|
||||
dst->pt[dst_page].offset = entry->offset;
|
||||
dst->pt[dst_page].flags = entry->flags;
|
||||
}
|
||||
}
|
||||
mem_changed(src);
|
||||
|
||||
@ -143,8 +143,11 @@ void cpu_run(struct cpu_state *cpu) {
|
||||
read_wrunlock(&cpu->mem->lock);
|
||||
handle_interrupt(interrupt);
|
||||
read_wrlock(&cpu->mem->lock);
|
||||
if (tlb->mem != cpu->mem)
|
||||
if (tlb->mem != cpu->mem) {
|
||||
tlb->mem = cpu->mem;
|
||||
jit = cpu->mem->jit;
|
||||
last_block = NULL;
|
||||
}
|
||||
if (cpu->mem->changes != changes) {
|
||||
tlb_flush(tlb);
|
||||
changes = cpu->mem->changes;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user