Skip to content

Commit 38a93d9

Browse files
committed
simd_powerpc.h: enable FPU on FreeBSD
FreeBSD nowadays supports FPU in the kernel on powerpc*, so enable it. Signed-off-by: Piotr Kubaj <[email protected]>
1 parent dd2a46b commit 38a93d9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

include/os/freebsd/spl/sys/simd_powerpc.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@
4949

5050
#include <machine/pcb.h>
5151
#include <machine/cpu.h>
52+
#include <machine/fpu.h>
5253

53-
#define kfpu_allowed() 0
54+
#define kfpu_allowed() 1
5455
#define kfpu_initialize(tsk) do {} while (0)
55-
#define kfpu_begin() do {} while (0)
56-
#define kfpu_end() do {} while (0)
56+
#define kfpu_begin() { \
57+
if (__predict_false(!is_fpu_kern_thread(0))) \
58+
fpu_kern_enter(PCPU_GET(curthread), NULL, FPU_KERN_NOCTX);\
59+
}
60+
#define kfpu_end() { \
61+
if (__predict_false(PCPU_GET(curpcb)->pcb_flags & PCB_KERN_FPU_NOSAVE))\
62+
fpu_kern_leave(PCPU_GET(curthread), NULL); \
63+
}
5764
#define kfpu_init() (0)
5865
#define kfpu_fini() do {} while (0)
5966

0 commit comments

Comments
 (0)