Kernel: Replace CriticalScope with SpinLock in SerialTTY
This commit is contained in:
parent
90878a7c2b
commit
51e38b7614
|
@ -62,6 +62,7 @@ namespace Kernel
|
||||||
BAN::String m_name;
|
BAN::String m_name;
|
||||||
Serial m_serial;
|
Serial m_serial;
|
||||||
BAN::CircularQueue<uint8_t, 128> m_input;
|
BAN::CircularQueue<uint8_t, 128> m_input;
|
||||||
|
SpinLock m_input_lock;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual dev_t rdev() const override { return m_rdev; }
|
virtual dev_t rdev() const override { return m_rdev; }
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include <BAN/Array.h>
|
#include <BAN/Array.h>
|
||||||
#include <kernel/CriticalScope.h>
|
|
||||||
#include <kernel/Device/DeviceNumbers.h>
|
#include <kernel/Device/DeviceNumbers.h>
|
||||||
#include <kernel/FS/DevFS/FileSystem.h>
|
#include <kernel/FS/DevFS/FileSystem.h>
|
||||||
#include <kernel/IDT.h>
|
#include <kernel/IDT.h>
|
||||||
|
@ -219,6 +218,8 @@ namespace Kernel
|
||||||
void SerialTTY::handle_irq()
|
void SerialTTY::handle_irq()
|
||||||
{
|
{
|
||||||
uint8_t ch = IO::inb(m_serial.port());
|
uint8_t ch = IO::inb(m_serial.port());
|
||||||
|
|
||||||
|
SpinLockGuard _(m_input_lock);
|
||||||
if (m_input.full())
|
if (m_input.full())
|
||||||
{
|
{
|
||||||
dwarnln("Serial buffer full");
|
dwarnln("Serial buffer full");
|
||||||
|
@ -235,7 +236,7 @@ namespace Kernel
|
||||||
uint8_t buffer[128];
|
uint8_t buffer[128];
|
||||||
|
|
||||||
{
|
{
|
||||||
CriticalScope _;
|
SpinLockGuard _(m_input_lock);
|
||||||
if (m_input.empty())
|
if (m_input.empty())
|
||||||
return;
|
return;
|
||||||
uint8_t* ptr = buffer;
|
uint8_t* ptr = buffer;
|
||||||
|
|
Loading…
Reference in New Issue