Added implementation of critical thread/process

This commit is contained in:
Alex
2022-11-06 03:43:12 +02:00
parent 954223cbf5
commit 3d947c2a03
4 changed files with 17 additions and 4 deletions

View File

@ -624,12 +624,12 @@ namespace Tasking
Thread->Registers.rsp = ((uint64_t)Thread->Stack + STACK_SIZE);
/* We need to leave the libc's crt to make a syscall when the Thread is exited or we are going to get GPF or PF exception. */
for (uint64_t i = 0; i < TO_PAGES(STACK_SIZE); i++)
Memory::Virtual(Parent->PageTable).Map((void *)((uint64_t)Thread->Stack + (i * PAGE_SIZE)), (void *)((uint64_t)Thread->Stack + (i * PAGE_SIZE)), Memory::PTFlag::US);
Memory::Virtual(Parent->PageTable).Map((void *)((uint64_t)Thread->Stack + (i * PAGE_SIZE)), (void *)((uint64_t)Thread->Stack + (i * PAGE_SIZE)), Memory::PTFlag::RW | Memory::PTFlag::US);
if (!Memory::Virtual(Parent->PageTable).Check((void *)Offset, Memory::PTFlag::US))
{
error("Offset is not user accessible");
Memory::Virtual(Parent->PageTable).Map((void *)Offset, (void *)Offset, Memory::PTFlag::RW | Memory::PTFlag::US);
Memory::Virtual(Parent->PageTable).Map((void *)Offset, (void *)Offset, Memory::PTFlag::RW | Memory::PTFlag::US); // We try one more time.
}
#elif defined(__i386__)
#elif defined(__aarch64__)