Blame view

kernel/linux-rt-4.4.41/arch/blackfin/include/asm/ftrace.h 1.37 KB
5113f6f70   김현기   kernel add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  /*
   * Blackfin ftrace code
   *
   * Copyright 2009 Analog Devices Inc.
   * Licensed under the GPL-2 or later.
   */
  
  #ifndef __ASM_BFIN_FTRACE_H__
  #define __ASM_BFIN_FTRACE_H__
  
  #define MCOUNT_INSN_SIZE	6 /* sizeof "[++sp] = rets; call __mcount;" */
  
  #ifndef __ASSEMBLY__
  
  #ifdef CONFIG_DYNAMIC_FTRACE
  
  extern void _mcount(void);
  #define MCOUNT_ADDR ((unsigned long)_mcount)
  
  static inline unsigned long ftrace_call_adjust(unsigned long addr)
  {
  	return addr;
  }
  
  struct dyn_arch_ftrace {
  	/* No extra data needed for Blackfin */
  };
  
  #endif
  
  #ifdef 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;
  
  	if (level == 0)
  		return __builtin_return_address(0);
  
  	fp = (unsigned long *)__builtin_frame_address(0);
  	endstack = (unsigned long *)PAGE_ALIGN((unsigned long)&level);
  
  	while (((unsigned long)fp & 0x3) == 0 && fp &&
  	       (fp + 1) < endstack && current_level < level) {
  		fp = (unsigned long *)*fp;
  		current_level++;
  	}
  
  	if (((unsigned long)fp & 0x3) == 0 && fp &&
  	    (fp + 1) < endstack)
  		ret_addr = (unsigned long *)*(fp + 1);
  	else
  		ret_addr = NULL;
  
  	return ret_addr;
  }
  
  #else
  
  extern inline void *return_address(unsigned int level)
  {
  	return NULL;
  }
  
  #endif /* CONFIG_FRAME_POINTER */
  
  #define ftrace_return_address(n) return_address(n)
  
  #endif /* __ASSEMBLY__ */
  
  #endif