From 73a209c0f7e350d819ce4b98374d4f2b83f7300d Mon Sep 17 00:00:00 2001
From: Ian Moffett <ian@osmora.org>
Date: Wed, 13 Mar 2024 21:20:53 -0400
Subject: kernel/amd64: cpu: Add fxsave/fxrstor helpers

Signed-off-by: Ian Moffett <ian@osmora.org>
---
 sys/include/arch/amd64/cpu.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'sys')

diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h
index 1968569..ee9bad7 100644
--- a/sys/include/arch/amd64/cpu.h
+++ b/sys/include/arch/amd64/cpu.h
@@ -138,6 +138,18 @@ amd64_write_cr4(uint64_t val)
     __ASMV("mov %0, %%cr4" :: "r" (val) : "memory");
 }
 
+static inline void
+amd64_fxsave(void *area)
+{
+    __ASMV("fxsave (%0)" :: "r" (area) : "memory");
+}
+
+static inline void
+amd64_fxrstor(void *area)
+{
+    __ASMV("fxrstor (%0)" :: "r" (area) : "memory");
+}
+
 struct cpu_info *amd64_this_cpu(void);
 
 #endif  /* !_AMD64_CPU_H_ */
-- 
cgit v1.2.3