lock kernel pages
This commit is contained in:
@@ -20,7 +20,10 @@ struct BootInfo {
|
||||
extern "C" void __stack_chk_fail(void) {
|
||||
return;
|
||||
}
|
||||
uint8_t testBuffer[20];
|
||||
|
||||
extern uint64_t _KernelStart;
|
||||
extern uint64_t _KernelEnd;
|
||||
|
||||
extern "C" void _start(BootInfo* bootInfo) {
|
||||
BasicRenderer newRenderer = BasicRenderer(bootInfo->framebuffer, bootInfo->psf1_Font);
|
||||
|
||||
@@ -31,6 +34,13 @@ extern "C" void _start(BootInfo* bootInfo) {
|
||||
PageFrameAllocator newAllocator;
|
||||
newAllocator.ReadEFIMemoryMap(bootInfo->mMap, bootInfo->mMapSize, bootInfo->mMapDescriptorSize);
|
||||
|
||||
// ensure we don't absolutely fuck shit up
|
||||
uint64_t kernelSize = (uint64_t)&_KernelEnd - (uint64_t)&_KernelStart;
|
||||
uint64_t kernelPages = (uint64_t)kernelSize / 4096 + 1;
|
||||
|
||||
newAllocator.LockPages(&_KernelStart, kernelPages);
|
||||
|
||||
// print out ram info
|
||||
newRenderer.Print(0xFFFFFFFF, "Free RAM: ");
|
||||
newRenderer.Print(0xFF00FFFF, to_string(newAllocator.GetFreeRAM() / 1024));
|
||||
newRenderer.Print(0xFF00FFFF, " KB");
|
||||
@@ -44,24 +54,5 @@ extern "C" void _start(BootInfo* bootInfo) {
|
||||
newRenderer.Print(0xFF00FFFF, " KB");
|
||||
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)));
|
||||
|
||||
|
||||
// for (int i = 0; i < mMapEntries; i++) {
|
||||
// EFI_MEMORY_DESCRIPTOR* desc = (EFI_MEMORY_DESCRIPTOR*)((uint64_t)bootInfo ->mMap (i * bootinfo->mMapDescriptorSize));
|
||||
// newRenderer.Print(0xFFFFFFFF, EFI_MEMORY_TYPE_STRINGS[desc->type]);
|
||||
// newRenderer.Print(0xFFFFFFFF, " ");
|
||||
// newRenderer.Print(0xFFFF00FF, to_string(desc->numPages * 4096 / 1024));
|
||||
// newRenderer.Print(0xFFFF00FF, " KB");
|
||||
// newRenderer.cursorPosition = {0, newRenderer.cursorPosition.y + 18};
|
||||
// }
|
||||
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user