Kernel/LibC: Use builtin functions over inline asm

Getting flags and saving/restoring sse state and reading TSC can be done
using compiler builtins
This commit is contained in:
2026-01-09 15:19:19 +02:00
parent a9ceab0415
commit 74f70ae4bd
5 changed files with 14 additions and 39 deletions

View File

@@ -82,8 +82,11 @@ namespace Kernel
static InterruptState get_interrupt_state()
{
uintptr_t flags;
asm volatile("pushf; pop %0" : "=rm"(flags));
#if ARCH(x86_64)
const auto flags = __builtin_ia32_readeflags_u64();
#elif ARCH(i686)
const auto flags = __builtin_ia32_readeflags_u32();
#endif
if (flags & (1 << 9))
return InterruptState::Enabled;
return InterruptState::Disabled;