Date: Tue, 11 Feb 2020 16:54:37 +0000 From: Renato Benassato Riolino <renato.riolino@eldorado.org.br> To: "freebsd-ppc@freebsd.org" <freebsd-ppc@freebsd.org> Subject: Enable FP Exception from userspace Message-ID: <7c1f85d3d510c2654834eb8778d4d22f885f835b.camel@eldorado.org.br>
index | next in thread | raw e-mail
Hi all, I'm working on a small patch on kernel to handle float point exception to trigger a SIGFPE to the process. Right now I'm stuck on how an userspace app could enable FPE on PPC? Just calling feenableexcept(FE_ALL_EXCEPT) isn't enough. I need to set FE0 or FE1 or both (imprecise non-recoverable, imprecise recoverable and precise) on MSR, but I have no idea how to do so from userspace. I was able to make it work using getcontext() and setcontext() but it looked very hackish. From PowerISA V2.07B, Book III-S, Chapter 6.5.9: A Floating-Point Enabled Exception type Program interrupt is generated when the value of the expression (MSR FE0 | MSR FE1 ) & FPSCR FEX is 1. FPSCR FEX is set to 1 by the execution of a floating-point instruction that causes an enabled exception, including the case of a Move To FPSCR instruction that causes an exception bit and the corresponding enable bit both to be 1. Thanks Renatohelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7c1f85d3d510c2654834eb8778d4d22f885f835b.camel>
