[kernel] Remove explicit allocator passing

Many kernel objects had to keep a hold of refrences to allocators in
order to pass them on down the call chain. Remove those explicit
refrences and use `operator new`, `operator delete`, and define new
`kalloc` and `kfree`.

Also remove `slab_allocator` and replace it with a new mixin for slab
allocation, `slab_allocated`, that overrides `operator new` and
`operator free` for its subclass.

Remove some no longer used related headers, `buddy_allocator.h` and
`address_manager.h`

Tags: memory
This commit is contained in:
Justin C. Miller
2020-05-31 18:22:23 -07:00
parent 67b5f33d46
commit c6c3a556b3
19 changed files with 125 additions and 537 deletions

View File

@@ -1,4 +1,4 @@
#include "kutil/heap_allocator.h"
#include "kutil/assert.h"
#include "cpu.h"
#include "debug.h"
#include "log.h"
@@ -6,7 +6,6 @@
#include "scheduler.h"
extern "C" void task_fork_return_thunk();
extern kutil::heap_allocator g_kernel_heap; // TODO: this is a bad hack to get access to the heap
void
process::exit(uint32_t code)
@@ -68,7 +67,7 @@ process::setup_kernel_stack()
constexpr unsigned null_frame_entries = 2;
constexpr size_t null_frame_size = null_frame_entries * sizeof(uint64_t);
void *stack_bottom = g_kernel_heap.allocate(initial_stack_size);
void *stack_bottom = kutil::kalloc(initial_stack_size);
kutil::memset(stack_bottom, 0, initial_stack_size);
log::debug(logs::memory, "Created kernel stack at %016lx size 0x%lx",