linux/arch/powerpc/kernel
David Gibson 25c8a78b1e [PATCH] powerpc: Fix handling of fpscr on 64-bit
The recent merge of fpu.S broken the handling of fpscr for
ARCH=powerpc and CONFIG_PPC64=y.  FP registers could be corrupted,
leading to strange random application crashes.

The confusion arises, because the thread_struct has (and requires) a
64-bit area to save the fpscr, because we use load/store double
instructions to get it in to/out of the FPU.  However, only the low
32-bits are actually used, so we want to treat it as a 32-bit quantity
when manipulating its bits to avoid extra load/stores on 32-bit.  This
patch replaces the current definition with a structure of two 32-bit
quantities (pad and val), to clarify things as much as is possible.
The 'val' field is used when manipulating bits, the structure itself
is used when obtaining the address for loading/unloading the value
from the FPU.

While we're at it, consolidate the 4 (!) almost identical versions of
cvt_fd() and cvt_df() (arch/ppc/kernel/misc.S,
arch/ppc64/kernel/misc.S, arch/powerpc/kernel/misc_32.S,
arch/powerpc/kernel/misc_64.S) into a single version in fpu.S.  The
new version takes a pointer to thread_struct and applies the correct
offset itself, rather than a pointer to the fpscr field itself, again
to avoid confusion as to which is the correct field to use.

Finally, this patch makes ARCH=ppc64 also use the consolidated fpu.S
code, which it previously did not.

Built for G5 (ARCH=ppc64 and ARCH=powerpc), 32-bit powermac (ARCH=ppc
and ARCH=powerpc) and Walnut (ARCH=ppc, CONFIG_MATH_EMULATION=y).
Booted on G5 (ARCH=powerpc) and things which previously fell over no
longer do.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-27 20:48:50 +10:00
..
asm-offsets.c powerpc: Merge rtas.c into arch/powerpc/kernel 2005-10-26 17:05:24 +10:00
binfmt_elf32.c ppc64: merge binfmt_elf32.c 2005-10-13 13:40:54 +10:00
btext.c powerpc: Get 64-bit configs to compile with ARCH=powerpc 2005-10-10 22:50:37 +10:00
cputable.c Merge changes from linux-2.6 by hand 2005-10-22 16:51:34 +10:00
entry_32.S powerpc: Merge rtas.c into arch/powerpc/kernel 2005-10-26 17:05:24 +10:00
entry_64.S powerpc: change sys32_ to compat_sys_ 2005-10-18 14:51:57 +10:00
fpu.S [PATCH] powerpc: Fix handling of fpscr on 64-bit 2005-10-27 20:48:50 +10:00
head_4xx.S [PATCH] powerpc: replace use of _GLOBAL with .globl 2005-10-17 21:43:12 +10:00
head_8xx.S powerpc: merge idle_power4.S and trapc.s 2005-10-01 18:43:42 +10:00
head_32.S powerpc: Merge 32-bit CHRP support. 2005-10-26 21:45:56 +10:00
head_44x.S [PATCH] powerpc: replace use of _GLOBAL with .globl 2005-10-17 21:43:12 +10:00
head_64.S powerpc: Merge in 64-bit powermac support. 2005-10-22 16:02:39 +10:00
head_fsl_booke.S [PATCH] powerpc: replace use of _GLOBAL with .globl 2005-10-17 21:43:12 +10:00
idle_6xx.S powerpc: Use reg.h instead of processor.h when we just want reg names 2005-10-10 22:20:10 +10:00
idle_power4.S [PATCH] powerpc: Fix use of LOADBASE in merge tree 2005-10-17 21:43:12 +10:00
init_task.c powerpc: make process.c suitable for both 32-bit and 64-bit 2005-10-10 22:29:05 +10:00
lparmap.c powerpc: move lparmap.c to arch/powerpc/kernel 2005-10-10 22:45:07 +10:00
Makefile [PATCH] powerpc: Fix handling of fpscr on 64-bit 2005-10-27 20:48:50 +10:00
misc_32.S [PATCH] powerpc: Fix handling of fpscr on 64-bit 2005-10-27 20:48:50 +10:00
misc_64.S [PATCH] powerpc: Fix handling of fpscr on 64-bit 2005-10-27 20:48:50 +10:00
of_device.c powerpc: Merge of_device.c and of_device.h 2005-10-06 13:22:17 +10:00
pmc.c [PATCH] powerpc: Merge ppc64 pmc.[ch] with ppc32 perfmon.[ch] 2005-10-20 16:22:24 +10:00
ppc_ksyms.c powerpc: Pull common bits of setup_{32,64}.c into setup-common.c 2005-10-26 17:11:18 +10:00
process.c [PATCH] powerpc: Fix handling of fpscr on 64-bit 2005-10-27 20:48:50 +10:00
prom_init.c powerpc: Fixes to get the Longtrail CHRP a bit further 2005-10-26 21:52:53 +10:00
prom.c powerpc: Fix interrupt-tree parsing 2005-10-26 17:19:06 +10:00
ptrace32.c powerpc: Move ptrace32.c from arch/ppc64 to arch/powerpc 2005-10-20 09:11:29 +10:00
ptrace.c powerpc: Move ptrace32.c from arch/ppc64 to arch/powerpc 2005-10-20 09:11:29 +10:00
rtas.c powerpc: Merge rtas.c into arch/powerpc/kernel 2005-10-26 17:05:24 +10:00
semaphore.c powerpc: Merge enough to start building in arch/powerpc. 2005-09-26 16:04:21 +10:00
setup_32.c powerpc: Merge 32-bit CHRP support. 2005-10-26 21:45:56 +10:00
setup_64.c [PATCH] ppc64: remove arch/ppc64/kernel/setup.c 2005-10-27 20:20:42 +10:00
setup-common.c powerpc: Pull common bits of setup_{32,64}.c into setup-common.c 2005-10-26 17:11:18 +10:00
signal_32.c [PATCH] powerpc: Fix handling of fpscr on 64-bit 2005-10-27 20:48:50 +10:00
sys_ppc32.c Merge rsync://oak/kernels/iseries/work/ 2005-10-18 14:53:41 +10:00
syscalls.c [PATCH] powerpc: Fix mmap returning 64 bit addresses 2005-10-21 22:47:52 +10:00
systbl.S Merge rsync://oak/kernels/iseries/work/ 2005-10-18 14:53:41 +10:00
time.c [PATCH] powerpc: Add support for Book-E timer config to generic_calibrate_decr 2005-10-26 15:55:46 +10:00
traps.c [PATCH] powerpc: Fix handling of fpscr on 64-bit 2005-10-27 20:48:50 +10:00
vecemu.c [PATCH] powerpc: Move arch/ppc*/kernel/vecemu.c to arch/powerpc 2005-09-21 19:21:07 +10:00
vector.S powerpc: Use reg.h instead of processor.h when we just want reg names 2005-10-10 22:20:10 +10:00
vio.c powerpc: Add a shutdown member to vio_driver 2005-10-24 17:40:23 +10:00
vmlinux.lds.S powerpc: Reduce the 32/64-bit diffs in vmlinux.lds.S 2005-10-10 22:38:46 +10:00