diff --git a/Core/Lock.cpp b/Core/Lock.cpp index e6f9db7..96fc21f 100644 --- a/Core/Lock.cpp +++ b/Core/Lock.cpp @@ -2,6 +2,8 @@ #include +#include "../kernel.h" + static unsigned long DeadLocks = 0; extern "C" void DeadLockHandler(LockClass *Lock) @@ -10,5 +12,9 @@ extern "C" void DeadLockHandler(LockClass *Lock) Lock->GetLockData()->AttemptingToGet, Lock->GetLockData()->CurrentHolder, DeadLocks++); + + if (TaskManager) + TaskManager->Schedule(); + // TODO: Print on screen too. } diff --git a/KThread.cpp b/KThread.cpp index bb01a1b..52e8277 100644 --- a/KThread.cpp +++ b/KThread.cpp @@ -49,7 +49,7 @@ void KernelMainThread() { Tasking::TCB *CurrentWorker = nullptr; KPrint("Kernel Compiled at: %s %s with C++ Standard: %d", __DATE__, __TIME__, CPP_LANGUAGE_STANDARD); - KPrint("C++ Language Version (__cplusplus) :%ld", __cplusplus); + KPrint("C++ Language Version (__cplusplus): %ld", __cplusplus); TaskManager->GetCurrentThread()->SetPriority(1); CurrentWorker = TaskManager->CreateThread(TaskManager->GetCurrentProcess(), (Tasking::IP)StartFilesystem); @@ -89,16 +89,16 @@ void KernelMainThread() } TaskManager->WaitForThread(ret.Thread); KPrint("\eE85230Userspace process exited with code %d", ret.Thread->GetExitCode()); + error("Userspace process exited with code %d (%#x)", ret.Thread->GetExitCode(), ret.Thread->GetExitCode()); CPU::Halt(true); } void KernelShutdownThread(bool Reboot) { - debug("Shutting down..."); + trace("Shutting Down/Rebooting..."); if (Reboot) PowerManager->Reboot(); else PowerManager->Shutdown(); - CPU::Stop(); } diff --git a/Tasking/Task.cpp b/Tasking/Task.cpp index 47eb08d..e4117be 100644 --- a/Tasking/Task.cpp +++ b/Tasking/Task.cpp @@ -36,6 +36,8 @@ namespace Tasking #endif } + void Task::Schedule() { OneShot(100); } + __attribute__((naked, used, no_stack_protector)) void IdleProcessLoop() { #if defined(__amd64__) || defined(__i386__) diff --git a/include/task.hpp b/include/task.hpp index 2c6ccea..5b4da9e 100644 --- a/include/task.hpp +++ b/include/task.hpp @@ -214,6 +214,7 @@ namespace Tasking #endif public: + void Schedule(); long GetUsage(int Core) { return 100 - IdleProcess->Info.Usage[Core]; } /**