mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
Kernel/aarch64: Implement critical section related functions
This commit is contained in:
parent
e8aff0c1c8
commit
c9118de5a6
1 changed files with 17 additions and 4 deletions
|
@ -136,12 +136,22 @@ public:
|
||||||
Aarch64::DAIF::set_I();
|
Aarch64::DAIF::set_I();
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE static void enter_critical() { VERIFY_NOT_REACHED(); }
|
// FIXME: Share the critical functions with x86/Processor.h
|
||||||
ALWAYS_INLINE static void leave_critical() { VERIFY_NOT_REACHED(); }
|
ALWAYS_INLINE static void enter_critical()
|
||||||
|
{
|
||||||
|
auto current_processor = current();
|
||||||
|
current_processor.m_in_critical = current_processor.in_critical() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALWAYS_INLINE static void leave_critical()
|
||||||
|
{
|
||||||
|
auto current_processor = current();
|
||||||
|
current_processor.m_in_critical = current_processor.in_critical() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE static u32 in_critical()
|
ALWAYS_INLINE static u32 in_critical()
|
||||||
{
|
{
|
||||||
VERIFY_NOT_REACHED();
|
return current().m_in_critical;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Actually return the idle thread once aarch64 supports threading.
|
// FIXME: Actually return the idle thread once aarch64 supports threading.
|
||||||
|
@ -161,6 +171,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]] static void halt();
|
[[noreturn]] static void halt();
|
||||||
|
|
||||||
|
private:
|
||||||
|
u32 m_in_critical { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue