1: #include "defs.h"
2:
3: MSG NOCFN;
4: int callpc;
5: char localok;
6: extern struct SYMbol *symbol;
7: char *errflg;
8: char curov;
9: int overlay;
10: long var[36];
11:
12: findroutine(cframe)
13: long cframe;
14: {
15: register int narg, inst;
16: int lastpc, back2;
17: char v;
18: char savov, curovl;
19:
20: v=FALSE; localok=FALSE; lastpc=callpc;
21: if(overlay) {
22: /*
23: * Save the previous overlay. Don't restore it,
24: * so that the next call will have the correct previous
25: * overlay. The caller must save and restor the original
26: * overlay if needed.
27: */
28: savov = curov;
29: curovl=get(cframe-2, DSP);
30: setovmap(curovl);
31: }
32: callpc=get(cframe+2, DSP); back2=get(leng(callpc-2), ISP);
33: IF (inst=get(leng(callpc-4), ISP)) == 04737 /* jsr pc,*$... */
34: THEN narg = 1;
35: ELIF (inst&~077)==04700 /* jsr pc,... */
36: THEN narg=0; v=(inst!=04767);
37: ELIF (back2&~077)==04700
38: THEN narg=0; v=TRUE;
39: ELSE errflg=NOCFN;
40: return(0);
41: FI
42: if (overlay)
43: setovmap(savov); /* previous overlay, for findsym */
44: if (findsym((v ? lastpc : ((inst==04767?callpc:0) + back2)),ISYM) == -1
45: && !v)
46: symbol = NULL;
47: else
48: localok=TRUE;
49: if (overlay)
50: setovmap(curovl);
51: inst = get(leng(callpc), ISP);
52: IF inst == 062706 /* add $n,sp */
53: THEN
54: narg += get(leng(callpc+2), ISP)/2;
55: return(narg);
56: FI
57: if (inst == 05726 || inst == 010026) /* tst (sp)+ or mov r0,(sp)+ */
58: return(narg+1);
59: IF inst == 022626 /* cmp (sp)+,(sp)+ */
60: THEN
61: return(narg+2);
62: FI
63: return(narg);
64: }
Defined functions
Defined variables
NOCFN
defined in line
3; used 1 times
callpc
defined in line
4; used 7 times
curov
defined in line
8; used 1 times
errflg
defined in line
7; used 1 times
var
defined in line
10;
never used