1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifdef LIBC_SCCS
8: .asciz "@(#)_setjmp.s 5.5 (Berkeley) 3/9/86"
9: #endif LIBC_SCCS
10:
11:
12: /*
13: * C library -- _setjmp, _longjmp
14: *
15: * _longjmp(a,v)
16: * will generate a "return(v)" from
17: * the last call to
18: * _setjmp(a)
19: * by restoring registers from the stack,
20: * The previous signal state is NOT restored.
21: */
22:
23: #include "DEFS.h"
24:
25: ENTRY(_setjmp, 0)
26: movl 4(ap),r0
27: movl 12(fp),(r0) # save frame pointer of caller
28: movl 16(fp),4(r0) # save pc of caller
29: clrl r0
30: ret
31:
32: ENTRY(_longjmp, 0)
33: movl 8(ap),r0 # return(v)
34: movl 4(ap),r1 # fetch buffer
35: tstl (r1)
36: beql botch
37: loop:
38: bitw $1,6(fp) # r0 saved?
39: beql 1f
40: movl r0,20(fp)
41: bitw $2,6(fp) # was r1 saved?
42: beql 2f
43: movl r1,24(fp)
44: brb 2f
45: 1:
46: bitw $2,6(fp) # was r1 saved?
47: beql 2f
48: movl r1,20(fp)
49: 2:
50: cmpl (r1),12(fp)
51: beql done
52: blssu botch
53: movl $loop,16(fp)
54: ret # pop another frame
55:
56: done:
57: cmpb *16(fp),reiins # returning to an "rei"?
58: bneq 1f
59: movab 3f,16(fp) # do return w/ psl-pc pop
60: brw 2f
61: 1:
62: movab 4f,16(fp) # do standard return
63: 2:
64: ret # unwind stack before signals enabled
65: 3:
66: addl2 $8,sp # compensate for PSL-PC push
67: 4:
68: jmp *4(r1) # done, return....
69:
70: botch:
71: calls $0,_longjmperror
72: halt
73:
74: .data
75: reiins: rei
Defined functions
botch
defined in line
70; used 2 times
done
defined in line
56; used 1 times
loop
defined in line
37; used 1 times
Defined variables