]> git.kernelconcepts.de Git - mv-sheeva.git/commit
arch/tile: handle rt_sigreturn() more cleanly
authorChris Metcalf <cmetcalf@tilera.com>
Tue, 14 Dec 2010 21:07:25 +0000 (16:07 -0500)
committerChris Metcalf <cmetcalf@tilera.com>
Fri, 17 Dec 2010 21:59:29 +0000 (16:59 -0500)
commit81711cee933599fa114abb0d258d8bbabef8adfb
treecef17c099689b15b3b8bb29b0eae84acd474ed8a
parentbc4cf2bb271b2d557fc510426755da786fc985be
arch/tile: handle rt_sigreturn() more cleanly

The current tile rt_sigreturn() syscall pattern uses the common idiom
of loading up pt_regs with all the saved registers from the time of
the signal, then anticipating the fact that we will clobber the ABI
"return value" register (r0) as we return from the syscall by setting
the rt_sigreturn return value to whatever random value was in the pt_regs
for r0.

However, this breaks in our 64-bit kernel when running "compat" tasks,
since we always sign-extend the "return value" register to properly
handle returned pointers that are in the upper 2GB of the 32-bit compat
address space.  Doing this to the sigreturn path then causes occasional
random corruption of the 64-bit r0 register.

Instead, we stop doing the crazy "load the return-value register"
hack in sigreturn.  We already have some sigreturn-specific assembly
code that we use to pass the pt_regs pointer to C code.  We extend that
code to also set the link register to point to a spot a few instructions
after the usual syscall return address so we don't clobber the saved r0.
Now it no longer matters what the rt_sigreturn syscall returns, and the
pt_regs structure can be cleanly and completely reloaded.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
arch/tile/include/asm/signal.h
arch/tile/kernel/compat_signal.c
arch/tile/kernel/intvec_32.S
arch/tile/kernel/signal.c