aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Kondratyev <wulf@FreeBSD.org>2023-12-24 12:48:06 +0000
committerVladimir Kondratyev <wulf@FreeBSD.org>2023-12-24 12:48:06 +0000
commitb4efc62776344a9aaada5a0866e453e528a0e977 (patch)
tree863ad72310e85d49f8226107e755c7ba900fac12
parent9bf957fc9b378e0f9e65eb97e84c2166b450fccc (diff)
downloadsrc-b4efc62776344a9aaada5a0866e453e528a0e977.tar.gz
src-b4efc62776344a9aaada5a0866e453e528a0e977.zip
LinuxKPI: Do not use explicit context in FPU sections on powerpc64
It is not supported yet. Sponsored by: Serenity Cyber Security, LLC Fixes: 5a3bd281672b ("LinuxKPI: Add explicit software context to FPU sections") MFC after: 1 week
-rw-r--r--sys/compat/linuxkpi/common/include/linux/compat.h5
-rw-r--r--sys/compat/linuxkpi/common/src/linux_current.c9
-rw-r--r--sys/compat/linuxkpi/common/src/linux_fpu.c3
3 files changed, 8 insertions, 9 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/compat.h b/sys/compat/linuxkpi/common/include/linux/compat.h
index 7922e884beb1..d357abce732b 100644
--- a/sys/compat/linuxkpi/common/include/linux/compat.h
+++ b/sys/compat/linuxkpi/common/include/linux/compat.h
@@ -33,11 +33,6 @@
#include <sys/proc.h>
#include <sys/malloc.h>
-#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
- defined(__i386__) || defined(__powerpc64__)
-#define LKPI_HAVE_FPU_CTX
-#endif
-
struct domainset;
struct thread;
struct task_struct;
diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c
index 668185094cbe..04ad4e30aa54 100644
--- a/sys/compat/linuxkpi/common/src/linux_current.c
+++ b/sys/compat/linuxkpi/common/src/linux_current.c
@@ -43,7 +43,8 @@
#include <sys/sysctl.h>
#include <vm/uma.h>
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
+ defined(__i386__)
#include <machine/fpu.h>
#endif
@@ -160,7 +161,8 @@ linux_alloc_current(struct thread *td, int flags)
int
linux_set_fpu_ctx(struct task_struct *task)
{
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
+ defined(__i386__)
if (task->fpu_ctx == NULL && curthread->td_critnest == 0)
task->fpu_ctx = fpu_kern_alloc_ctx(FPU_KERN_NOWAIT);
#endif
@@ -190,7 +192,8 @@ void
linux_free_current(struct task_struct *ts)
{
mmput(ts->mm);
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
+ defined(__i386__)
if (ts->fpu_ctx != NULL)
fpu_kern_free_ctx(ts->fpu_ctx);
#endif
diff --git a/sys/compat/linuxkpi/common/src/linux_fpu.c b/sys/compat/linuxkpi/common/src/linux_fpu.c
index d510bc208b88..ef7f252cdd9e 100644
--- a/sys/compat/linuxkpi/common/src/linux_fpu.c
+++ b/sys/compat/linuxkpi/common/src/linux_fpu.c
@@ -35,7 +35,8 @@
#include <asm/fpu/api.h>
-#ifdef LKPI_HAVE_FPU_CTX
+#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \
+ defined(__i386__) || defined(__powerpc64__)
#include <machine/fpu.h>