[PATCH,rs6000] fix interrupt safety issue on E500 targets

Nathan Froyd froydnj@codesourcery.com
Wed Oct 3 14:18:00 GMT 2007


The attached patch fixes an interrupt safety problem on E500 targets;
this problem was introduced by the ABI fixes that were committed several
months ago.  On SPE targets we would generate the following code for a
function epilogue:

    point r11 into the stack frame
    restore registers
    restore stack pointer
    return

and the instruction scheduler, being clever, would turn this into:

    point r11 into the stack frame
    restore a few registers
    restore stack pointer
    restore remaining registers		(XXX)
    return

Which causes problems if an interrupt happens during XXX because the OS
will clobber the space from which we are restoring registers, believing
it to be unused.

The fix is simple.  We just have to tell the scheduler that we
have a blocking insn just before the restore of the stack pointer.

Tested on powerpc-none-linux-gnuspe with no regressions.  OK to commit?

-Nathan

2007-10-03  Nathan Froyd  <froydnj@codesourcery.com>

	gcc/
	* config/rs6000/rs6000.c (rs6000_emit_epilogue): Emit a stack tie
	when compiling for SPE targets due to r11 pointing into the frame.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: r14-add-insn.patch
Type: text/x-diff
Size: 999 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071003/efaee68a/attachment.bin>


More information about the Gcc-patches mailing list