1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

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.
This commit is contained in:
Bruce Evans 2004-05-20 16:12:19 +00:00
parent 56d01be439
commit e77c22bf45
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129498
2 changed files with 22 additions and 19 deletions

View File

@ -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;

View File

@ -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;