mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +00:00
Kernel/SMP: Change critical sections to not disable interrupts
Leave interrupts enabled so that we can still process IRQs. Critical sections should only prevent preemption by another thread. Co-authored-by: Tom <tomut@yahoo.com>
This commit is contained in:
parent
364134ad4b
commit
0a02496f04
6 changed files with 42 additions and 60 deletions
|
@ -28,15 +28,13 @@ public:
|
|||
}
|
||||
|
||||
ScopedCritical(ScopedCritical&& from)
|
||||
: m_prev_flags(exchange(from.m_prev_flags, 0))
|
||||
, m_valid(exchange(from.m_valid, false))
|
||||
: m_valid(exchange(from.m_valid, false))
|
||||
{
|
||||
}
|
||||
|
||||
ScopedCritical& operator=(ScopedCritical&& from)
|
||||
{
|
||||
if (&from != this) {
|
||||
m_prev_flags = exchange(from.m_prev_flags, 0);
|
||||
m_valid = exchange(from.m_valid, false);
|
||||
}
|
||||
return *this;
|
||||
|
@ -46,18 +44,17 @@ public:
|
|||
{
|
||||
VERIFY(m_valid);
|
||||
m_valid = false;
|
||||
Processor::leave_critical(m_prev_flags);
|
||||
Processor::leave_critical();
|
||||
}
|
||||
|
||||
void enter()
|
||||
{
|
||||
VERIFY(!m_valid);
|
||||
m_valid = true;
|
||||
Processor::enter_critical(m_prev_flags);
|
||||
Processor::enter_critical();
|
||||
}
|
||||
|
||||
private:
|
||||
u32 m_prev_flags { 0 };
|
||||
bool m_valid { false };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue