Refactor memory allocation implementation and add KernelReserve flag to memory mappings

This commit is contained in:
EnderIce2
2024-03-19 03:57:30 +02:00
parent 1bd58a309f
commit b35045e7ca
9 changed files with 610 additions and 562 deletions

View File

@ -454,7 +454,7 @@ namespace Tasking
else
this->SetState(Ready);
this->vma = new Memory::VirtualMemoryArea(this->Parent->PageTable);
this->vma = this->Parent->vma;
#if defined(a64)
this->Registers.rip = EntryPoint;
@ -507,13 +507,13 @@ namespace Tasking
{
this->Stack = new Memory::StackGuard(true, this->vma);
gsTCB *gsT = (gsTCB *)this->vma->RequestPages(TO_PAGES(sizeof(gsTCB)));
gsTCB *gsT = (gsTCB *)this->vma->RequestPages(TO_PAGES(sizeof(gsTCB)), false, true);
#ifdef DEBUG
gsT->__stub = 0xFFFFFFFFFFFFFFFF;
#endif
gsT->ScPages = TO_PAGES(STACK_SIZE);
gsT->SyscallStackBase = this->vma->RequestPages(gsT->ScPages);
gsT->SyscallStackBase = this->vma->RequestPages(gsT->ScPages, false, true);
gsT->SyscallStack = (void *)((uintptr_t)gsT->SyscallStackBase + STACK_SIZE - 0x10);
debug("New syscall stack created: %#lx (base: %#lx) with gs base at %#lx",
gsT->SyscallStack, gsT->SyscallStackBase, gsT);
@ -641,9 +641,6 @@ namespace Tasking
/* Free CPU Stack */
delete this->Stack;
/* Free all allocated memory */
delete this->vma;
/* Free Name */
delete[] this->Name;