Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/i386/include/profile.h,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/i386/include/profile.h,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.21 retrieving revision 1.21.4.2 diff -u -p -r1.21 -r1.21.4.2 --- src/sys/arch/i386/include/profile.h 2005/02/25 02:01:59 1.21 +++ src/sys/arch/i386/include/profile.h 2007/02/26 09:07:02 1.21.4.2 @@ -1,4 +1,4 @@ -/* $NetBSD: profile.h,v 1.21 2005/02/25 02:01:59 chs Exp $ */ +/* $NetBSD: profile.h,v 1.21.4.2 2007/02/26 09:07:02 yamt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -36,6 +36,7 @@ #endif #include +#include #define _MCOUNT_DECL static __inline void _mcount @@ -49,9 +50,10 @@ #define MCOUNT \ MCOUNT_COMPAT \ -extern void mcount(void) __asm__(MCOUNT_ENTRY); \ +extern void mcount(void) __asm(MCOUNT_ENTRY) \ + __attribute__((__no_instrument_function__)); \ void \ -mcount() \ +mcount(void) \ { \ int selfpc, frompcindex; \ /* \ @@ -60,11 +62,11 @@ mcount() \ * \ * selfpc = pc pushed by mcount call \ */ \ - __asm__ __volatile__("movl 4(%%ebp),%0" : "=r" (selfpc)); \ + __asm volatile("movl 4(%%ebp),%0" : "=r" (selfpc)); \ /* \ * frompcindex = pc pushed by call into self. \ */ \ - __asm__ __volatile__("movl (%%ebp),%0;movl 4(%0),%0" \ + __asm volatile("movl (%%ebp),%0;movl 4(%0),%0" \ : "=r" (frompcindex)); \ _mcount((u_long)frompcindex, (u_long)selfpc); \ } @@ -73,23 +75,35 @@ mcount() \ #ifdef MULTIPROCESSOR __cpu_simple_lock_t __mcount_lock; -#define MCOUNT_ENTER_MP \ - __cpu_simple_lock(&__mcount_lock); -#define MCOUNT_EXIT_MP \ - __cpu_simple_unlock(&__mcount_lock); +static inline void +MCOUNT_ENTER_MP(void) +{ + while (x86_atomic_testset_b(&__mcount_lock, __SIMPLELOCK_LOCKED) + != __SIMPLELOCK_UNLOCKED) { + while (__mcount_lock == __SIMPLELOCK_LOCKED) + ; + } + __insn_barrier(); +} +static inline void +MCOUNT_EXIT_MP(void) +{ + __insn_barrier(); + __mcount_lock = __SIMPLELOCK_UNLOCKED; +} #else -#define MCOUNT_ENTER_MP -#define MCOUNT_EXIT_MP +#define MCOUNT_ENTER_MP() +#define MCOUNT_EXIT_MP() #endif #define MCOUNT_ENTER \ s = (int)read_psl(); \ disable_intr(); \ - MCOUNT_ENTER_MP + MCOUNT_ENTER_MP(); #define MCOUNT_EXIT \ - MCOUNT_EXIT_MP \ + MCOUNT_EXIT_MP(); \ write_psl(s); #endif /* _KERNEL */