[libc] Implement sbrk to allow malloc() to work

Userspace can now allocte via malloc. This is slightly janky because it
relies on a single static handle in the library code.
This commit is contained in:
2020-09-27 17:31:23 -07:00
parent 2d44e8112b
commit ff78c951f0
4 changed files with 47 additions and 18 deletions

View File

@@ -71,6 +71,7 @@ vm_space::add(uintptr_t base, vm_area *area)
//TODO: check for collisions
m_areas.sorted_insert({base, area});
area->mapper().add(this);
area->handle_retain();
return true;
}
@@ -81,6 +82,7 @@ vm_space::remove(vm_area *area)
if (a.area == area) {
m_areas.remove(a);
area->mapper().remove(this);
area->handle_release();
return true;
}
}