]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
[PATCH] m68knommu: fix a5 reg corruption in signal handlers
authorGreg Ungerer <gerg@snapgear.com>
Tue, 10 Jan 2006 06:42:59 +0000 (16:42 +1000)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 10 Jan 2006 17:31:26 +0000 (09:31 -0800)
commit01829e7212dd9ba3fa68bf8afffc9a175c44cb04
treeb8d6169303950a6b5e5049c3cde35433b25640e0
parentafc7cd8950572786c87ad081d8e65e5ea58b563c
[PATCH] m68knommu: fix a5 reg corruption in signal handlers

This is a patch adapted from a posting by Andrea Tarani which was
pointed out to me by Bernardo Innocenti.  Thanks to both of them for
their help and patience.

The original posting is here:
  http://mailman.uclinux.org/pipermail/uclinux-dev/2005-July/033543.html

The problem first manifest itself as busybox ping terminating with an
"Illegal instruction".  I reduced this to a test case and found that
variable size arrays allocated on the stack could lead to stacks not
aligned on 32 bit boundaries.  For the Coldfire this proved fatal.

Having been pointed out this patch by Bernardo, I applied it and it
fixed the first test case.  I then went back to busybox's ping.  This
still failed with "Illegal instruction", but in a different way.  Before
it depended on the size allocated for the ping buffer, now it happened
every time.  I also found it depended on optimisation level (gcc-3.4.0)
-Os was okay but not -O2.

After a lot of looking, it turned out that register a5 was being
corrupted by the signal handler (after applying the patch).  I re-worked
the patch a bit to save/restore a5 and now all seems well.

Patch submitted by Stuart Hughs <stuarth@freescale.com>

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/m68knommu/kernel/signal.c