4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
8 #ifndef __ASM_BFIN_FTRACE_H__
9 #define __ASM_BFIN_FTRACE_H__
11 #define MCOUNT_INSN_SIZE 6 /* sizeof "[++sp] = rets; call __mcount;" */
15 #ifdef CONFIG_FRAME_POINTER
18 extern inline void *return_address(unsigned int level)
20 unsigned long *endstack, *fp, *ret_addr;
21 unsigned int current_level = 0;
24 return __builtin_return_address(0);
26 fp = (unsigned long *)__builtin_frame_address(0);
27 endstack = (unsigned long *)PAGE_ALIGN((unsigned long)&level);
29 while (((unsigned long)fp & 0x3) == 0 && fp &&
30 (fp + 1) < endstack && current_level < level) {
31 fp = (unsigned long *)*fp;
35 if (((unsigned long)fp & 0x3) == 0 && fp &&
37 ret_addr = (unsigned long *)*(fp + 1);
46 extern inline void *return_address(unsigned int level)
51 #endif /* CONFIG_FRAME_POINTER */
53 #define HAVE_ARCH_CALLER_ADDR
55 /* inline function or macro may lead to unexpected result */
56 #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
57 #define CALLER_ADDR1 ((unsigned long)return_address(1))
58 #define CALLER_ADDR2 ((unsigned long)return_address(2))
59 #define CALLER_ADDR3 ((unsigned long)return_address(3))
60 #define CALLER_ADDR4 ((unsigned long)return_address(4))
61 #define CALLER_ADDR5 ((unsigned long)return_address(5))
62 #define CALLER_ADDR6 ((unsigned long)return_address(6))
64 #endif /* __ASSEMBLY__ */