From 38ccdb02ce0f4928643cd63395e6f5af628d74ec Mon Sep 17 00:00:00 2001 From: Liav A Date: Tue, 18 May 2021 19:08:12 +0300 Subject: [PATCH] Kernel: Process request to change virtual console from the IO Work queue Instead of processing the input after receiving an IRQ, we shift the responsibility to the io work queue to handle this for us, so if a page fault occurs when trying to switch the VirtualConsole, the kernel can handle that. --- Kernel/Devices/HID/PS2KeyboardDevice.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Kernel/Devices/HID/PS2KeyboardDevice.cpp b/Kernel/Devices/HID/PS2KeyboardDevice.cpp index 8df0dced28..4504eb8906 100644 --- a/Kernel/Devices/HID/PS2KeyboardDevice.cpp +++ b/Kernel/Devices/HID/PS2KeyboardDevice.cpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace Kernel { @@ -70,7 +71,9 @@ void PS2KeyboardDevice::irq_handle_byte_read(u8 byte) if (m_modifiers & Mod_Alt) { switch (ch) { case 0x02 ... 0x07: // 1 to 6 - ConsoleManagement::the().switch_to(ch - 0x02); + g_io_work->queue([this, ch]() { + ConsoleManagement::the().switch_to(ch - 0x02); + }); break; default: key_state_changed(ch, pressed);