![]() |
Max OS 0.3
|
Basic doubly linked list bump memory manager. More...
#include <memorymanagement.h>
Public Member Functions | |
| BumpMemoryManager (VirtualMemoryManager *virtual_memory_manager=nullptr) | |
| Constructs a new BumpMemoryManager. | |
| ~BumpMemoryManager () | |
| VirtualMemoryManager * | vmm () |
Public Member Functions inherited from MaxOS::memory::allocator::BumpAllocator | |
| BumpAllocator () | |
| Creates a new bump memory allocator. | |
| virtual | ~BumpAllocator () |
| Destructs a Bump memory allocator. | |
| void | setup_region (uintptr_t address, size_t length) final |
| Setup a region to be bump memory managed, creates a free chunk represent the whole region. | |
| void * | allocate (size_t size) final |
| Allocates a block of memory. | |
| void | unallocate (void *pointer) final |
| Frees a block of memory. | |
| size_t | amount_used () final |
| Returns the amount of memory used. | |
| size_t | align (size_t size) final |
| Aligns the size to the chunk alignment. | |
Public Member Functions inherited from MaxOS::memory::allocator::MemoryAllocator | |
| MemoryAllocator () | |
| virtual | ~MemoryAllocator () |
Static Public Member Functions | |
| static void | switch_active_memory_manager (BumpMemoryManager *manager) |
| Switches the active memory manager. | |
Basic doubly linked list bump memory manager.
Definition at line 29 of file memorymanagement.h.
| BumpMemoryManager::BumpMemoryManager | ( | VirtualMemoryManager * | virtual_memory_manager = nullptr | ) |
Constructs a new BumpMemoryManager.
| virtual_memory_manager | The virtual memory region this allocator manages |
Definition at line 25 of file memorymanagement.cpp.
References MaxOS::memory::VirtualMemoryManager::allocate(), MaxOS::memory::PAGE_SIZE, and MaxOS::memory::allocator::BumpAllocator::setup_region().
| BumpMemoryManager::~BumpMemoryManager | ( | ) |
Destructs the BumpMemoryManager, freeing the VMM it manages
Definition at line 42 of file memorymanagement.cpp.
|
static |
Switches the active memory manager.
| manager | The new memory manager |
Definition at line 83 of file memorymanagement.cpp.
References MaxOS::memory::VirtualMemoryManager::pml4_root_address_physical().
| VirtualMemoryManager * BumpMemoryManager::vmm | ( | ) |
Gets the active virtual memory manager
Definition at line 72 of file memorymanagement.cpp.
Referenced by MaxOS::processes::resources::BridgeHandler::BridgeHandler(), MaxOS::processes::SharedMemory::open(), MaxOS::processes::GlobalScheduler::prepare_initrd(), MaxOS::processes::Process::Process(), and MaxOS::processes::resources::BridgeHandler::send_to_bridge().