i fixed your code bro :/

This commit is contained in:
2026-01-28 17:46:17 +11:00
parent 459972c176
commit 7c94d21e31
11 changed files with 16 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
kernel/lib/Bitmap.o Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
kernel/lib/memory.o Normal file

Binary file not shown.

View File

@@ -8,7 +8,7 @@ bool Bitmap::operator[](uint64_t index){
return true;
}
return false;
};
}
void Bitmap::Set(uint64_t index, bool value){

View File

@@ -13,32 +13,32 @@ void PageFrameAllocator::ReadEFIMemoryMap(EFI_MEMORY_DESCRIPTOR* mMap, size_t mM
uint64_t mMapEntries = mMapSize / mMapDescSize;
void* largestFreeMemSeg = NULL;
size_t largestFreeMemSegSize = 0
size_t largestFreeMemSegSize = 0;
for (int i = 0; i < mMapEntries; i++) {
EFI_MEMORY_DESCRIPTOR* desc = (EFI_MEMORY_DESCRIPTOR*)((uint64_t)mMap + (i * mMapDescSize));
if (desc->type == 7) {
if (desc -> numPages * 4096 > largestFreeMemSegSize); {
if (desc -> numPages * 4096 > largestFreeMemSegSize) {
largestFreeMemSeg = desc-> physAddr;
largestFreeMemSegSize = desc -> numPages * 4096;
}
}
}
uint64_t memorySize = GetMemorySize(mMap, mMapEntries, mMapDescSize)
uint64_t memorySize = GetMemorySize(mMap, mMapEntries, mMapDescSize);
freeMemory = memorySize;
uint64_t bitmap = memorySize / 4096 / 8 + 1
uint64_t bitmapSize = memorySize / 4096 / 8 + 1;
InitBitmap(bitmapSize, largestFreeMemSeg)
InitBitmap(bitmapSize, largestFreeMemSeg);
//lock pages of bitmap
//reserve pages of unsable/reserverd memory
}
void PageFrameAllocator::InitBitmap(size_t bitmap, void* bufferAddress){
void PageFrameAllocator::InitBitmap(size_t bitmapSize, void* bufferAddress){
PageBitmap.Size = bitmapSize;
PageBitmap.Buffter = (uint8_t*)bufferAddress;
PageBitmap.Buffer = (uint8_t*)bufferAddress;
for (int i = 0; i < bitmapSize; i++){
*(uint8_t)(PageBitmap.Buffer + t) = 0;
*(uint8_t*)(PageBitmap.Buffer + i) = 0;
}
}

View File

@@ -5,10 +5,11 @@
#include "Bitmap.h"
#include "memory.h"
class pageFrameAllocator {
class PageFrameAllocator {
public:
void ReadEFIMemoryMap(EFI_MEMORY_DESCRIPTOR* mMap, size_t mMapSize, size_t mMapDescSize);
Bitmap PageBitmap;
private:
void InitBitmap(size_t bitmap, void* bufferAddress);
}
void InitBitmap(size_t bitmapSize, void* bufferAddress);
};