From d60635cb9df9b4e72702db02b88b26ab9123c2a8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 22 Aug 2021 12:21:31 +0200 Subject: Kernel: Convert Processor::in_irq() to static current_in_irq() This closes the race window between Processor::current() and a context switch happening before in_irq(). --- Kernel/Devices/HID/I8042Controller.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Kernel/Devices/HID') diff --git a/Kernel/Devices/HID/I8042Controller.cpp b/Kernel/Devices/HID/I8042Controller.cpp index 3f11b70560..a55326ef92 100644 --- a/Kernel/Devices/HID/I8042Controller.cpp +++ b/Kernel/Devices/HID/I8042Controller.cpp @@ -132,7 +132,7 @@ UNMAP_AFTER_INIT void I8042Controller::detect_devices() bool I8042Controller::irq_process_input_buffer(HIDDevice::Type) { - VERIFY(Processor::current().in_irq()); + VERIFY(Processor::current_in_irq()); u8 status = IO::in8(I8042_STATUS); if (!(status & I8042_BUFFER_FULL)) @@ -167,7 +167,7 @@ bool I8042Controller::do_reset_device(HIDDevice::Type device) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); if (do_send_command(device, 0xff) != I8042_ACK) return false; // Wait until we get the self-test result @@ -179,7 +179,7 @@ u8 I8042Controller::do_send_command(HIDDevice::Type device, u8 command) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); return do_write_to_device(device, command); } @@ -189,7 +189,7 @@ u8 I8042Controller::do_send_command(HIDDevice::Type device, u8 command, u8 data) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); u8 response = do_write_to_device(device, command); if (response == I8042_ACK) @@ -202,7 +202,7 @@ u8 I8042Controller::do_write_to_device(HIDDevice::Type device, u8 data) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); int attempts = 0; u8 response; -- cgit v1.2.3