mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Kernel: Add interrupt related functions to Processor class
This adds {enable, disable}_interrupts() and are_interrupts_enabled() to the Processor class, and also implements them for x86(_64) and aarch64.
This commit is contained in:
parent
80be5f8044
commit
9413fe9fe5
Notes:
sideshowbarker
2024-07-17 10:31:31 +09:00
Author: https://github.com/FireFox317 Commit: https://github.com/SerenityOS/serenity/commit/9413fe9fe5 Pull-request: https://github.com/SerenityOS/serenity/pull/14146 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/nico ✅
2 changed files with 32 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <AK/Types.h>
|
||||
|
||||
#include <Kernel/Arch/ProcessorSpecificDataID.h>
|
||||
#include <Kernel/Arch/aarch64/Registers.h>
|
||||
|
||||
class VirtualAddress;
|
||||
|
||||
|
@ -119,6 +120,22 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static bool are_interrupts_enabled()
|
||||
{
|
||||
auto daif = Aarch64::DAIF::read();
|
||||
return !daif.I;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void enable_interrupts()
|
||||
{
|
||||
Aarch64::DAIF::clear_I();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void disable_interrupts()
|
||||
{
|
||||
Aarch64::DAIF::set_I();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void enter_critical() { VERIFY_NOT_REACHED(); }
|
||||
ALWAYS_INLINE static void leave_critical() { VERIFY_NOT_REACHED(); }
|
||||
ALWAYS_INLINE static u32 in_critical()
|
||||
|
|
|
@ -422,6 +422,21 @@ public:
|
|||
return m_features.has_flag(feature);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static bool are_interrupts_enabled()
|
||||
{
|
||||
return Kernel::are_interrupts_enabled();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void enable_interrupts()
|
||||
{
|
||||
sti();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void disable_interrupts()
|
||||
{
|
||||
cli();
|
||||
}
|
||||
|
||||
void check_invoke_scheduler();
|
||||
void invoke_scheduler_async() { m_invoke_scheduler_async = true; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue