This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/9726] New: Incorrect fp reg specified in mtfsf instruction used by powepc32 [set|swap]context().
- From: "rsa at us dot ibm dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 11 Jan 2009 17:07:00 -0000
- Subject: [Bug libc/9726] New: Incorrect fp reg specified in mtfsf instruction used by powepc32 [set|swap]context().
- Reply-to: sourceware-bugzilla at sourceware dot org
The [set|swap]context-common.S assembly code:
glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
is doing:
# ifdef _ARCH_PWR6
/* Use the extended four-operand version of the mtfsf insn. */
mtfsf 0xff,fp0,1,0
# else
when it should be doing:
# ifdef _ARCH_PWR6
/* Use the extended four-operand version of the mtfsf insn. */
mtfsf 0xff,fp31,1,0
# else
Because the FPSCR is restored into fp31, not fp0. This is a copy-paste error.
The testcase called 'tst-setcontext-fpscr.c' is supposed to catch these bugs
but it stored a temporary (but valid) FPSCR value into fp0. When
[set|swap]context() was called it set the FPSCR, but from the stale FPSCR value
in fp0, not from the saved value in fp31. So unfortunately the correct (but
stale) FPSCR value was restored and the test passed erroneously.
I will include a patch which corrects the assembly code in
[set|swap]context-common.S. I will fix the test-case to clobber fp0 after it
is no longer used so that temporary data won't make future tests pass
erroneously.
I will also attach a corrective patch.
The impact of not having this patch is that applications running on Power6, with
an older kernel, that use the setcontext() and swapcontext() routines in
powerpc32 will not restore the correct value of the FPSCR.
--
Summary: Incorrect fp reg specified in mtfsf instruction used by
powepc32 [set|swap]context().
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P1
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: rsa at us dot ibm dot com
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://sourceware.org/bugzilla/show_bug.cgi?id=9726
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.