[kernel] Move kernel stacks out of the heap

We were previously allocating kernel stacks as large objects on the
heap. Now keep track of areas of the kernel stack area that are in use,
and allocate them from there. Also required actually implementing
vm_space::commit(). This still needs more work.
This commit is contained in:
2020-08-02 18:15:28 -07:00
parent b98334db28
commit 579eaaf4a0
9 changed files with 123 additions and 33 deletions

View File

@@ -184,7 +184,23 @@ vm_space::unreserve(uintptr_t start, size_t size)
uintptr_t
vm_space::commit(uintptr_t start, size_t size)
{
return 0;
log::debug(logs::vmem, "Committing region %016llx-%016llx", start, start+size);
node_type *node = find_overlapping(m_ranges.root(), start, size);
if (!node) {
log::debug(logs::vmem, " found no match");
return 0;
} else if (node->state == vm_state::unknown || node->state == vm_state::mapped) {
log::debug(logs::vmem, " found wrong state %016llx-%016llx[%d]",
node->address, node->address + node->size, node->state);
return 0;
}
if (node->address <= start && node->size >= size && node->state == vm_state::committed)
return start;
node = split_out(node, start, size, vm_state::committed);
return node ? start : 0;
}
void