diff --git a/Tasking/InterProcessCommunication.cpp b/Tasking/InterProcessCommunication.cpp index a5dcc12..5fc2e17 100644 --- a/Tasking/InterProcessCommunication.cpp +++ b/Tasking/InterProcessCommunication.cpp @@ -53,6 +53,7 @@ namespace InterProcessCommunication IPC::IPC() { + trace("Starting IPC Service..."); TaskManager->CreateThread(TaskManager->GetCurrentProcess(), (Tasking::IP)IPCServiceStub); TaskManager->GetCurrentThread()->Rename("IPC Service"); } diff --git a/Tasking/Task.cpp b/Tasking/Task.cpp index 1fd0cde..c6630f9 100644 --- a/Tasking/Task.cpp +++ b/Tasking/Task.cpp @@ -22,6 +22,7 @@ #endif NewLock(TaskingLock); +NewLock(TaskingGetCurrentLock); namespace Tasking { @@ -357,13 +358,13 @@ namespace Tasking PCB *Task::GetCurrentProcess() { - SmartCriticalSection(TaskingLock); + SmartCriticalSection(TaskingGetCurrentLock); return GetCurrentCPU()->CurrentProcess; } TCB *Task::GetCurrentThread() { - SmartCriticalSection(TaskingLock); + SmartCriticalSection(TaskingGetCurrentLock); return GetCurrentCPU()->CurrentThread; } @@ -447,7 +448,7 @@ namespace Tasking } Thread->Security.TrustLevel = Parent->Security.TrustLevel; - Thread->Security.UniqueToken = SecurityManager.CreateToken(); + // Thread->Security.UniqueToken = SecurityManager.CreateToken(); Thread->Info.SpawnTime = 0; Thread->Info.UsedTime = 0; @@ -468,6 +469,9 @@ namespace Tasking Thread->Info.Priority = 0; Thread->Info.Architecture = Architecture; Thread->Info.Compatibility = Compatibility; + + debug("Created thread %d(%s) in process %d(%s)", Thread->ID, Thread->Name, Thread->Parent->ID, Thread->Parent->Name); + Parent->Threads.push_back(Thread); return Thread; } @@ -488,7 +492,7 @@ namespace Tasking Process->Status = TaskStatus::Ready; Process->Security.TrustLevel = TrustLevel; - Process->Security.UniqueToken = SecurityManager.CreateToken(); + // Process->Security.UniqueToken = SecurityManager.CreateToken(); Process->IPCHandles = new HashMap; @@ -549,6 +553,8 @@ namespace Tasking } Process->Info.Priority = 0; + debug("Created process %d(%s) in process %d(%s)", Process->ID, Process->Name, Process->Parent->ID, Process->Parent->Name); + Parent->Children.push_back(Process); ListProcess.push_back(Process); return Process; @@ -575,7 +581,7 @@ namespace Tasking TCB *kthrd = CreateThread(kproc, EntryPoint, 0, Arch); kthrd->Rename("Main Thread"); debug("Created Kernel Process: %s and Thread: %s", kproc->Name, kthrd->Name); - TaskingLock.Lock(); + TaskingLock.Lock(__FUNCTION__); #if defined(__amd64__) || defined(__i386__) uint32_t rax, rbx, rcx, rdx; @@ -598,6 +604,9 @@ namespace Tasking } // ((APIC::Timer *)Interrupts::apicTimer[0])->OneShot(CPU::x64::IRQ16, 100); #endif + TaskingLock.Unlock(); + this->IPCManager = new InterProcessCommunication::IPC; + TaskingLock.Lock(__FUNCTION__); debug("Tasking Started"); } diff --git a/include/task.hpp b/include/task.hpp index 69c7874..ab71c93 100644 --- a/include/task.hpp +++ b/include/task.hpp @@ -147,6 +147,7 @@ namespace Tasking { private: Security SecurityManager; + InterProcessCommunication::IPC *IPCManager = nullptr; UPID NextPID = 0; UTID NextTID = 0;