Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135066269
D23623.id68492.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
D23623.id68492.diff
View Options
Index: sys/powerpc/include/psl.h
===================================================================
--- sys/powerpc/include/psl.h
+++ sys/powerpc/include/psl.h
@@ -88,7 +88,7 @@
#define PSL_FE_NONREC PSL_FE1 /* imprecise non-recoverable */
#define PSL_FE_REC PSL_FE0 /* imprecise recoverable */
#define PSL_FE_PREC (PSL_FE0 | PSL_FE1) /* precise */
-#define PSL_FE_DFLT PSL_FE_DIS /* default == none */
+#define PSL_FE_DFLT PSL_FE_PREC /* default == precise */
#ifndef LOCORE
extern register_t psl_kernset; /* Default MSR values for kernel */
Index: sys/powerpc/powerpc/exec_machdep.c
===================================================================
--- sys/powerpc/powerpc/exec_machdep.c
+++ sys/powerpc/powerpc/exec_machdep.c
@@ -1158,6 +1158,12 @@
sig = fpu_emulate(frame, &pcb->pcb_fpu);
if ((sig == 0 || sig == SIGFPE) && pcb->pcb_flags & PCB_FPU)
enable_fpu(td);
+#else
+ if (frame->srr1 & EXC_PGM_FPENABLED && (pcb->pcb_flags & PCB_FPU)) {
+ /* Floating-Point Enabled Exception type Program interrupt */
+ sig = SIGFPE;
+ enable_fpu(td);
+ }
#endif
if (sig == SIGILL) {
if (pcb->pcb_lastill != frame->srr0) {
Index: sys/powerpc/powerpc/trap.c
===================================================================
--- sys/powerpc/powerpc/trap.c
+++ sys/powerpc/powerpc/trap.c
@@ -397,8 +397,31 @@
ucode = ILL_PRVOPC;
else if (frame->srr1 & EXC_PGM_ILLEGAL)
ucode = ILL_ILLOPC;
- } else if (sig == SIGFPE)
- ucode = FPE_FLTINV; /* Punt for now, invalid operation. */
+ } else if (sig == SIGFPE && (td->td_pcb->pcb_flags & PCB_FPU)) {
+ int msr;
+ uint64_t reg;
+
+ msr = mfmsr();
+
+ mtmsr(msr | PSL_FP);
+ __asm __volatile ("mffs 0; stfd 0,0(%0)"
+ :: "b"(®));
+
+ mtmsr(msr);
+
+ if (reg & FPSCR_ZX)
+ ucode = FPE_FLTDIV;
+ else if (reg & FPSCR_OX)
+ ucode = FPE_FLTOVF;
+ else if (reg & FPSCR_UX)
+ ucode = FPE_FLTUND;
+ else if (reg & FPSCR_XX)
+ ucode = FPE_FLTRES;
+ else
+ ucode = FPE_FLTINV;
+
+ save_fpu(td);
+ }
}
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 7, 5:17 AM (20 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24980971
Default Alt Text
D23623.id68492.diff (2 KB)
Attached To
Mode
D23623: [POWERPC] Handles float point exception
Attached
Detach File
Event Timeline
Log In to Comment