Title: [8232] trunk/arch/blackfin/include/asm/ftrace.h: Add CALLER_ADDR macro used by ftrace.
- Revision
- 8232
- Author
- adamliyi
- Date
- 2010-01-25 23:02:44 -0500 (Mon, 25 Jan 2010)
Log Message
Add CALLER_ADDR macro used by ftrace.
Modified Paths
Diff
Modified: trunk/arch/blackfin/include/asm/ftrace.h (8231 => 8232)
--- trunk/arch/blackfin/include/asm/ftrace.h 2010-01-25 22:12:32 UTC (rev 8231)
+++ trunk/arch/blackfin/include/asm/ftrace.h 2010-01-26 04:02:44 UTC (rev 8232)
@@ -10,4 +10,59 @@
#define MCOUNT_INSN_SIZE 6 /* sizeof "[++sp] = rets; call __mcount;" */
+#ifndef __ASSEMBLY__
+
+#if defined(CONFIG_FRAME_POINTER)
+#include <linux/mm.h>
+
+extern inline void *return_address(unsigned int level)
+{
+ unsigned long *endstack, *fp, *ret_addr;
+ unsigned int current_level = 0;
+
+ ret_addr = (unsigned long *)__builtin_return_address(0);
+ fp = (unsigned long *)__builtin_frame_address(0);
+ endstack = (unsigned long *)PAGE_ALIGN((unsigned int)&level);
+
+ if (level == 0
+ || !(fp && ((unsigned int)fp & 0x3) == 0 && fp < endstack))
+ return ret_addr;
+
+ fp = (unsigned long *)*fp;
+ while (current_level < level && fp && ((unsigned int)fp & 0x3) == 0
+ && (fp + 1) < endstack) {
+ ret_addr = (unsigned long *)*(fp + 1);
+ current_level++;
+ fp = (unsigned long *)*fp;
+ }
+
+ if (current_level < level)
+ ret_addr = NULL;
+
+ return ret_addr;
+}
+
+#else
+
+extern inline void *return_address(unsigned int level)
+{
+ return NULL;
+}
+
+#endif /* CONFIG_FRAME_POINTER */
+
+#define HAVE_ARCH_CALLER_ADDR
+
+/* inline function or macro may lead to unexpected result */
+#define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
+#define CALLER_ADDR1 ((unsigned long)return_address(1))
+#define CALLER_ADDR2 ((unsigned long)return_address(2))
+#define CALLER_ADDR3 ((unsigned long)return_address(3))
+#define CALLER_ADDR4 ((unsigned long)return_address(4))
+#define CALLER_ADDR5 ((unsigned long)return_address(5))
+#define CALLER_ADDR6 ((unsigned long)return_address(6))
+
+#endif /* __ASSEMBLY__ */
+
+
#endif
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits