linux-mips
[Top] [All Lists]

[PATCH] wrong use of compute_return_epc() in /mips/kernel/traps.c

To: linux-mips@oss.sgi.com
Subject: [PATCH] wrong use of compute_return_epc() in /mips/kernel/traps.c
From: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
Date: Tue, 24 Jul 2001 08:04:11 +0200
Sender: owner-linux-mips@oss.sgi.com
User-agent: Mutt/1.3.18i
Hi All,

somebody made wrong assumptions about how compute_return_epc() works.
It does not return the epc but stores it in the register struct.
Return value is -EFAULT or zero.

I've speculated below how the right solution might look, but I
don't know enough about signal handling to be sure.


Thiemo


diff -BurPX /bigdisk/src/dontdiff linux-orig/arch/mips/kernel/traps.c 
linux/arch/mips/kernel/traps.c
--- linux-orig/arch/mips/kernel/traps.c Sat Jul 14 18:49:46 2001
+++ linux/arch/mips/kernel/traps.c      Sun Jul 22 08:44:57 2001
@@ -378,8 +378,11 @@
                else
                        info.si_code = FPE_INTOVF;
                info.si_signo = SIGFPE;
-               info.si_errno = 0;
-               info.si_addr = (void *)compute_return_epc(regs);
+               info.si_errno = compute_return_epc(regs);
+               if (info.si_errno)
+                       info.si_addr = NULL;
+               else
+                       info.si_addr = (void *)regs->cp0_epc;
                force_sig_info(SIGFPE, &info, current);
                break;
        default:
@@ -418,8 +421,11 @@
                else
                        info.si_code = FPE_INTOVF;
                info.si_signo = SIGFPE;
-               info.si_errno = 0;
-               info.si_addr = (void *)compute_return_epc(regs);
+               info.si_errno = compute_return_epc(regs);
+               if (info.si_errno)
+                       info.si_addr = NULL;
+               else
+                       info.si_addr = (void *)regs->cp0_epc;
                force_sig_info(SIGFPE, &info, current);
                break;
        default:

<Prev in Thread] Current Thread [Next in Thread>