Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/include pull in changes from i386 profile.h:



details:   https://anonhg.NetBSD.org/src/rev/f329d3353086
branches:  trunk
changeset: 584525:f329d3353086
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Sep 22 15:47:03 2005 +0000

description:
pull in changes from i386 profile.h:
 - allow profiling of MP kernels, add a spinlock around the body of mcount().
   fixes PR 31360.
 - save and restore eflags instead of just doing cli/sti.

diffstat:

 sys/arch/amd64/include/profile.h |  33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diffs (52 lines):

diff -r 9aa84fe60071 -r f329d3353086 sys/arch/amd64/include/profile.h
--- a/sys/arch/amd64/include/profile.h  Thu Sep 22 15:42:57 2005 +0000
+++ b/sys/arch/amd64/include/profile.h  Thu Sep 22 15:47:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: profile.h,v 1.3 2003/11/28 23:22:45 fvdl Exp $ */
+/*     $NetBSD: profile.h,v 1.4 2005/09/22 15:47:03 chs Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -31,6 +31,12 @@
  *     @(#)profile.h   8.1 (Berkeley) 6/11/93
  */
 
+#ifdef _KERNEL_OPT
+#include "opt_multiprocessor.h"
+#endif
+
+#include <machine/cpufunc.h>
+
 #define        _MCOUNT_DECL void _mcount
 
 #define EPROL_EXPORT   __asm(".globl _eprol")
@@ -73,6 +79,27 @@
 
 
 #ifdef _KERNEL
-#define MCOUNT_ENTER   (void)&s; __asm__("cli");
-#define MCOUNT_EXIT    __asm__("sti");
+
+#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);
+
+#else
+#define MCOUNT_ENTER_MP
+#define MCOUNT_EXIT_MP
+#endif
+
+#define        MCOUNT_ENTER                                                    \
+       s = (int)read_psl();                                            \
+       disable_intr();                                                 \
+       MCOUNT_ENTER_MP
+
+#define        MCOUNT_EXIT                                                     \
+       MCOUNT_EXIT_MP                                                  \
+       write_psl(s);
+
 #endif /* _KERNEL */



Home | Main Index | Thread Index | Old Index