profile.h (139790) | profile.h (143063) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)profile.h 8.1 (Berkeley) 6/11/93 | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)profile.h 8.1 (Berkeley) 6/11/93 |
30 * $FreeBSD: head/sys/i386/include/profile.h 139790 2005-01-06 22:18:23Z imp $ | 30 * $FreeBSD: head/sys/i386/include/profile.h 143063 2005-03-02 21:33:29Z joerg $ |
31 */ 32 33#ifndef _MACHINE_PROFILE_H_ 34#define _MACHINE_PROFILE_H_ 35 | 31 */ 32 33#ifndef _MACHINE_PROFILE_H_ 34#define _MACHINE_PROFILE_H_ 35 |
36#ifndef _SYS_CDEFS_H_ 37#error this file needs sys/cdefs.h as a prerequisite 38#endif 39 |
|
36#ifdef _KERNEL 37 38/* 39 * Config generates something to tell the compiler to align functions on 16 40 * byte boundaries. A strict alignment is good for keeping the tables small. 41 */ 42#define FUNCTION_ALIGNMENT 16 43 --- 4 unchanged lines hidden (view full) --- 48 */ 49#define _MCOUNT_DECL void mcount 50#define MCOUNT 51 52#ifdef GUPROF 53#define MCOUNT_DECL(s) 54#define MCOUNT_ENTER(s) 55#define MCOUNT_EXIT(s) | 40#ifdef _KERNEL 41 42/* 43 * Config generates something to tell the compiler to align functions on 16 44 * byte boundaries. A strict alignment is good for keeping the tables small. 45 */ 46#define FUNCTION_ALIGNMENT 16 47 --- 4 unchanged lines hidden (view full) --- 52 */ 53#define _MCOUNT_DECL void mcount 54#define MCOUNT 55 56#ifdef GUPROF 57#define MCOUNT_DECL(s) 58#define MCOUNT_ENTER(s) 59#define MCOUNT_EXIT(s) |
56#if defined(__GNUC__) || defined(__INTEL_COMPILER) | 60#ifdef __GNUCLIKE_ASM |
57#define MCOUNT_OVERHEAD(label) \ 58 __asm __volatile("pushl %0; call __mcount; popl %%ecx" \ 59 : \ 60 : "i" (profil) \ 61 : "ax", "dx", "cx", "memory") 62#define MEXITCOUNT_OVERHEAD() \ 63 __asm __volatile("call .mexitcount; 1:" \ 64 : : \ 65 : "ax", "dx", "cx", "memory") 66#define MEXITCOUNT_OVERHEAD_GETLABEL(labelp) \ 67 __asm __volatile("movl $1b,%0" : "=rm" (labelp)) 68#elif defined(lint) 69#define MCOUNT_OVERHEAD(label) 70#define MEXITCOUNT_OVERHEAD() 71#define MEXITCOUNT_OVERHEAD_GETLABEL() 72#else 73#error | 61#define MCOUNT_OVERHEAD(label) \ 62 __asm __volatile("pushl %0; call __mcount; popl %%ecx" \ 63 : \ 64 : "i" (profil) \ 65 : "ax", "dx", "cx", "memory") 66#define MEXITCOUNT_OVERHEAD() \ 67 __asm __volatile("call .mexitcount; 1:" \ 68 : : \ 69 : "ax", "dx", "cx", "memory") 70#define MEXITCOUNT_OVERHEAD_GETLABEL(labelp) \ 71 __asm __volatile("movl $1b,%0" : "=rm" (labelp)) 72#elif defined(lint) 73#define MCOUNT_OVERHEAD(label) 74#define MEXITCOUNT_OVERHEAD() 75#define MEXITCOUNT_OVERHEAD_GETLABEL() 76#else 77#error |
74#endif /* !(__GNUC__ || __INTEL_COMPILER) */ | 78#endif /* !__GNUCLIKE_ASM */ |
75#else /* !GUPROF */ 76#define MCOUNT_DECL(s) u_long s; 77#ifdef SMP 78extern int mcount_lock; 79#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); \ 80 while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \ 81 /* nothing */ ; } 82#define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ --- 18 unchanged lines hidden (view full) --- 101 (uintfptr_t)btrap) : ~0U) 102 103#else /* !_KERNEL */ 104 105#define FUNCTION_ALIGNMENT 4 106 107#define _MCOUNT_DECL static __inline void _mcount 108 | 79#else /* !GUPROF */ 80#define MCOUNT_DECL(s) u_long s; 81#ifdef SMP 82extern int mcount_lock; 83#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); \ 84 while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \ 85 /* nothing */ ; } 86#define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ --- 18 unchanged lines hidden (view full) --- 105 (uintfptr_t)btrap) : ~0U) 106 107#else /* !_KERNEL */ 108 109#define FUNCTION_ALIGNMENT 4 110 111#define _MCOUNT_DECL static __inline void _mcount 112 |
109#if defined(__GNUC__) || defined(__INTEL_COMPILER) | 113#ifdef __GNUCLIKE_ASM |
110#define MCOUNT \ 111void \ 112mcount() \ 113{ \ 114 uintfptr_t selfpc, frompc; \ 115 /* \ 116 * Find the return address for mcount, \ 117 * and the return address for mcount's caller. \ --- 6 unchanged lines hidden (view full) --- 124 * The caller's stack frame has already been built, so %ebp is \ 125 * the caller's frame pointer. The caller's raddr is in the \ 126 * caller's frame following the caller's caller's frame pointer.\ 127 */ \ 128 __asm("movl (%%ebp),%0" : "=r" (frompc)); \ 129 frompc = ((uintfptr_t *)frompc)[1]; \ 130 _mcount(frompc, selfpc); \ 131} | 114#define MCOUNT \ 115void \ 116mcount() \ 117{ \ 118 uintfptr_t selfpc, frompc; \ 119 /* \ 120 * Find the return address for mcount, \ 121 * and the return address for mcount's caller. \ --- 6 unchanged lines hidden (view full) --- 128 * The caller's stack frame has already been built, so %ebp is \ 129 * the caller's frame pointer. The caller's raddr is in the \ 130 * caller's frame following the caller's caller's frame pointer.\ 131 */ \ 132 __asm("movl (%%ebp),%0" : "=r" (frompc)); \ 133 frompc = ((uintfptr_t *)frompc)[1]; \ 134 _mcount(frompc, selfpc); \ 135} |
132#else /* !(__GNUC__ || __INTEL_COMPILER) */ | 136#else /* !__GNUCLIKE_ASM */ |
133void \ 134#define MCOUNT \ 135mcount() \ 136{ \ 137} | 137void \ 138#define MCOUNT \ 139mcount() \ 140{ \ 141} |
138#endif /* __GNUC__ || __INTEL_COMPILER */ | 142#endif /* __GNUCLIKE_ASM */ |
139 140typedef u_int uintfptr_t; 141 142#endif /* _KERNEL */ 143 144/* 145 * An unsigned integral type that can hold non-negative difference between 146 * function pointers. --- 4 unchanged lines hidden (view full) --- 151 152void mcount(uintfptr_t frompc, uintfptr_t selfpc); 153 154#else /* !_KERNEL */ 155 156#include <sys/cdefs.h> 157 158__BEGIN_DECLS | 143 144typedef u_int uintfptr_t; 145 146#endif /* _KERNEL */ 147 148/* 149 * An unsigned integral type that can hold non-negative difference between 150 * function pointers. --- 4 unchanged lines hidden (view full) --- 155 156void mcount(uintfptr_t frompc, uintfptr_t selfpc); 157 158#else /* !_KERNEL */ 159 160#include <sys/cdefs.h> 161 162__BEGIN_DECLS |
159#if defined(__GNUC__) || defined(__INTEL_COMPILER) | 163#ifdef __GNUCLIKE_ASM |
160void mcount(void) __asm(".mcount"); 161#endif 162__END_DECLS 163 164#endif /* _KERNEL */ 165 166#endif /* !_MACHINE_PROFILE_H_ */ | 164void mcount(void) __asm(".mcount"); 165#endif 166__END_DECLS 167 168#endif /* _KERNEL */ 169 170#endif /* !_MACHINE_PROFILE_H_ */ |