Fixed kernel hang on IPC wait

This commit is contained in:
Alex 2023-02-13 16:16:09 +02:00
parent dc43de81e8
commit 9416bd5cb9
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
3 changed files with 6 additions and 5 deletions

View File

@ -663,14 +663,14 @@ namespace CrashHandler
if (Frame->cs != GDT_USER_CODE && Frame->cs != GDT_USER_DATA)
{
debug("Exception in kernel mode");
debug("Exception in kernel mode (ip: %#lx, cr2: %#lx)", Frame->rip, PageFaultAddress);
if (TaskManager)
TaskManager->Panic();
Display->CreateBuffer(0, 0, SBIdx);
}
else
{
debug("Exception in user mode");
debug("Exception in user mode (ip: %#lx, cr2: %#lx)", Frame->rip, PageFaultAddress);
CPUData *data = GetCurrentCPU();
if (!data)
{

View File

@ -134,8 +134,9 @@ void KernelMainThread()
TaskManager->GetCurrentThread()->SetPriority(Tasking::Critical);
#ifdef DEBUG
Tasking::PCB *tskMgr = TaskManager->CreateProcess(TaskManager->GetCurrentProcess(), "Debug Task Manager", Tasking::TaskTrustLevel::Kernel);
TaskManager->CreateThread(tskMgr, (Tasking::IP)TaskMgr)->SetPriority((Tasking::TaskPriority)200);
/* TODO: This should not be enabled because it may cause a deadlock. Not sure where or how. */
// Tasking::PCB *tskMgr = TaskManager->CreateProcess(TaskManager->GetCurrentProcess(), "Debug Task Manager", Tasking::TaskTrustLevel::Kernel);
// TaskManager->CreateThread(tskMgr, (Tasking::IP)TaskMgr)->SetPriority(Tasking::High);
#endif
KPrint("Kernel Compiled at: %s %s with C++ Standard: %d", __DATE__, __TIME__, CPP_LANGUAGE_STANDARD);

View File

@ -170,7 +170,7 @@ namespace InterProcessCommunication
warn("Interrupts are disabled. This may cause a kernel hang.");
debug("Waiting for IPC %d (now %s)", ID, Hnd->Listening ? "listening" : "ready");
while (Hnd->Listening)
TaskManager->Schedule();
CPU::Halt();
debug("IPC %d is ready", ID);
return IPCSuccess;
}