diff options
author | Liav A <liavalb@gmail.com> | 2021-05-18 19:08:12 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-21 08:08:33 +0200 |
commit | 38ccdb02ce0f4928643cd63395e6f5af628d74ec (patch) | |
tree | 3d54e3d0ce0179f8366351aad58a84e29b3f80cb /Kernel | |
parent | 9dd3203cc694295ca1b587d0405290a8fa46c145 (diff) | |
download | serenity-38ccdb02ce0f4928643cd63395e6f5af628d74ec.zip |
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.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Devices/HID/PS2KeyboardDevice.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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 <Kernel/Devices/HID/PS2KeyboardDevice.h> #include <Kernel/IO.h> #include <Kernel/TTY/ConsoleManagement.h> +#include <Kernel/WorkQueue.h> 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); |