request pages
This commit is contained in:
Binary file not shown.
@@ -59,4 +59,4 @@ buildimg:
|
|||||||
mcopy -i $(BUILDDIR)/$(OSNAME).img $(BUILDDIR)/zap-light18.psf ::
|
mcopy -i $(BUILDDIR)/$(OSNAME).img $(BUILDDIR)/zap-light18.psf ::
|
||||||
|
|
||||||
run:
|
run:
|
||||||
qemu-system-x86_64 -drive file=$(BUILDDIR)/$(OSNAME).img -m 256M -cpu qemu64 -drive if=pflash,format=raw,unit=0,file="$(OVMFDIR)/OVMF_CODE-pure-efi.fd",readonly=on -drive if=pflash,format=raw,unit=1,file="$(OVMFDIR)/OVMF_VARS-pure-efi.fd" -net none
|
qemu-system-x86_64 -drive file=$(BUILDDIR)/$(OSNAME).img -m 64M -cpu qemu64 -drive if=pflash,format=raw,unit=0,file="$(OVMFDIR)/OVMF_CODE-pure-efi.fd",readonly=on -drive if=pflash,format=raw,unit=1,file="$(OVMFDIR)/OVMF_VARS-pure-efi.fd" -net none
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -115,6 +115,16 @@ void PageFrameAllocator::ReservePages(void* address, uint64_t pageCount) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* PageFrameAllocator::RequestPage() {
|
||||||
|
for (uint64_t index = 0; index < PageBitmap.Size * 8; index++) {
|
||||||
|
if (PageBitmap[index] == true) continue;
|
||||||
|
|
||||||
|
LockPage((void*)(index * 4096));
|
||||||
|
return (void*)(index * 4096);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL; // page frame swap to file
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t PageFrameAllocator::GetFreeRAM() {
|
uint64_t PageFrameAllocator::GetFreeRAM() {
|
||||||
return freeMemory;
|
return freeMemory;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class PageFrameAllocator {
|
|||||||
void FreePages(void* address, uint64_t pageCount);
|
void FreePages(void* address, uint64_t pageCount);
|
||||||
void LockPage(void* address);
|
void LockPage(void* address);
|
||||||
void LockPages(void* address, uint64_t pageCount);
|
void LockPages(void* address, uint64_t pageCount);
|
||||||
|
void* RequestPage();
|
||||||
uint64_t GetFreeRAM();
|
uint64_t GetFreeRAM();
|
||||||
uint64_t GetUsedRAM();
|
uint64_t GetUsedRAM();
|
||||||
uint64_t GetReservedRAM();
|
uint64_t GetReservedRAM();
|
||||||
|
|||||||
@@ -44,6 +44,13 @@ extern "C" void _start(BootInfo* bootInfo) {
|
|||||||
newRenderer.Print(0xFF00FFFF, " KB");
|
newRenderer.Print(0xFF00FFFF, " KB");
|
||||||
newRenderer.cursorPosition = {0, newRenderer.cursorPosition.y + 18};
|
newRenderer.cursorPosition = {0, newRenderer.cursorPosition.y + 18};
|
||||||
|
|
||||||
|
for (int t = 0; t < 20; t++) {
|
||||||
|
void* address = newAllocator.RequestPage();
|
||||||
|
newRenderer.Print(0xFFFFFFFF, "0x");
|
||||||
|
newRenderer.Print(0xFFFFFFFF, to_hstring((uint64_t)address));
|
||||||
|
newRenderer.cursorPosition = {0, newRenderer.cursorPosition.y + 18};
|
||||||
|
}
|
||||||
|
|
||||||
//newRenderer.Print(0xFFFFFFFF, to_string(GetMemorySize(bootInfo->mMap, mMapEntries, bootInfo ->mMapDescriptorSize)));
|
//newRenderer.Print(0xFFFFFFFF, to_string(GetMemorySize(bootInfo->mMap, mMapEntries, bootInfo ->mMapDescriptorSize)));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user