summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_prof.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2004-05-20 16:12:19 +0000
committerbde <bde@FreeBSD.org>2004-05-20 16:12:19 +0000
commit36151be4c9b7001262472ef3fd5ad050c924d56e (patch)
tree52574935d911452d509382c1d70b2796c96d08a3 /sys/kern/subr_prof.c
parent8a9e48f1da5334155976977769d9f88c1cb451a8 (diff)
downloadFreeBSD-src-36151be4c9b7001262472ef3fd5ad050c924d56e.zip
FreeBSD-src-36151be4c9b7001262472ef3fd5ad050c924d56e.tar.gz
Moved i386 asms to an i386 header. The asms are for calibration of
high resolution kernel profiling (options GUPROF. "U" in GUPROF stands for microseconds resolution, but the resolution is now smaller than 1 nanosecond on multi-GHz machines and the accuracy is heading towards 1 nanosecond too). Arches that support GUPROF must now provide certain macros for the calibration. GUPROF is now only supported for i386's, so the absence of the new macros for other arches doesn't break anything that wasn't already broken. amd64's have uncommitted support for GUPROF, and sparc64's have support that seems to be complete except here (there was an #error for non-i386 cases; now there are undefined macros). Changed the asms a little: - declare them as __volatile. They must not be moved, and exporting a label across asms is technically incorrect, so try harder to stop gcc moving them. - don't put the non-clobbered register "bx" in the clobber list. The clobber lists are still more conservative than necessary. - drop the non-support for gcc-1. It just gave a better error message, and this is not useful since compiling with gcc-1 would cause thousands of worse error messages. - drop the support for aout.
Diffstat (limited to 'sys/kern/subr_prof.c')
-rw-r--r--sys/kern/subr_prof.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c
index a238f01..622dea7 100644
--- a/sys/kern/subr_prof.c
+++ b/sys/kern/subr_prof.c
@@ -57,8 +57,6 @@ SYSINIT(kmem, SI_SUB_KPROF, SI_ORDER_FIRST, kmstartup, NULL)
struct gmonparam _gmonparam = { GMON_PROF_OFF };
#ifdef GUPROF
-#include <machine/asmacros.h>
-
void
nullfunc_loop_profiled()
{
@@ -221,27 +219,13 @@ kmstartup(dummy)
startguprof(p);
for (i = 0; i < CALIB_SCALE; i++)
-#if defined(__i386__) && (__GNUC__ >= 2 || defined(__INTEL_COMPILER))
- __asm("pushl %0; call __mcount; popl %%ecx"
- :
- : "i" (profil)
- : "ax", "bx", "cx", "dx", "memory");
-#elif defined(lint)
-#else
-#error
-#endif
+ MCOUNT_OVERHEAD(profil);
mcount_overhead = KCOUNT(p, PC_TO_I(p, profil));
startguprof(p);
for (i = 0; i < CALIB_SCALE; i++)
-#if defined(__i386__) && (__GNUC__ >= 2 || defined(__INTEL_COMPILER))
- __asm("call " __XSTRING(HIDENAME(mexitcount)) "; 1:"
- : : : "ax", "bx", "cx", "dx", "memory");
- __asm("movl $1b,%0" : "=rm" (tmp_addr));
-#elif defined(lint)
-#else
-#error
-#endif
+ MEXITCOUNT_OVERHEAD();
+ MEXITCOUNT_OVERHEAD_GETLABEL(tmp_addr);
mexitcount_overhead = KCOUNT(p, PC_TO_I(p, tmp_addr));
p->state = GMON_PROF_OFF;
OpenPOWER on IntegriCloud