Files
banan-os/kernel/include/kernel/Memory/GeneralAllocator.h
Bananymous 5bb1f2a48c Kernel: Rename MMU to PageTable
This is more descriptive name for what it actually represents
2023-05-29 21:06:09 +03:00

36 lines
596 B
C++

#pragma once
#include <BAN/LinkedList.h>
#include <kernel/Memory/Heap.h>
#include <kernel/Memory/PageTable.h>
namespace Kernel
{
class GeneralAllocator
{
BAN_NON_COPYABLE(GeneralAllocator);
BAN_NON_MOVABLE(GeneralAllocator);
public:
GeneralAllocator(PageTable&);
~GeneralAllocator();
vaddr_t allocate(size_t);
bool deallocate(vaddr_t);
BAN::ErrorOr<GeneralAllocator*> clone(PageTable&);
private:
struct Allocation
{
vaddr_t address { 0 };
BAN::Vector<paddr_t> pages;
};
private:
PageTable& m_page_table;
BAN::LinkedList<Allocation> m_allocations;
};
}