Automatically pick the right allocator
other changes besides what's listed below (the thing that picks the right allocator):
- rename KERNEL_HEAP_ALLOCATOR to HYPERVISOR_HEAP_ALLOCATOR
- removed all instances of
use core::alloc::Globalor anything like that, forcing us to specify HYPERVISOR_HEAP_ALLOCATOR - remove the percpu lock
- the global allocator now reads the allocator to use from the current thread. if there is no current thread (e.g. pre-scheduler init), then it will use the global allocator if you wrap the allocation around a PerCpu::with_allocator_override.
- adds a thread::with_custom_allocator, that allows you to specify a custom allocator to use during a block of code. This is a bit risky as deallocation must also be done with the same allocator, which you must remember to do manually, so the function is marked unsafe. Either way, this helps us get around the fact that sometimes the hypervisor must allocate strings out of the container's heap (e.g. when initializing its VFS). And/or we should, as quickly as possible, be running the container setup within a container thread to avoid this issue as much as possible.
- Clarifies memory distribution within a container's valid addresses
Edited by Matthew Giordano