Commit | Line | Data |
---|---|---|
15242900 | 1 | /* |
789f2822 KB |
2 | * Copyright (c) 1992, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
15242900 KM |
4 | * |
5 | * %sccs.include.redist.c% | |
6 | * | |
789f2822 | 7 | * @(#)profile.h 8.1 (Berkeley) %G% |
15242900 KM |
8 | */ |
9 | ||
10 | #define _MCOUNT_DECL static inline void _mcount | |
11 | ||
12 | #define MCOUNT \ | |
13 | extern void mcount() asm("mcount"); void mcount() { \ | |
14 | int selfpc, frompcindex; \ | |
15 | /* \ | |
16 | * find the return address for mcount, \ | |
17 | * and the return address for mcount's caller. \ | |
18 | * \ | |
19 | * selfpc = pc pushed by mcount call \ | |
20 | */ \ | |
21 | asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \ | |
22 | /* \ | |
23 | * frompcindex = pc pushed by jsr into self. \ | |
24 | * In GCC the caller's stack frame has already been built so we \ | |
25 | * have to chase a6 to find caller's raddr. \ | |
26 | */ \ | |
27 | asm("movl (%%ebp),%0" : "=r" (frompcindex)); \ | |
2a4c3368 | 28 | frompcindex = ((int *)frompcindex)[1]; \ |
15242900 KM |
29 | _mcount(frompcindex, selfpc); \ |
30 | } |