Kernel: Replace CriticalScope with SpinLock in SerialTTY

This commit is contained in:
Bananymous 2024-02-29 13:06:36 +02:00
parent 90878a7c2b
commit 51e38b7614
2 changed files with 4 additions and 2 deletions

View File

@ -62,6 +62,7 @@ namespace Kernel
BAN::String m_name;
Serial m_serial;
BAN::CircularQueue<uint8_t, 128> m_input;
SpinLock m_input_lock;
public:
virtual dev_t rdev() const override { return m_rdev; }

View File

@ -1,5 +1,4 @@
#include <BAN/Array.h>
#include <kernel/CriticalScope.h>
#include <kernel/Device/DeviceNumbers.h>
#include <kernel/FS/DevFS/FileSystem.h>
#include <kernel/IDT.h>
@ -219,6 +218,8 @@ namespace Kernel
void SerialTTY::handle_irq()
{
uint8_t ch = IO::inb(m_serial.port());
SpinLockGuard _(m_input_lock);
if (m_input.full())
{
dwarnln("Serial buffer full");
@ -235,7 +236,7 @@ namespace Kernel
uint8_t buffer[128];
{
CriticalScope _;
SpinLockGuard _(m_input_lock);
if (m_input.empty())
return;
uint8_t* ptr = buffer;