1/* Copyright (c) 2003 Anthony Green <green@moxielogic.com> */ 2/* This is a simple version of setjmp and longjmp for iq2000. */ 3 4 5/* int setjmp (jmp_buf); */ 6 .globl setjmp 7 .ent setjmp 8setjmp: 9 sw r16,0(r4) /* rs0 */ 10 sw r17,4(r4) /* rs1 */ 11 sw r18,8(r4) /* rs2 */ 12 sw r19,12(r4) /* rs3 */ 13 sw r20,16(r4) /* rs4 */ 14 sw r21,20(r4) /* rs5 */ 15 sw r22,24(r4) /* rs6 */ 16 sw r23,28(r4) /* rs7 */ 17 sw r30,32(r4) /* rs8 */ 18 19 sw r29,36(r4) 20 sw r31,40(r4) 21 22 move r2,r0 23 24 j r31 25 26 .end setjmp 27 28/* volatile void longjmp (jmp_buf, int); */ 29 .globl longjmp 30 .ent longjmp 31longjmp: 32 lw r16,0(r4) /* rs0 */ 33 lw r17,4(r4) /* rs1 */ 34 lw r18,8(r4) /* rs2 */ 35 lw r19,12(r4) /* rs3 */ 36 lw r20,16(r4) /* rs4 */ 37 lw r21,20(r4) /* rs5 */ 38 lw r22,24(r4) /* rs6 */ 39 lw r23,28(r4) /* rs7 */ 40 lw r30,32(r4) /* rs8 */ 41 42 lw r29,36(r4) 43 lw r31,40(r4) 44 45 bne r5,r0,1f 46 li r5,1 471: 48 move r2,r5 49 50 j r31 51 52 .end longjmp 53