mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 07:19:20 +00:00
Stop all drivers on shutdown / crash
This commit is contained in:
17
KThread.cpp
17
KThread.cpp
@ -77,6 +77,23 @@ Exit:
|
||||
|
||||
void KernelShutdownThread(bool Reboot)
|
||||
{
|
||||
if (DriverManager)
|
||||
foreach (Driver::DriverFile *drv in DriverManager->GetDrivers())
|
||||
{
|
||||
if (!drv)
|
||||
continue;
|
||||
KernelCallback callback;
|
||||
memset(&callback, 0, sizeof(KernelCallback));
|
||||
callback.Reason = StopReason;
|
||||
DriverManager->IOCB(drv->DriverUID, (void *)&callback);
|
||||
|
||||
for (size_t i = 0; i < sizeof(drv->InterruptHook) / sizeof(drv->InterruptHook[0]); i++)
|
||||
{
|
||||
if (!drv->InterruptHook[i])
|
||||
continue;
|
||||
delete drv->InterruptHook[i];
|
||||
}
|
||||
}
|
||||
trace("Shutting Down/Rebooting...");
|
||||
if (Reboot)
|
||||
PowerManager->Reboot();
|
||||
|
Reference in New Issue
Block a user