Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F111242630
D35247.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D35247.diff
View Options
diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -411,6 +411,29 @@
printf("spsr: %8x\n", frame->tf_spsr);
}
+#ifdef VFP
+static void
+fpe_trap(struct thread *td, void *addr, uint32_t exception)
+{
+ int code;
+
+ code = FPE_FLTIDO;
+ if ((exception & ISS_FP_TFV) != 0) {
+ if ((exception & ISS_FP_IOF) != 0)
+ code = FPE_FLTINV;
+ else if ((exception & ISS_FP_DZF) != 0)
+ code = FPE_FLTDIV;
+ else if ((exception & ISS_FP_OFF) != 0)
+ code = FPE_FLTOVF;
+ else if ((exception & ISS_FP_UFF) != 0)
+ code = FPE_FLTUND;
+ else if ((exception & ISS_FP_IXF) != 0)
+ code = FPE_FLTRES;
+ }
+ call_trapsignal(td, SIGFPE, code, addr, exception);
+}
+#endif
+
void
do_el1h_sync(struct thread *td, struct trapframe *frame)
{
@@ -556,11 +579,18 @@
switch (exception) {
case EXCP_FP_SIMD:
- case EXCP_TRAP_FP:
#ifdef VFP
vfp_restore_state();
#else
panic("VFP exception in userland");
+#endif
+ break;
+ case EXCP_TRAP_FP:
+#ifdef VFP
+ fpe_trap(td, (void *)frame->tf_elr, esr);
+ userret(td, frame);
+#else
+ panic("VFP exception in userland");
#endif
break;
case EXCP_SVC32:
diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h
--- a/sys/arm64/include/armreg.h
+++ b/sys/arm64/include/armreg.h
@@ -265,6 +265,14 @@
/* ESR_ELx */
#define ESR_ELx_ISS_MASK 0x01ffffff
+#define ISS_FP_TFV_SHIFT 23
+#define ISS_FP_TFV (0x01 << ISS_FP_TFV_SHIFT)
+#define ISS_FP_IOF 0x01
+#define ISS_FP_DZF 0x02
+#define ISS_FP_OFF 0x04
+#define ISS_FP_UFF 0x08
+#define ISS_FP_IXF 0x10
+#define ISS_FP_IDF 0x80
#define ISS_INSN_FnV (0x01 << 10)
#define ISS_INSN_EA (0x01 << 9)
#define ISS_INSN_S1PTW (0x01 << 7)
diff --git a/sys/sys/signal.h b/sys/sys/signal.h
--- a/sys/sys/signal.h
+++ b/sys/sys/signal.h
@@ -339,6 +339,7 @@
#define FPE_FLTRES 6 /* Floating point inexact result. */
#define FPE_FLTINV 7 /* Invalid floating point operation. */
#define FPE_FLTSUB 8 /* Subscript out of range. */
+#define FPE_FLTIDO 9 /* Input denormal operation */
/* codes for SIGTRAP */
#define TRAP_BRKPT 1 /* Process breakpoint. */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 2, 8:05 AM (20 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16920991
Default Alt Text
D35247.diff (2 KB)
Attached To
Mode
D35247: arm64: Enable Floating-point exception
Attached
Detach File
Event Timeline
Log In to Comment