Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149794752
D41759.1790925062.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D41759.1790925062.diff
View Options
diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c
--- a/sys/arm/arm/undefined.c
+++ b/sys/arm/arm/undefined.c
@@ -345,9 +345,19 @@
#endif
return;
}
+#ifdef VFP
+ /*
+ * Workaround to allow the execution of VFP instructions within
+ * the kernel. Allow the first in-kernel VFP instruction to be
+ * properly handled by this handler without panicing.
+ */
+ else if(uh != NULL)
+ return;
+#else
else
panic("Undefined instruction in kernel (0x%08x).\n",
fault_instruction);
+#endif
}
userret(td, frame);
diff --git a/sys/arm/arm/vfp.c b/sys/arm/arm/vfp.c
--- a/sys/arm/arm/vfp.c
+++ b/sys/arm/arm/vfp.c
@@ -33,9 +33,11 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/limits.h>
+#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/imgact_elf.h>
#include <sys/kernel.h>
+#include <sys/pcpu.h>
#include <machine/armreg.h>
#include <machine/elf.h>
@@ -45,6 +47,9 @@
#include <machine/undefined.h>
#include <machine/vfp.h>
+static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx",
+ "Kernel contexts for VFP state");
+
/* function prototypes */
static int vfp_bounce(u_int, u_int, struct trapframe *, int);
static void vfp_restore(struct vfp_state *);
@@ -205,8 +210,11 @@
struct pcb *curpcb;
ksiginfo_t ksi;
+#ifndef VFP
+ /* Allow in-kernel vfp instruction handling */
if ((code & FAULT_USER) == 0)
panic("undefined floating point instruction in supervisor mode");
+#endif
critical_enter();
@@ -257,12 +265,39 @@
critical_exit();
+#ifndef VFP
+ /*
+ * Allow kernel state in use when entering userspace as we now allow
+ * in-kernel VFP
+ */
KASSERT(curpcb->pcb_vfpsaved == &curpcb->pcb_vfpstate,
("Kernel VFP state in use when entering userspace"));
+#endif
return (0);
}
+struct fpu_kern_ctx *
+fpu_kern_alloc_ctx(u_int flags)
+{
+ struct fpu_kern_ctx *res;
+ size_t sz;
+
+ sz = sizeof(struct fpu_kern_ctx);
+ res = malloc(sz, M_FPUKERN_CTX, ((flags & FPU_KERN_NOWAIT) ?
+ M_NOWAIT : M_WAITOK) | M_ZERO);
+ return (res);
+}
+
+void
+fpu_kern_free_ctx(struct fpu_kern_ctx *ctx)
+{
+
+ KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) == 0, ("free'ing inuse ctx"));
+
+ free(ctx, M_FPUKERN_CTX);
+}
+
/*
* Update the VFP state for a forked process or new thread. The PCB will
* have been copied from the old thread.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 7:11 AM (18 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30093201
Default Alt Text
D41759.1790925062.diff (2 KB)
Attached To
Mode
D41759: arm: Allow in-kernel VFP instructions handling.
Attached
Detach File
Event Timeline
Log In to Comment