Update code

This commit is contained in:
Alex 2023-04-30 21:38:20 +03:00
parent abb9ff0517
commit c4798a69b1
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
3 changed files with 15 additions and 7 deletions

View File

@ -33,11 +33,12 @@ SECTIONS
*(.multiboot2)
*(.bootstrap .bootstrap.*)
}
_bootstrap_end = .;
. += CONSTANT(MAXPAGESIZE);
_bootstrap_end = ALIGN(CONSTANT(MAXPAGESIZE));
. += KERNEL_VMA;
_kernel_start = .;
. += CONSTANT(MAXPAGESIZE);
_kernel_start = ALIGN(CONSTANT(MAXPAGESIZE));
.text : AT(ADDR(.text) - KERNEL_VMA)
{
*(.text .text.*)

View File

@ -33,11 +33,12 @@ SECTIONS
*(.multiboot2)
*(.bootstrap .bootstrap.*)
}
_bootstrap_end = .;
. += CONSTANT(MAXPAGESIZE);
_bootstrap_end = ALIGN(CONSTANT(MAXPAGESIZE));
. += KERNEL_VMA;
_kernel_start = .;
. += CONSTANT(MAXPAGESIZE);
_kernel_start = ALIGN(CONSTANT(MAXPAGESIZE));
.text : AT(ADDR(.text) - KERNEL_VMA)
{
*(.text .text.*)

View File

@ -24,6 +24,8 @@
#include "../../kernel.h"
extern "C" char BootPageTable[]; // 0x10000 in length
namespace Memory
{
uint64_t Physical::GetTotalMemory()
@ -450,7 +452,7 @@ namespace Memory
for (uint64_t i = 0; i < Info->Memory.Entries; i++)
{
if (Info->Memory.Entry[i].Type == Usable)
if (Info->Memory.Entry[i].Type == Usable && Info->Memory.Entry[i].BaseAddress != 0x0)
this->UnreservePages(Info->Memory.Entry[i].BaseAddress, TO_PAGES(Info->Memory.Entry[i].Length));
}
@ -460,6 +462,10 @@ namespace Memory
debug("Reserving bitmap pages...");
this->ReservePages(PageBitmap.Buffer, TO_PAGES(PageBitmap.Size));
debug("Reserving kernel...");
this->ReservePages(BootPageTable, TO_PAGES(0x10000));
this->ReservePages(&_bootstrap_start, TO_PAGES((uintptr_t)&_bootstrap_end - (uintptr_t)&_bootstrap_start));
this->ReservePages(&_kernel_start, TO_PAGES((uintptr_t)&_kernel_end - (uintptr_t)&_kernel_start));
}
Physical::Physical() {}