/* 
 * setjmp.h -- Cut from MSVC 6.0 
 */

/*
 * PSX MIPS implementation need _JBLEN only of 12
 */

#define _JBLEN      12


/*
 * Define jump buffer layout for setjmp/longjmp.
 */
typedef struct __JUMP_BUFFER {
      unsigned long IntRA;
      unsigned long IntSP;
      unsigned long IntFP;
      unsigned long IntS0;
      unsigned long IntS1;
      unsigned long IntS2;
      unsigned long IntS3;
      unsigned long IntS4;
      unsigned long IntS5;
      unsigned long IntS6;
      unsigned long IntS7;
      unsigned long IntGP;
} _JUMP_BUFFER;


/* Define the buffer type for holding the state information */

typedef _JUMP_BUFFER jmp_buf[_JBLEN];



#include <setjmp.h>

/* BFC02240 */
int setjmp(jmp_buf env)
{
      __asm
      {
            sw      ra, 0x00 (a0)      // IntRA
            sw      gp, 0x2c (a0)      // IntGP
            sw      sp, 0x04 (a0)      // IntSP
            sw      fp, 0x08 (a0)      // IntFP

            sw      s0, 0x0c (a0)      // IntS0
            sw      s1, 0x10 (a0)      // IntS1
            sw      s2, 0x14 (a0)      // IntS2
            sw      s3, 0x18 (a0)      // IntS3
            sw      s4, 0x1c (a0)      // IntS4
            sw      s5, 0x20 (a0)      // IntS5
            sw      s6, 0x24 (a0)      // IntS6
            sw      s7, 0x28 (a0)      // IntS7
      }

      return 0;
}



See also : longjmp