Enable FP Exception from userspace

Renato Benassato Riolino <[email protected]>
Newsgroups gmane.os.freebsd.devel.ppc
Message-ID <[email protected]>
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

Renato
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.