aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/os/freebsd/spl/sys/simd_aarch64.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/os/freebsd/spl/sys/simd_aarch64.h b/include/os/freebsd/spl/sys/simd_aarch64.h
index df33bdaec..234f401db 100644
--- a/include/os/freebsd/spl/sys/simd_aarch64.h
+++ b/include/os/freebsd/spl/sys/simd_aarch64.h
@@ -44,13 +44,23 @@
#define _FREEBSD_SIMD_AARCH64_H
#include <sys/types.h>
+#include <sys/ucontext.h>
#include <machine/elf.h>
+#include <machine/fpu.h>
#include <machine/md_var.h>
+#include <machine/pcb.h>
#define kfpu_allowed() 1
#define kfpu_initialize(tsk) do {} while (0)
-#define kfpu_begin() do {} while (0)
-#define kfpu_end() do {} while (0)
+#define kfpu_begin() do { \
+ if (__predict_false(!is_fpu_kern_thread(0))) \
+ fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); \
+} while (0)
+
+#define kfpu_end() do { \
+ if (__predict_false(curthread->td_pcb->pcb_fpflags & PCB_FP_NOSAVE)) \
+ fpu_kern_leave(curthread, NULL); \
+} while (0)
#define kfpu_init() (0)
#define kfpu_fini() do {} while (0)