prof_machdep.c (129744) | prof_machdep.c (143063) |
---|---|
1/*- 2 * Copyright (c) 1996 Bruce D. Evans. 3 * 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1996 Bruce D. Evans. 3 * 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/i386/isa/prof_machdep.c 129744 2004-05-26 09:43:38Z bde $"); | 28__FBSDID("$FreeBSD: head/sys/i386/isa/prof_machdep.c 143063 2005-03-02 21:33:29Z joerg $"); |
29 30#ifdef GUPROF 31#include "opt_i586_guprof.h" 32#include "opt_perfmon.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/gmon.h> --- 27 unchanged lines hidden (view full) --- 64static int cputime_clock = CPUTIME_CLOCK_UNINITIALIZED; 65#ifdef I586_PMC_GUPROF 66static u_int cputime_clock_pmc_conf = I586_PMC_GUPROF; 67static int cputime_clock_pmc_init; 68static struct gmonparam saved_gmp; 69#endif 70#endif /* GUPROF */ 71 | 29 30#ifdef GUPROF 31#include "opt_i586_guprof.h" 32#include "opt_perfmon.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/gmon.h> --- 27 unchanged lines hidden (view full) --- 64static int cputime_clock = CPUTIME_CLOCK_UNINITIALIZED; 65#ifdef I586_PMC_GUPROF 66static u_int cputime_clock_pmc_conf = I586_PMC_GUPROF; 67static int cputime_clock_pmc_init; 68static struct gmonparam saved_gmp; 69#endif 70#endif /* GUPROF */ 71 |
72#if defined(__GNUC__) || defined(__INTEL_COMPILER) | 72#ifdef __GNUCLIKE_ASM |
73__asm(" \n\ 74GM_STATE = 0 \n\ 75GMON_PROF_OFF = 3 \n\ 76 \n\ 77 .text \n\ 78 .p2align 4,0x90 \n\ 79 .globl __mcount \n\ 80 .type __mcount,@function \n\ --- 36 unchanged lines hidden (view full) --- 117 pushl %edx \n\ 118 cli \n\ 119 call " __XSTRING(CNAME(mcount)) " \n\ 120 addl $8,%esp \n\ 121 popfl \n\ 122.mcount_exit: \n\ 123 ret \n\ 124"); | 73__asm(" \n\ 74GM_STATE = 0 \n\ 75GMON_PROF_OFF = 3 \n\ 76 \n\ 77 .text \n\ 78 .p2align 4,0x90 \n\ 79 .globl __mcount \n\ 80 .type __mcount,@function \n\ --- 36 unchanged lines hidden (view full) --- 117 pushl %edx \n\ 118 cli \n\ 119 call " __XSTRING(CNAME(mcount)) " \n\ 120 addl $8,%esp \n\ 121 popfl \n\ 122.mcount_exit: \n\ 123 ret \n\ 124"); |
125#else /* !(__GNUC__ || __INTEL_COMPILER) */ 126#error 127#endif /* __GNUC__ || __INTEL_COMPILER */ | 125#else /* !__GNUCLIKE_ASM */ 126#error this file needs to be ported to your compiler 127#endif /* __GNUCLIKE_ASM */ |
128 129#ifdef GUPROF 130/* 131 * [.]mexitcount saves the return register(s), loads selfpc and calls 132 * mexitcount(selfpc) to do the work. Someday it should be in a machine 133 * dependent file together with cputime(), __mcount and [.]mcount. cputime() 134 * can't just be put in machdep.c because it has to be compiled without -pg. 135 */ | 128 129#ifdef GUPROF 130/* 131 * [.]mexitcount saves the return register(s), loads selfpc and calls 132 * mexitcount(selfpc) to do the work. Someday it should be in a machine 133 * dependent file together with cputime(), __mcount and [.]mcount. cputime() 134 * can't just be put in machdep.c because it has to be compiled without -pg. 135 */ |
136#if defined(__GNUC__) || defined(__INTEL_COMPILER) | 136#ifdef __GNUCLIKE_ASM |
137__asm(" \n\ 138 .text \n\ 139# \n\ 140# Dummy label to be seen when gprof -u hides [.]mexitcount. \n\ 141# \n\ 142 .p2align 4,0x90 \n\ 143 .globl __mexitcount \n\ 144 .type __mexitcount,@function \n\ --- 18 unchanged lines hidden (view full) --- 163 call " __XSTRING(CNAME(mexitcount)) " \n\ 164 addl $4,%esp \n\ 165 popfl \n\ 166 popl %eax \n\ 167 popl %edx \n\ 168.mexitcount_exit: \n\ 169 ret \n\ 170"); | 137__asm(" \n\ 138 .text \n\ 139# \n\ 140# Dummy label to be seen when gprof -u hides [.]mexitcount. \n\ 141# \n\ 142 .p2align 4,0x90 \n\ 143 .globl __mexitcount \n\ 144 .type __mexitcount,@function \n\ --- 18 unchanged lines hidden (view full) --- 163 call " __XSTRING(CNAME(mexitcount)) " \n\ 164 addl $4,%esp \n\ 165 popfl \n\ 166 popl %eax \n\ 167 popl %edx \n\ 168.mexitcount_exit: \n\ 169 ret \n\ 170"); |
171#else /* !(__GNUC__ || __INTEL_COMPILER) */ 172#error 173#endif /* __GNUC__ || __INTEL_COMPILER */ | 171#endif /* __GNUCLIKE_ASM */ |
174 175/* 176 * Return the time elapsed since the last call. The units are machine- 177 * dependent. 178 */ 179int 180cputime() 181{ --- 166 unchanged lines hidden (view full) --- 348 *gp = saved_gmp; 349 perfmon_fini(0); 350 cputime_clock_pmc_init = FALSE; 351 } 352#endif 353} 354 355#else /* !GUPROF */ | 172 173/* 174 * Return the time elapsed since the last call. The units are machine- 175 * dependent. 176 */ 177int 178cputime() 179{ --- 166 unchanged lines hidden (view full) --- 346 *gp = saved_gmp; 347 perfmon_fini(0); 348 cputime_clock_pmc_init = FALSE; 349 } 350#endif 351} 352 353#else /* !GUPROF */ |
356#if defined(__GNUC__) || defined(__INTEL_COMPILER) | 354#ifdef __GNUCLIKE_ASM |
357__asm(" \n\ 358 .text \n\ 359 .p2align 4,0x90 \n\ 360 .globl " __XSTRING(HIDENAME(mexitcount)) " \n\ 361" __XSTRING(HIDENAME(mexitcount)) ": \n\ 362 ret \n\ 363"); | 355__asm(" \n\ 356 .text \n\ 357 .p2align 4,0x90 \n\ 358 .globl " __XSTRING(HIDENAME(mexitcount)) " \n\ 359" __XSTRING(HIDENAME(mexitcount)) ": \n\ 360 ret \n\ 361"); |
364#else /* !(__GNUC__ || __INTEL_COMPILER) */ 365#error 366#endif /* __GNUC__ || __INTEL_COMPILER */ | 362#endif /* __GNUCLIKE_ASM */ |
367#endif /* GUPROF */ | 363#endif /* GUPROF */ |