Index: arch/i386/i386/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v retrieving revision 1.314 diff -u -r1.314 machdep.c --- arch/i386/i386/machdep.c 24 Dec 2004 21:22:00 -0000 1.314 +++ arch/i386/i386/machdep.c 4 Jan 2005 11:59:29 -0000 @@ -4185,10 +4185,9 @@ splraise(ncpl) int ncpl; { - int ocpl = lapic_tpr; + int ocpl; - if (ncpl > ocpl) - lapic_tpr = ncpl; + _SPLRAISE(ocpl, ncpl); return (ocpl); } @@ -4200,9 +4199,7 @@ splx(ncpl) int ncpl; { - lapic_tpr = ncpl; - if (ipending & IUNMASK(ncpl)) - Xspllower(); + _SPLX(ncpl); } /* Index: arch/i386/include/intr.h =================================================================== RCS file: /cvs/src/sys/arch/i386/include/intr.h,v retrieving revision 1.23 diff -u -r1.23 intr.h --- arch/i386/include/intr.h 24 Dec 2004 21:22:01 -0000 1.23 +++ arch/i386/include/intr.h 4 Jan 2005 11:59:35 -0000 @@ -88,6 +88,21 @@ #endif /* + * Define the splraise and splx code in macros, so that the code can be + * reused in a profiling build in a way that does not cause recursion. + */ +#define _SPLRAISE(ocpl, ncpl) \ + ocpl = lapic_tpr; \ + if (ncpl > ocpl) \ + lapic_tpr = ncpl + + +#define _SPLX(ncpl) \ + lapic_tpr = ncpl; \ + if (ipending & IUNMASK(ncpl)) \ + Xspllower() + +/* * Hardware interrupt masks */ #define splbio() splraise(IPL_BIO) Index: arch/i386/include/profile.h =================================================================== RCS file: /cvs/src/sys/arch/i386/include/profile.h,v retrieving revision 1.9 diff -u -r1.9 profile.h --- arch/i386/include/profile.h 21 Aug 2003 05:08:15 -0000 1.9 +++ arch/i386/include/profile.h 4 Jan 2005 11:59:40 -0000 @@ -58,9 +58,10 @@ #ifdef _KERNEL /* - * Note that we assume splhigh() and splx() cannot call mcount() - * recursively. + * We inline the code that splhigh and splx would do here as otherwise we would + * call recursively into mcount() as machdep.c is compiled with -pg on a + * profiling build. */ -#define MCOUNT_ENTER s = splhigh() -#define MCOUNT_EXIT splx(s) +#define MCOUNT_ENTER _SPLRAISE(s, IPL_HIGH); __splbarrier() +#define MCOUNT_EXIT __splbarrier(); _SPLX(s) #endif /* _KERNEL */ Index: arch/i386/isa/icu.s =================================================================== RCS file: /cvs/src/sys/arch/i386/isa/icu.s,v retrieving revision 1.21 diff -u -r1.21 icu.s --- arch/i386/isa/icu.s 13 Jun 2004 21:49:16 -0000 1.21 +++ arch/i386/isa/icu.s 4 Jan 2005 11:59:45 -0000 @@ -42,25 +42,6 @@ .long 0 # scheduling bits for network .text - -#if defined(PROF) || defined(GPROF) - .globl _C_LABEL(splhigh), _C_LABEL(splx) - - ALIGN_TEXT -_C_LABEL(splhigh): - movl $IPL_HIGH,%eax - xchgl %eax,CPL - ret - - ALIGN_TEXT -_C_LABEL(splx): - movl 4(%esp),%eax - movl %eax,CPL - testl %eax,%eax - jnz _C_LABEL(Xspllower) - ret -#endif /* PROF || GPROF */ - /* * Process pending interrupts. *