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.
This commit is contained in:
Liav A 2021-05-18 19:08:12 +03:00 committed by Andreas Kling
parent 9dd3203cc6
commit 38ccdb02ce
Notes: sideshowbarker 2024-07-18 17:39:17 +09:00

View File

@ -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);