1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

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().
This commit is contained in:
Andreas Kling 2021-08-22 12:21:31 +02:00
parent 3e3f760808
commit d60635cb9d
14 changed files with 37 additions and 39 deletions

View file

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