[kernel] Spit out vm_area types
The vm_space allow() functionality was a bit janky; using VMAs for all regions would be a lot cleaner. To that end, this change: - Adds a "static array" ctor to kutil::vector for setting the kernel address space's VMA list. This way a kernel heap VMA can be created without the heap already existing. - Splits vm_area into different subclasses depending on desired behavior - Splits out the concept of vm_mapper which maps vm_areas to vm_spaces, so that some kinds of VMA can be inherently single-space - Implements VMA resizing so that userspace can grow allocations. - Obsolete page_table_indices is removed Also, the following bugs were fixed: - kutil::map iterators on empty maps no longer break - memory::page_count was doing page-align, not page-count See: Github bug #242 See: [frobozz blog post](https://jsix.dev/posts/frobozz/) Tags:
This commit is contained in:
@@ -17,7 +17,7 @@ namespace memory {
|
||||
constexpr uintptr_t page_offset = 0xffffc00000000000ull;
|
||||
|
||||
/// Max number of pages for a kernel stack
|
||||
constexpr unsigned kernel_stack_pages = 1;
|
||||
constexpr unsigned kernel_stack_pages = 4;
|
||||
|
||||
/// Max number of pages for a kernel buffer
|
||||
constexpr unsigned kernel_buffer_pages = 16;
|
||||
@@ -62,6 +62,6 @@ namespace memory {
|
||||
/// \arg bytes The number of bytes desired
|
||||
/// \returns The number of pages needed to contain the desired bytes
|
||||
inline size_t page_count(size_t bytes) {
|
||||
return ((bytes - 1) & (frame_size - 1)) + 1;
|
||||
return ((bytes - 1) >> 12) + 1;
|
||||
}
|
||||
} // namespace memory
|
||||
|
||||
Reference in New Issue
Block a user