Kernel: Add NZCV, Condition Flags

This commit is contained in:
konrad 2022-12-24 01:23:11 +01:00 committed by Andreas Kling
parent e7d4bbcde8
commit e1c3bf0ec0
Notes: sideshowbarker 2024-07-19 17:00:43 +09:00

View file

@ -741,4 +741,25 @@ struct DAIF {
}
};
static_assert(sizeof(DAIF) == 8);
// https://developer.arm.com/documentation/ddi0595/2021-03/AArch64-Registers/NZCV--Condition-Flags
// NZCV, Condition Flags
struct alignas(u64) NZCV {
u64 : 28;
u64 V : 1;
u64 C : 1;
u64 Z : 1;
u64 N : 1;
u64 : 32;
static inline NZCV read()
{
NZCV nzcv;
asm volatile("mrs %[value], nzcv"
: [value] "=r"(nzcv));
return nzcv;
}
};
static_assert(sizeof(NZCV) == 8);
}