1: / C library -- setjmp, longjmp
2: / Overlay version -- beleives in 4 word jump vector
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, ovno from `a'
9: / and doing a return.
10: /
11:
12: .globl _setjmp
13: .globl _longjmp
14: .globl csv, cret
15: .globl __ovno
16:
17: _setjmp:
18: mov 2(sp),r0
19: mov r5,(r0)+
20: mov sp,(r0)+
21: mov (sp),(r0)+ /
22: mov __ovno,(r0) /
23: clr r0
24: rts pc
25:
26: _longjmp:
27: jsr r5,csv
28: mov 4(r5),r1
29: mov 6(r5),r0
30: bne 1f
31: mov $1,r0
32: 1:
33: cmp (r5),(r1)
34: beq 1f
35: mov (r5),r5
36: bne 1b
37: / panic -- r2-r4 lost
38: mov (r1)+,r5
39: mov (r1)+,sp
40: mov (r1)+,(sp)
41: / make pseudo-frame, so can use cret
42: / to do return;
43: / this routine can be anywhere instead of
44: / forced into the root overlay
45: mov r5,-(sp)
46: mov sp,r5
47: mov (r1),-(sp) / old ovno
48: mov r4,-(sp)
49: mov r3,-(sp)
50: mov r2,-(sp)
51: jmp cret
52: 1:
53: mov 4(r1),2(r5)
54: mov 6(r1),-2(r5) / rewrite ovno in frame
55: jmp cret
Defined functions
_longjmp
declared in line
13; defined in line
26; used 1 times
_setjmp
declared in line
12; defined in line
17; used 1 times