Blame view

kernel/linux-rt-4.4.41/arch/mips/include/asm/ftrace.h 2.11 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  /*
   * This file is subject to the terms and conditions of the GNU General Public
   * License.  See the file "COPYING" in the main directory of this archive for
   * more details.
   *
   * Copyright (C) 2009 DSLab, Lanzhou University, China
   * Author: Wu Zhangjin <wuzhangjin@gmail.com>
   */
  
  #ifndef _ASM_MIPS_FTRACE_H
  #define _ASM_MIPS_FTRACE_H
  
  #ifdef CONFIG_FUNCTION_TRACER
  
  #define MCOUNT_ADDR ((unsigned long)(_mcount))
  #define MCOUNT_INSN_SIZE 4		/* sizeof mcount call */
  
  #ifndef __ASSEMBLY__
  extern void _mcount(void);
  #define mcount _mcount
  
  #define safe_load(load, src, dst, error)		\
  do {							\
  	asm volatile (					\
  		"1: " load " %[tmp_dst], 0(%[tmp_src])
  "	\
  		"   li %[tmp_err], 0
  "			\
  		"2: .insn
  "				\
  							\
  		".section .fixup, \"ax\"
  "		\
  		"3: li %[tmp_err], 1
  "			\
  		"   j 2b
  "				\
  		".previous
  "				\
  							\
  		".section\t__ex_table,\"a\"
  \t"	\
  		STR(PTR) "\t1b, 3b
  \t"			\
  		".previous
  "				\
  							\
  		: [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\
  		: [tmp_src] "r" (src)			\
  		: "memory"				\
  	);						\
  } while (0)
  
  #define safe_store(store, src, dst, error)	\
  do {						\
  	asm volatile (				\
  		"1: " store " %[tmp_src], 0(%[tmp_dst])
  "\
  		"   li %[tmp_err], 0
  "		\
  		"2: .insn
  "			\
  						\
  		".section .fixup, \"ax\"
  "	\
  		"3: li %[tmp_err], 1
  "		\
  		"   j 2b
  "			\
  		".previous
  "			\
  						\
  		".section\t__ex_table,\"a\"
  \t"\
  		STR(PTR) "\t1b, 3b
  \t"		\
  		".previous
  "			\
  						\
  		: [tmp_err] "=r" (error)	\
  		: [tmp_dst] "r" (dst), [tmp_src] "r" (src)\
  		: "memory"			\
  	);					\
  } while (0)
  
  #define safe_load_code(dst, src, error) \
  	safe_load(STR(lw), src, dst, error)
  #define safe_store_code(src, dst, error) \
  	safe_store(STR(sw), src, dst, error)
  
  #define safe_load_stack(dst, src, error) \
  	safe_load(STR(PTR_L), src, dst, error)
  
  #define safe_store_stack(src, dst, error) \
  	safe_store(STR(PTR_S), src, dst, error)
  
  
  #ifdef CONFIG_DYNAMIC_FTRACE
  static inline unsigned long ftrace_call_adjust(unsigned long addr)
  {
  	return addr;
  }
  
  struct dyn_arch_ftrace {
  };
  
  #endif /*  CONFIG_DYNAMIC_FTRACE */
  #endif /* __ASSEMBLY__ */
  #endif /* CONFIG_FUNCTION_TRACER */
  #endif /* _ASM_MIPS_FTRACE_H */