1: /* @(#)setjmp.s 2.1 SCCS id keyword */ 2: / C library -- setjmp, longjmp 3: 4: / longjmp(a,v) 5: / will generate a "return(v)" from 6: / the last call to 7: / setjmp(a) 8: / by restoring sp, r5, pc from `a' 9: / and doing a return. 10: / 11: 12: .globl _setjmp 13: .globl _longjmp 14: .globl csv, cret 15: 16: _setjmp: 17: mov 2(sp),r0 18: mov r5,(r0)+ 19: mov sp,(r0)+ 20: mov (sp),(r0) 21: clr r0 22: rts pc 23: 24: _longjmp: 25: jsr r5,csv 26: mov 4(r5),r1 27: mov 6(r5),r0 28: bne 1f 29: mov $1,r0 30: 1: 31: cmp (r5),(r1) 32: beq 1f 33: mov (r5),r5 34: bne 1b 35: / panic -- r2-r4 lost 36: mov (r1)+,r5 37: mov (r1)+,sp 38: mov (r1),(sp) 39: rts pc 40: 1: 41: mov 4(r1),2(r5) 42: jmp cret