summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/include
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-05-11 23:43:55 +0000
committermarius <marius@FreeBSD.org>2007-05-11 23:43:55 +0000
commit6d578f19e463e0dc4c85f23c334bca732ea276c9 (patch)
tree3e1d56632c449303c5b5b91af49e41e90d6c7cee /sys/sparc64/include
parentec4492c7856c5a63bcf3b42821e77225f470c342 (diff)
downloadFreeBSD-src-6d578f19e463e0dc4c85f23c334bca732ea276c9.zip
FreeBSD-src-6d578f19e463e0dc4c85f23c334bca732ea276c9.tar.gz
- Add bits for userland profiling. For sun4u this is compile-tested only.
- Replace magic 14 with PIL_TICK.
Diffstat (limited to 'sys/sparc64/include')
-rw-r--r--sys/sparc64/include/profile.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/sys/sparc64/include/profile.h b/sys/sparc64/include/profile.h
index 8779ea5..6c7d1b2 100644
--- a/sys/sparc64/include/profile.h
+++ b/sys/sparc64/include/profile.h
@@ -32,18 +32,24 @@
#ifndef _MACHINE_PROFILE_H_
#define _MACHINE_PROFILE_H_
-#define FUNCTION_ALIGNMENT 32
-#define _MCOUNT_DECL void mcount
-#define MCOUNT
+#if !defined(_KERNEL) && !defined(_SYS_CDEFS_H_)
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
+#define FUNCTION_ALIGNMENT 32
typedef u_long fptrdiff_t;
#ifdef _KERNEL
#include <machine/cpufunc.h>
+#include <machine/intr_machdep.h>
+
+#define _MCOUNT_DECL void mcount
+#define MCOUNT
#define MCOUNT_DECL(s) register_t s;
-#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, 14)
+#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, PIL_TICK)
#define MCOUNT_EXIT(s) wrpr(pil, 0, s)
void bintr(void);
@@ -65,6 +71,32 @@ void mcount(uintfptr_t frompc, uintfptr_t selfpc);
typedef u_long uintfptr_t;
+#define _MCOUNT_DECL static __inline void __mcount
+
+#ifdef __GNUCLIKE_ASM
+#define MCOUNT \
+void \
+_mcount() \
+{ \
+ uintfptr_t frompc, selfpc; \
+ \
+ /* \
+ * Find the return address for mcount, \
+ * and the return address for mcount's caller. \
+ * \
+ * selfpc = pc pushed by call to mcount \
+ */ \
+ __asm("add %%o7, 8, %0" : "=r" (selfpc)); \
+ /* \
+ * frompc = pc pushed by call to mcount's caller. \
+ */ \
+ __asm("add %%i7, 8, %0" : "=r" (frompc)); \
+ __mcount(frompc, selfpc); \
+}
+#else /* !__GNUCLIKE_ASM */
+#define MCOUNT
+#endif /* __GNUCLIKE_ASM */
+
#endif /* _KERNEL */
#endif /* !_MACHINE_PROFILE_H_ */
OpenPOWER on IntegriCloud