fix: various fixes

This commit is contained in:
2026-02-22 10:53:30 +01:00
parent e0bfc97f0f
commit 99f231acd2
11 changed files with 50176 additions and 10 deletions
+17
View File
@@ -105,4 +105,21 @@ namespace Memory {
Free((void*)(uint64_t)ptr + (0x1000 * n));
}
}
void PageFrameAllocator::GetStats(Zenith::MemStats* out) {
if (!out) return;
Lock.Acquire();
uint64_t freeBytes = 0;
Page* current = head.next;
while (current != nullptr) {
freeBytes += current->size;
current = current->next;
}
Lock.Release();
out->totalBytes = g_section.size;
out->freeBytes = freeBytes;
out->usedBytes = g_section.size > freeBytes ? g_section.size - freeBytes : 0;
out->pageSize = 0x1000;
}
};
+3
View File
@@ -6,6 +6,7 @@
#pragma once
#include "Memmap.hpp"
#include <Api/Syscall.hpp>
#include <CppLib/Spinlock.hpp>
@@ -27,6 +28,8 @@ public:
void* ReallocConsecutive(void* ptr, int n);
void Free(void* ptr);
void Free(void* ptr, int n);
void GetStats(Zenith::MemStats* out);
};
extern PageFrameAllocator* g_pfa;