diff options
author | bde <bde@FreeBSD.org> | 2004-05-20 16:12:19 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2004-05-20 16:12:19 +0000 |
commit | 36151be4c9b7001262472ef3fd5ad050c924d56e (patch) | |
tree | 52574935d911452d509382c1d70b2796c96d08a3 /sys/i386/include/profile.h | |
parent | 8a9e48f1da5334155976977769d9f88c1cb451a8 (diff) | |
download | FreeBSD-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/i386/include/profile.h')
-rw-r--r-- | sys/i386/include/profile.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/i386/include/profile.h b/sys/i386/include/profile.h index 01ed0d8..1c5ecf2 100644 --- a/sys/i386/include/profile.h +++ b/sys/i386/include/profile.h @@ -53,7 +53,26 @@ #define MCOUNT_DECL(s) #define MCOUNT_ENTER(s) #define MCOUNT_EXIT(s) +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#define MCOUNT_OVERHEAD(label) \ + __asm __volatile("pushl %0; call __mcount; popl %%ecx" \ + : \ + : "i" (profil) \ + : "ax", "dx", "cx", "memory") +#define MEXITCOUNT_OVERHEAD() \ + __asm __volatile("call .mexitcount; 1:" \ + : : \ + : "ax", "dx", "cx", "memory") +#define MEXITCOUNT_OVERHEAD_GETLABEL(labelp) \ + __asm __volatile("movl $1b,%0" : "=rm" (labelp)) +#elif defined(lint) +#define MCOUNT_OVERHEAD(label) +#define MEXITCOUNT_OVERHEAD() +#define MEXITCOUNT_OVERHEAD_GETLABEL() #else +#error +#endif /* !(__GNUC__ || __INTEL_COMPILER) */ +#else /* !GUPROF */ #define MCOUNT_DECL(s) u_long s; #ifdef SMP extern int mcount_lock; |