mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 15:29:18 +00:00
Renamed "Tracker" to "MemMgr" because it could be used for shared memory and more useful features
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
|
||||
namespace Memory
|
||||
{
|
||||
uint64_t Tracker::GetAllocatedMemorySize()
|
||||
uint64_t MemMgr::GetAllocatedMemorySize()
|
||||
{
|
||||
uint64_t Size = 0;
|
||||
foreach (auto var in AllocatedPagesList)
|
||||
@ -11,7 +11,7 @@ namespace Memory
|
||||
return FROM_PAGES(Size);
|
||||
}
|
||||
|
||||
void *Tracker::RequestPages(size_t Count)
|
||||
void *MemMgr::RequestPages(size_t Count)
|
||||
{
|
||||
void *Address = KernelAllocator.RequestPages(Count);
|
||||
for (size_t i = 0; i < Count; i++)
|
||||
@ -20,7 +20,7 @@ namespace Memory
|
||||
return Address;
|
||||
}
|
||||
|
||||
void Tracker::FreePages(void *Address, size_t Count)
|
||||
void MemMgr::FreePages(void *Address, size_t Count)
|
||||
{
|
||||
for (size_t i = 0; i < AllocatedPagesList.size(); i++)
|
||||
if (AllocatedPagesList[i].Address == Address)
|
||||
@ -41,16 +41,16 @@ namespace Memory
|
||||
}
|
||||
}
|
||||
|
||||
Tracker::Tracker(PageTable4 *PageTable)
|
||||
MemMgr::MemMgr(PageTable4 *PageTable)
|
||||
{
|
||||
if (PageTable)
|
||||
this->PageTable = PageTable;
|
||||
else
|
||||
this->PageTable = (PageTable4 *)CPU::x64::readcr3().raw;
|
||||
debug("Tracker initialized.");
|
||||
debug("MemMgr initialized.");
|
||||
}
|
||||
|
||||
Tracker::~Tracker()
|
||||
MemMgr::~MemMgr()
|
||||
{
|
||||
foreach (auto var in AllocatedPagesList)
|
||||
{
|
||||
@ -58,6 +58,6 @@ namespace Memory
|
||||
for (size_t i = 0; i < var.PageCount; i++)
|
||||
Memory::Virtual(this->PageTable).Remap((void *)((uintptr_t)var.Address + (i * PAGE_SIZE)), (void *)((uintptr_t)var.Address + (i * PAGE_SIZE)), Memory::PTFlag::RW);
|
||||
}
|
||||
debug("Tracker destroyed.");
|
||||
debug("MemMgr destroyed.");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user