umalloc: switch to per-process umalloc trees

This commit is contained in:
Michael Shaw 2025-02-12 17:31:10 -05:00
commit 13eb79ca26

View file

@ -303,7 +303,7 @@ void kfree(void *ptr)
void ufree(struct proc *proc, void *addr) void ufree(struct proc *proc, void *addr)
{ {
struct rbnode *n = rbt_search(&umalloc_tree, (uint64_t)addr); struct rbnode *n = rbt_search(&proc->umalloc_tree, (uint64_t)addr);
if (n == NULL) { if (n == NULL) {
kprintf(LOG_ERROR "umalloc: invalid free: %X\n", addr); kprintf(LOG_ERROR "umalloc: invalid free: %X\n", addr);
panic(); panic();
@ -432,7 +432,7 @@ void *umalloc(struct proc *proc, size_t size, uint64_t opts)
} }
} }
struct rbnode *n = rbt_insert(&umalloc_tree, (uint64_t)vaddr); struct rbnode *n = rbt_insert(&proc->umalloc_tree, (uint64_t)vaddr);
n->value = (uint64_t)a; n->value = (uint64_t)a;
return (void *)vaddr; return (void *)vaddr;