Prex Home / Browse Source - Prex Version: 0.9.0

root/usr/arch/ppc/setjmp.S

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. setjmp
  2. longjmp

   1 /*      $NetBSD: _setjmp.S,v 1.2 2002/07/30 06:07:57 matt Exp $ */
   2 
   3 #include <machine/asm.h>
   4 #include <machine/setjmp.h>
   5 
   6 /*
   7  * C library -- setjmp, longjmp
   8  *
   9  *      longjmp(a,v)
  10  * will generate a "return(v)" from the last call to
  11  *      setjmp(a)
  12  * by restoring registers from the stack.
  13  * The previous signal state is restored.
  14  */
  15 
  16 ENTRY(setjmp)
  17         mflr    %r11                    /* save return address */
  18         mfcr    %r12                    /* save condition register */
  19         mr      %r10,%r1                /* save stack pointer */
  20         mr      %r9,%r2                 /* save GPR2 (not needed) */
  21         stmw    %r9,8(%r3)              /* save r9..r31 */
  22         li      %r3,0                   /* indicate success */
  23         blr                             /* return */
  24 
  25 ENTRY(longjmp)
  26         lmw     %r9,8(%r3)              /* save r9..r31 */
  27         mtlr    %r11                    /* restore LR */
  28         mtcr    %r12                    /* restore CR */
  29         mr      %r2,%r9                 /* restore GPR2 (not needed) */
  30         mr      %r1,%r10                /* restore stack */
  31         or.     %r3,%r4,%r4             /* get return value */
  32         bnelr                           /* return if not 0 */
  33         li      %r3,1                   /* what's the point? */
  34         blr                             /* return */

/* [<][>][^][v][top][bottom][index][help] */