mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Optimization
This commit is contained in:
parent
2eb7e82a3e
commit
2ddfec2130
@ -626,13 +626,15 @@ namespace Tasking
|
|||||||
Thread->Registers.rflags.ID = 1;
|
Thread->Registers.rflags.ID = 1;
|
||||||
Thread->Registers.rsp = ((uint64_t)Thread->Stack + STACK_SIZE);
|
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. */
|
/* 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::RW | Memory::PTFlag::US);
|
|
||||||
|
|
||||||
if (!Memory::Virtual(Parent->PageTable).Check((void *)Offset, Memory::PTFlag::US))
|
Memory::Virtual uva = Memory::Virtual(Parent->PageTable);
|
||||||
|
for (uint64_t i = 0; i < TO_PAGES(STACK_SIZE); i++)
|
||||||
|
uva.Map((void *)((uint64_t)Thread->Stack + (i * PAGE_SIZE)), (void *)((uint64_t)Thread->Stack + (i * PAGE_SIZE)), Memory::PTFlag::RW | Memory::PTFlag::US);
|
||||||
|
|
||||||
|
if (!uva.Check((void *)Offset, Memory::PTFlag::US))
|
||||||
{
|
{
|
||||||
error("Offset is not user accessible");
|
error("Offset is not user accessible");
|
||||||
Memory::Virtual(Parent->PageTable).Map((void *)Offset, (void *)Offset, Memory::PTFlag::RW | Memory::PTFlag::US); // We try one more time.
|
uva.Map((void *)Offset, (void *)Offset, Memory::PTFlag::RW | Memory::PTFlag::US); // We try one more time.
|
||||||
}
|
}
|
||||||
#elif defined(__i386__)
|
#elif defined(__i386__)
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user