Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / blackfin / include / asm / ftrace.h
blob2f1c3c2657ade2a7f29168bb414a5d12fb0ba0e9
1 /*
2 * Blackfin ftrace code
4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
8 #ifndef __ASM_BFIN_FTRACE_H__
9 #define __ASM_BFIN_FTRACE_H__
11 #define MCOUNT_INSN_SIZE 6 /* sizeof "[++sp] = rets; call __mcount;" */
13 #ifndef __ASSEMBLY__
15 #ifdef CONFIG_DYNAMIC_FTRACE
17 extern void _mcount(void);
18 #define MCOUNT_ADDR ((unsigned long)_mcount)
20 static inline unsigned long ftrace_call_adjust(unsigned long addr)
22 return addr;
25 struct dyn_arch_ftrace {
26 /* No extra data needed for Blackfin */
29 #endif
31 #ifdef CONFIG_FRAME_POINTER
32 #include <linux/mm.h>
34 extern inline void *return_address(unsigned int level)
36 unsigned long *endstack, *fp, *ret_addr;
37 unsigned int current_level = 0;
39 if (level == 0)
40 return __builtin_return_address(0);
42 fp = (unsigned long *)__builtin_frame_address(0);
43 endstack = (unsigned long *)PAGE_ALIGN((unsigned long)&level);
45 while (((unsigned long)fp & 0x3) == 0 && fp &&
46 (fp + 1) < endstack && current_level < level) {
47 fp = (unsigned long *)*fp;
48 current_level++;
51 if (((unsigned long)fp & 0x3) == 0 && fp &&
52 (fp + 1) < endstack)
53 ret_addr = (unsigned long *)*(fp + 1);
54 else
55 ret_addr = NULL;
57 return ret_addr;
60 #else
62 extern inline void *return_address(unsigned int level)
64 return NULL;
67 #endif /* CONFIG_FRAME_POINTER */
69 #define ftrace_return_address(n) return_address(n)
71 #endif /* __ASSEMBLY__ */
73 #endif