tree 582ff483c58fea16a6613bcced22258501b39fd8
parent 1fd8ad75ce76eefffad84093d1f01d0dcc706ad8
author Chuck Ebbert <[EMAIL PROTECTED]> Tue, 23 Aug 2005 03:43:57 -0400
committer Marcelo Tosatti <[EMAIL PROTECTED]> Mon, 29 Aug 2005 01:16:49 -0300

[PATCH] i386: fix incorrect FP signal delivery

i386 floating-point exception handling has a bug that can cause error
code 0 to be sent instead of the proper code during signal delivery.

This is caused by unconditionally checking the IS and c1 bits from the
FPU status word when they are not always relevant.  The IS bit tells
whether an exception is a stack fault and is only relevant when the
exception is IE (invalid operation.) The C1 bit determines whether a
stack fault is overflow or underflow and is only relevant when IS and IE
are set.

diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c

 arch/i386/kernel/traps.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -631,15 +631,14 @@ void math_error(void *eip)
         */
        cwd = get_fpu_cwd(task);
        swd = get_fpu_swd(task);
-       switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) {
+       switch (swd & ~cwd & 0x3f) {
                case 0x000:
                default:
                        break;
                case 0x001: /* Invalid Op */
-               case 0x041: /* Stack Fault */
-               case 0x241: /* Stack Fault | Direction */
+                       /* swd & 0x240 == 0x040: Stack Fault */
+                       /* swd & 0x240 == 0x240: Stack Fault | Direction */
                        info.si_code = FPE_FLTINV;
-                       /* Should we clear the SF or let user space do it ???? 
*/
                        break;
                case 0x002: /* Denormalize */
                case 0x010: /* Underflow */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-24" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to