mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:17:36 +00:00
Kernel: Add DAIF system register to aarch64 registers
This register can be used to check whether the 4 different types of interrupts are masked. A different variant can be used to set/clear specific interrupt bits.
This commit is contained in:
parent
2fd5e9f729
commit
80be5f8044
1 changed files with 35 additions and 0 deletions
|
@ -487,4 +487,39 @@ struct ESR_EL1 {
|
|||
};
|
||||
static_assert(sizeof(ESR_EL1) == 8);
|
||||
|
||||
// https://developer.arm.com/documentation/ddi0601/2020-12/AArch64-Registers/DAIF--Interrupt-Mask-Bits?lang=en
|
||||
// DAIF, Interrupt Mask Bits
|
||||
struct DAIF {
|
||||
u64 : 6;
|
||||
u64 F : 1;
|
||||
u64 I : 1;
|
||||
u64 A : 1;
|
||||
u64 D : 1;
|
||||
u64 : 54;
|
||||
|
||||
static inline DAIF read()
|
||||
{
|
||||
DAIF daif;
|
||||
|
||||
asm("mrs %[value], daif"
|
||||
: [value] "=r"(daif));
|
||||
|
||||
return daif;
|
||||
}
|
||||
|
||||
// Clearing the I bit, causes interrupts to be enabled.
|
||||
static inline void clear_I()
|
||||
{
|
||||
asm volatile("msr daifclr, #2" ::
|
||||
:);
|
||||
}
|
||||
|
||||
// Setting the I bit, causes interrupts to be disabled.
|
||||
static inline void set_I()
|
||||
{
|
||||
asm volatile("msr daifset, #2" ::
|
||||
:);
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(DAIF) == 8);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue