lock kernel pages
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@ ENTRY(_start)
|
|||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
|
_KernelStart = .;
|
||||||
.text : ALIGN(0x1000)
|
.text : ALIGN(0x1000)
|
||||||
{
|
{
|
||||||
*(.text)
|
*(.text)
|
||||||
@@ -20,4 +21,5 @@ SECTIONS
|
|||||||
*(COMMON)
|
*(COMMON)
|
||||||
*(.bss)
|
*(.bss)
|
||||||
}
|
}
|
||||||
|
_KernelEnd = .;
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -20,7 +20,10 @@ struct BootInfo {
|
|||||||
extern "C" void __stack_chk_fail(void) {
|
extern "C" void __stack_chk_fail(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t testBuffer[20];
|
|
||||||
|
extern uint64_t _KernelStart;
|
||||||
|
extern uint64_t _KernelEnd;
|
||||||
|
|
||||||
extern "C" void _start(BootInfo* bootInfo) {
|
extern "C" void _start(BootInfo* bootInfo) {
|
||||||
BasicRenderer newRenderer = BasicRenderer(bootInfo->framebuffer, bootInfo->psf1_Font);
|
BasicRenderer newRenderer = BasicRenderer(bootInfo->framebuffer, bootInfo->psf1_Font);
|
||||||
|
|
||||||
@@ -31,6 +34,13 @@ extern "C" void _start(BootInfo* bootInfo) {
|
|||||||
PageFrameAllocator newAllocator;
|
PageFrameAllocator newAllocator;
|
||||||
newAllocator.ReadEFIMemoryMap(bootInfo->mMap, bootInfo->mMapSize, bootInfo->mMapDescriptorSize);
|
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(0xFFFFFFFF, "Free RAM: ");
|
||||||
newRenderer.Print(0xFF00FFFF, to_string(newAllocator.GetFreeRAM() / 1024));
|
newRenderer.Print(0xFF00FFFF, to_string(newAllocator.GetFreeRAM() / 1024));
|
||||||
newRenderer.Print(0xFF00FFFF, " KB");
|
newRenderer.Print(0xFF00FFFF, " KB");
|
||||||
@@ -44,24 +54,5 @@ 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)));
|
|
||||||
|
|
||||||
|
|
||||||
// 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;
|
return;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user