Fix a bug where GetCurrentProcess returned null inside DSDT

This commit is contained in:
Alex 2023-04-23 07:50:09 +03:00
parent f41faf0fea
commit cd0a470e1d
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -79,7 +79,12 @@ namespace ACPI
else if (Event & ACPI_POWER_BUTTON)
{
if (TaskManager)
TaskManager->CreateThread(TaskManager->GetCurrentProcess(), (Tasking::IP)KST_Shutdown);
{
Tasking::PCB *ParentProcess = TaskManager->GetCurrentProcess();
if (!ParentProcess)
ParentProcess = GetCPU(0)->CurrentProcess.load();
TaskManager->CreateThread(ParentProcess, (Tasking::IP)KST_Shutdown);
}
else
KernelShutdownThread(false);
}