From: "Joseph S. Myers" <joseph@codesourcery.com>
To: <libc-ports@sourceware.org>
Subject: Stop MIPS setjmp / longjmp saving / restoring floating-point flags (bug 14909)
Date: Fri, 14 Jun 2013 21:43:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.1306142142530.4414@digraph.polyomino.org.uk> (raw)
I've applied this patch to fix bug 14909, MIPS setjmp / longjmp
wrongly saving and restoring floating-point exceptions and rounding
modes.
2013-06-14 Joseph Myers <joseph@codesourcery.com>
[BZ #14909]
* sysdeps/mips/bits/setjmp.h (struct __jmp_buf_internal_tag):
Rename __fpc_csr field to __glibc_reserved1.
* sysdeps/mips/setjmp_aux.c (__sigsetjmp_aux) [__mips_hard_float]:
Do not set __fpc_csr.
* sysdeps/mips/mips64/setjmp_aux.c (__sigsetjmp_aux)
[__mips_hard_float]: Likewise.
* sysdeps/mips/__longjmp.c (____longjmp) [__mips_hard_float]: Do
not use __fpc_csr.
* sysdeps/mips/mips64/__longjmp.c (__longjmp) [__mips_hard_float]:
Likewise.
diff --git a/ports/sysdeps/mips/__longjmp.c b/ports/sysdeps/mips/__longjmp.c
index 67bdb86..d1d7d64 100644
--- a/ports/sysdeps/mips/__longjmp.c
+++ b/ports/sysdeps/mips/__longjmp.c
@@ -47,10 +47,6 @@ ____longjmp (env_arg, val_arg)
asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[3]));
asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5]));
-
- /* Get and reconstruct the floating point csr. */
- asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
- asm volatile ("ctc1 $2, $31");
#endif
/* Get the GP. */
diff --git a/ports/sysdeps/mips/bits/setjmp.h b/ports/sysdeps/mips/bits/setjmp.h
index d35b12d..437848f 100644
--- a/ports/sysdeps/mips/bits/setjmp.h
+++ b/ports/sysdeps/mips/bits/setjmp.h
@@ -59,8 +59,8 @@ typedef struct __jmp_buf_internal_tag
__extension__ long long __gp;
#endif
- /* Floating point status register. */
- int __fpc_csr;
+ /* Unused (was floating point status register). */
+ int __glibc_reserved1;
/* Callee-saved floating point registers. */
#if _MIPS_SIM == _ABI64
diff --git a/ports/sysdeps/mips/mips64/__longjmp.c b/ports/sysdeps/mips/mips64/__longjmp.c
index 1e42e9c..bffb113 100644
--- a/ports/sysdeps/mips/mips64/__longjmp.c
+++ b/ports/sysdeps/mips/mips64/__longjmp.c
@@ -59,10 +59,6 @@ __longjmp (env_arg, val_arg)
asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5]));
#endif
-
- /* Get and reconstruct the floating point csr. */
- asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
- asm volatile ("ctc1 $2, $31");
#endif
/* Get the GP. */
diff --git a/ports/sysdeps/mips/mips64/setjmp_aux.c b/ports/sysdeps/mips/mips64/setjmp_aux.c
index 9515f44..9318303 100644
--- a/ports/sysdeps/mips/mips64/setjmp_aux.c
+++ b/ports/sysdeps/mips/mips64/setjmp_aux.c
@@ -71,11 +71,6 @@ __sigsetjmp_aux (jmp_buf env, int savemask, long long sp, long long fp,
asm volatile ("sd $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6]));
asm volatile ("sd $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7]));
-#ifdef __mips_hard_float
- /* .. and finally get and reconstruct the floating point csr. */
- asm ("cfc1 %0, $31" : "=r" (env[0].__jmpbuf[0].__fpc_csr));
-#endif
-
/* Save the signal mask if requested. */
return __sigjmp_save (env, savemask);
}
diff --git a/ports/sysdeps/mips/setjmp_aux.c b/ports/sysdeps/mips/setjmp_aux.c
index cb9ea24..26715b7 100644
--- a/ports/sysdeps/mips/setjmp_aux.c
+++ b/ports/sysdeps/mips/setjmp_aux.c
@@ -58,11 +58,6 @@ __sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp)
asm volatile ("sw $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6]));
asm volatile ("sw $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7]));
-#ifdef __mips_hard_float
- /* .. and finally get and reconstruct the floating point csr. */
- asm ("cfc1 %0, $31" : "=r" (env[0].__jmpbuf[0].__fpc_csr));
-#endif
-
/* Save the signal mask if requested. */
return __sigjmp_save (env, savemask);
}
--
Joseph S. Myers
joseph@codesourcery.com
reply other threads:[~2013-06-14 21:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1306142142530.4414@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=libc-ports@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).