|
|
1.1 root 1: ////////
2: / libc/crt/i386/scount.s
3: / i386 C runtime library.
4: / Profile call counter.
5: ////////
6:
7: .globl _scount
8: .globl _fnclst
9: .globl _mhdr
10:
11: ////////
12: / Profile count routine.
13: / Called from the entry sequence of every function
14: / compiled with the -VPROF profile option.
15: / On entry:
16: / %ecx pointer to 12 byte block in BSS
17: / The block looks like this:
18: / .long ? ; vaddr_t pc
19: / .long ? ; long count
20: / .long ? ; struct m_flst * link into _fnclst
21: /
22: / C source (roughly; delete prolog and epilog, hack parameters):
23: / #include <mon.h>
24: /
25: / void
26: / _scount(pc, flp)
27: / vaddr_t pc; /* actually passed in (%esp) */
28: / register struct m_flst *flp; /* actually passed in %ecx */
29: / {
30: / ++flp->m_data.m_ncalls;
31: / if ((vaddr_t)&pc < _mhdr.m_lowsp)
32: / _mhdr.m_lowsp = (vaddr_t)&pc;
33: / if (flp->m_link == NULL) {
34: / flp->m_link = _fnclst;
35: / _fnclst = flp;
36: / flp->m_data.m_addr = pc;
37: / }
38: / }
39: ////////
40:
41: .text
42:
43: _scount:
44: incl 4(%ecx)
45: cmpl %esp, _mhdr+12
46: jae .L2
47: movl _mhdr+12, %esp
48: .L2:
49: cmpl 8(%ecx), $0
50: jne .L1
51: movl %eax, _fnclst
52: movl 8(%ecx), %eax
53: movl _fnclst, %ecx
54: movl %eax, (%esp)
55: movl (%ecx), %eax
56: .L1:
57: ret
58:
59: / end of libc/crt/i386/scount.s
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.