1 /* $NetBSD: _setjmp.S,v 1.3 2011/01/15 07:31:12 matt Exp $ */
3 #include <machine/asm.h>
6 __RCSID("$NetBSD: _setjmp.S,v 1.3 2011/01/15 07:31:12 matt Exp $")
10 * C library -- _setjmp, _longjmp
13 * will generate a "return(v?v:1)" from the last call to
15 * by restoring registers from the stack.
16 * The previous signal state is NOT restored.
20 mflr %r11 /* save return address */
21 mfcr %r12 /* save condition register */
22 mr %r10,%r1 /* save stack pointer */
23 mr %r9,%r2 /* save GPR2 (not needed) */
24 stmw %r9,8(%r3) /* save r9..r31 */
25 li %r3,0 /* indicate success */
30 lmw %r9,8(%r3) /* save r9..r31 */
31 mtlr %r11 /* restore LR */
32 mtcr %r12 /* restore CR */
33 mr %r2,%r9 /* restore GPR2 (not needed) */
34 mr %r1,%r10 /* restore stack */
35 or. %r3,%r4,%r4 /* get return value */
36 bnelr /* return if not 0 */
37 li %r3,1 /* what's the point? */