mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Fixes for Tasking
This commit is contained in:
parent
55f63d26fa
commit
1c1b4249f6
@ -379,12 +379,20 @@ namespace Tasking
|
|||||||
{
|
{
|
||||||
SmartCriticalSection(TaskingLock);
|
SmartCriticalSection(TaskingLock);
|
||||||
TCB *Thread = new TCB;
|
TCB *Thread = new TCB;
|
||||||
Thread->ID = this->NextTID++;
|
|
||||||
strcpy(Thread->Name, Parent->Name);
|
|
||||||
if (Parent == nullptr)
|
if (Parent == nullptr)
|
||||||
Thread->Parent = this->GetCurrentProcess();
|
Thread->Parent = this->GetCurrentProcess();
|
||||||
else
|
else
|
||||||
Thread->Parent = Parent;
|
Thread->Parent = Parent;
|
||||||
|
|
||||||
|
if (!Parent)
|
||||||
|
{
|
||||||
|
error("Parent is null");
|
||||||
|
delete Thread;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread->ID = this->NextTID++;
|
||||||
|
strcpy(Thread->Name, Parent->Name);
|
||||||
Thread->EntryPoint = EntryPoint;
|
Thread->EntryPoint = EntryPoint;
|
||||||
Thread->Offset = Offset;
|
Thread->Offset = Offset;
|
||||||
Thread->ExitCode = 0xdeadbeef;
|
Thread->ExitCode = 0xdeadbeef;
|
||||||
@ -445,6 +453,7 @@ namespace Tasking
|
|||||||
{
|
{
|
||||||
error("Unknown elevation.");
|
error("Unknown elevation.");
|
||||||
KernelAllocator.FreePages((void *)((uint64_t)Thread->Stack - STACK_SIZE), TO_PAGES(STACK_SIZE));
|
KernelAllocator.FreePages((void *)((uint64_t)Thread->Stack - STACK_SIZE), TO_PAGES(STACK_SIZE));
|
||||||
|
this->NextTID--;
|
||||||
delete Thread;
|
delete Thread;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -533,6 +542,7 @@ namespace Tasking
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
error("Unknown elevation.");
|
error("Unknown elevation.");
|
||||||
|
this->NextPID--;
|
||||||
delete Process;
|
delete Process;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -556,9 +566,10 @@ namespace Tasking
|
|||||||
}
|
}
|
||||||
Process->Info.Priority = 0;
|
Process->Info.Priority = 0;
|
||||||
|
|
||||||
debug("Created process %d(%s) in process %d(%s)", Process->ID, Process->Name, Process->Parent->ID, Process->Parent->Name);
|
debug("Created process %d(%s) in process %d(%s)", Process->ID, Process->Name, Parent ? Process->Parent->ID : 0, Parent ? Process->Parent->Name : "None");
|
||||||
|
|
||||||
Parent->Children.push_back(Process);
|
if (Parent)
|
||||||
|
Parent->Children.push_back(Process);
|
||||||
ListProcess.push_back(Process);
|
ListProcess.push_back(Process);
|
||||||
return Process;
|
return Process;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user