mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
Kernel/Devices: Ensure appropriate locking on the Device map singleton
Devices might be removed and inserted at anytime, so let's ensure we always do these kind of operations with a good known state of the HashMap. The VirtIO code was modified to create devices outside the IRQ handler, so now it works with the new locking of the devices singleton, but a better approach might be needed later on.
This commit is contained in:
parent
21b6d84ff0
commit
009feefee0
5 changed files with 57 additions and 37 deletions
|
@ -21,10 +21,9 @@ ConsolePort::ConsolePort(unsigned port, VirtIO::Console& console)
|
|||
m_transmit_buffer = make<Memory::RingBuffer>("VirtIO::ConsolePort Transmit", RINGBUFFER_SIZE);
|
||||
m_receive_queue = m_port == 0 ? 0 : m_port * 2 + 2;
|
||||
m_transmit_queue = m_port == 0 ? 1 : m_port * 2 + 3;
|
||||
init_receive_buffer();
|
||||
}
|
||||
|
||||
void ConsolePort::init_receive_buffer()
|
||||
void ConsolePort::init_receive_buffer(Badge<VirtIO::Console>)
|
||||
{
|
||||
auto& queue = m_console.get_queue(m_receive_queue);
|
||||
SpinlockLocker queue_lock(queue.lock());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue